[dev] [patch] turba : small fix for oci8, and add log message when saving object.

Matthieu Foillard mgf at iota-online.com
Thu Apr 24 15:00:41 PDT 2003


Index: lib/Driver/sql.php
===================================================================
RCS file: /repository/turba/lib/Driver/sql.php,v
retrieving revision 1.31
diff -u -3 -p -r1.31 sql.php
--- lib/Driver/sql.php  17 Apr 2003 04:47:35 -0000      1.31
+++ lib/Driver/sql.php  24 Apr 2003 11:18:48 -0000
@@ -33,15 +33,14 @@ class Turba_Driver_sql extends Turba_Dri
         $this->_db = &DB::connect($params, true);
         if (!is_a($this->_db, 'PEAR_Error')) {
             $this->_db->setOption('optimize', 'portability');
+           if ($params['phptype'] == 'oci8') {
+             $this->_db->query('ALTER SESSION SET NLS_DATE_FORMAT = 
\'YYYY-MM-DD\'');
+           }
         } else {
             $this->errno = -1;
             $this->errstr = $this->_db->getMessage();
         }

-        if ($params['phptype'] == 'oci8') {
-            $this->_db->query('ALTER SESSION SET NLS_DATE_FORMAT = 
\'YYYY-MM-DD\'');
-        }
-
         $this->_table = $params['table'];
     }

@@ -243,6 +242,11 @@ class Turba_Driver_sql extends Turba_Dri
         $query .= 'WHERE ' . $where;

         $result = $this->_db->query($query);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('SQL save object by %s: table = %s; query = 
"%s"',
+                                  Auth::getAuth(), $this->_table, $query),
+                          __FILE__, __LINE__, LOG_DEBUG);

         return !is_a($result, 'PEAR_Error');
     }


More information about the dev mailing list