PostgreSQL fix

roderik - October 30, 2009 - 14:53
Project:Import HTML
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

PostgreSQL uses only single quotes to denote strings. This change makes the code consistent in that aspect (and makes my HTML import succeed):

=== modified file 'sites/all/modules/import_html/modules/core.inc'
--- sites/all/modules/import_html/modules/core.inc 2009-10-30 14:42:06 +0000
+++ sites/all/modules/import_html/modules/core.inc 2009-10-30 00:44:51 +0000
@@ -374,16 +374,16 @@

   // Use DB to fetch all aliases
   $aliases = array($path);
-  $placeholders = array(' link_path = "%s" ');
+  $placeholders = array(" link_path = '%s' ");
   $result = db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $path);
   while ($row = db_fetch_array($result)) {
     $aliases[] = $row['src'];
-    $placeholders [] = ' link_path = "%s" ';
+    $placeholders [] = " link_path = '%s' ";
   }

   // It's bad mojo to mess with the DB directly, but menu doesn't provide a lookup API.
   // Or a way to avoid caching. Do it by hand if I need a newly added menu
-  $row = db_fetch_array(db_query('SELECT * FROM {menu_links} WHERE link_path <> "" AND ('. join($placeholders, 'OR') .') ', $aliases ));
+  $row = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE link_path <> '' AND (". join($placeholders, 'OR') .') ', $aliases ));
   if ($row) {
     // If I don't unserialize this, it gets flattened later
     $row['options'] = unserialize($row['options']);

Please consider skipping the 'needs review' step; it's really a standard fix. Thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.