Changeset:
        546b3d749d34
        
https://sourceforge.net/p/mrbs/hg-code/ci/546b3d749d34f712909193e910bddf37bbc579a7
Author:
        John Beranek <[email protected]>
Date:
        Sat Sep 24 23:33:08 2016 +0100
Log message:

Fixed some bugs in the pgsql class, plus fixed sql_syntax_caseless_contains()

diffstat:

 web/dbsys.inc             |   4 ++--
 web/lib/MRBS/DB_pgsql.php |  13 +++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

diffs (73 lines):

diff -r 62e54aeb80bf -r 546b3d749d34 web/dbsys.inc
--- a/web/dbsys.inc     Sat Sep 24 22:45:40 2016 +0100
+++ b/web/dbsys.inc     Sat Sep 24 23:33:08 2016 +0100
@@ -110,9 +110,9 @@
 {
   return DB::default_db()->syntax_casesensitive_equals($fieldname, $s, 
$params);
 }
-function sql_syntax_caseless_contains($fieldname, $s)
+function sql_syntax_caseless_contains($fieldname, $s, &$params)
 {
-  return DB::default_db()->syntax_caseless_contains($fieldname, $s);
+  return DB::default_db()->syntax_caseless_contains($fieldname, $s, $params);
 }
 function sql_syntax_addcolumn_after($fieldname)
 {
diff -r 62e54aeb80bf -r 546b3d749d34 web/lib/MRBS/DB_pgsql.php
--- a/web/lib/MRBS/DB_pgsql.php Sat Sep 24 22:45:40 2016 +0100
+++ b/web/lib/MRBS/DB_pgsql.php Sat Sep 24 23:33:08 2016 +0100
@@ -90,8 +90,8 @@
   // It does not timeout, but waits forever for the lock.
   public function mutex_lock($name)
   {
-    if (($this->dbh->command("BEGIN", array()) < 0) ||
-        ($this->dbh->command("LOCK TABLE ? IN EXCLUSIVE MODE", array($name)) < 
0))
+    if (($this->command("BEGIN") < 0) ||
+        ($this->command("LOCK TABLE $name IN EXCLUSIVE MODE") < 0))
     {
       return 0;
     }
@@ -106,7 +106,7 @@
   // is no other way.
   public function mutex_unlock($name)
   {
-    $this->dbh->command("COMMIT", array());
+    $this->command("COMMIT");
     $this->mutex_lock_name = NULL;
   }
 
@@ -119,7 +119,7 @@
     // Release any forgotten locks
     if (isset($this->mutex_lock_name))
     {
-      $this->dbh->command("ABORT", array());
+      $this->command("ABORT", array());
     }
   
     // Rollback any outstanding transactions
@@ -169,6 +169,8 @@
   //  used by MRBS
   public function field_info($table)
   {
+    $fields = array();
+
     // Map PostgreSQL types on to a set of generic types
     $nature_map = array('bigint'            => 'integer',
                         'boolean'           => 'boolean',
@@ -208,7 +210,6 @@
     }
     else
     {
-      $fields = array();
       for ($i = 0; ($row = $this->row_keyed($res, $i)); $i++)
       {
         $name = $row['column_name'];
@@ -282,7 +283,7 @@
   // In PostgreSQL, we can do case insensitive regexp with ~*, but not case
   // insensitive LIKE matching.
   // Quotemeta escapes everything we need except for single quotes.
-  public function caseless_contains($fieldname, $string, &$params)
+  public function syntax_caseless_contains($fieldname, $string, &$params)
   {
     $params[] = quotemeta($string);
 

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to