changeset 501:5f6e74b660df

Fix some bugs.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 07 Dec 2013 17:51:35 +0200
parents 89e2a0ac7c7c
children d2a38070e18f
files msitegen.inc.php
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/msitegen.inc.php	Sat Dec 07 16:51:51 2013 +0200
+++ b/msitegen.inc.php	Sat Dec 07 17:51:35 2013 +0200
@@ -445,10 +445,9 @@
 }
 
 
-function stLogSQLError($sql)
+function stLogSQLError($dbh, $sql)
 {
-  global $db;
-  error_log("SQL error ".implode("; ", $db->errorInfo())." in statement \"".$sql."\"");
+  error_log("SQL error ".implode("; ", $dbh->errorInfo())." in statement \"".$sql."\"");
 }
 
 
@@ -487,7 +486,7 @@
     if ($fmt[$pos] == "%")
     {
       if ($argn < $argc)
-        $sql .= stGetSQLParam($dbh, $fmt[++$pos], $argv[$argn++]);
+        $sql .= stDBGetSQLParam($dbh, $fmt[++$pos], $argv[$argn++]);
       else
       {
         error_log("Invalid SQL statement format string '".$fmt.
@@ -540,7 +539,7 @@
     return $res;
   else
   {
-    stLogSQLError($sql);
+    stLogSQLError($dbh, $sql);
     stError("Oh noes! SQL error #23!");
     return FALSE;
   }
@@ -553,7 +552,7 @@
     return $res->fetch();
   else
   {
-    stLogSQLError($sql);
+    stLogSQLError($dbh, $sql);
     stError("Oh noes! SQL error #31!");
     return FALSE;
   }
@@ -566,7 +565,7 @@
     return $res->fetchColumn($column);
   else
   {
-    stLogSQLError($sql);
+    stLogSQLError($dbh, $sql);
     stError("Oh noes! SQL error #81!");
     return FALSE;
   }