]> git.mjollnir.org Git - moodle.git/commitdiff
More changes to Oracle driver + fixing some bugs. More coming soon. MDL-14888, MDL...
authorstronk7 <stronk7>
Sun, 25 May 2008 22:23:27 +0000 (22:23 +0000)
committerstronk7 <stronk7>
Sun, 25 May 2008 22:23:27 +0000 (22:23 +0000)
lib/dml/oci8po_adodb_moodle_database.php

index e2a9c0aa514b9c1b3913595e9f479139ab03ff14..88c730ced595ced0c4d7c6114a6e3c4d53e9f152 100644 (file)
@@ -219,7 +219,7 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
             return false;
         }
 
-        oracle_dirty_hack($table, $dataobject); /// Convert object to the correct "empty" values for Oracle DB
+        $this->oracle_dirty_hack($table, $dataobject); /// Convert object to the correct "empty" values for Oracle DB
 
         $columns = $this->get_columns($table);
         $cleaned = array();
@@ -302,7 +302,7 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
 
         unset($dataobject->id);
 
-        oracle_dirty_hack($table, $dataobject); /// Convert object to the correct "empty" values for Oracle DB
+        $this->oracle_dirty_hack($table, $dataobject); /// Convert object to the correct "empty" values for Oracle DB
 
         $columns = $this->get_columns($table);
         $cleaned = array();
@@ -384,7 +384,7 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
 
         $dataobject = new StdClass;
         $dataobject->{$newfield} = $newvalue;
-        oracle_dirty_hack($table, $dataobject); // Convert object to the correct "empty" values for Oracle DB
+        $this->oracle_dirty_hack($table, $dataobject); // Convert object to the correct "empty" values for Oracle DB
         $newvalue = $dataobject->{$newfield};
 
         $columns = $this->get_columns($table);
@@ -449,7 +449,7 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
             /// Fallback, seqname not found, something is wrong. Inform and use the alternative getNameForObject() method
                 $generator = $this->get_dbman()->generator;
                 $generator->setPrefix($this->getPrefix());
-                $seqname = $generator->getNameForObject($table, $primarykey, 'seq');
+                $seqname = $generator->getNameForObject($table, 'id', 'seq');
             }
             if ($nextval = $this->db->GenID($seqname)) {
                 $params['id'] = (int)$nextval;
@@ -466,10 +466,10 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
     /// Oracle requires those function calls on insert to prepare blob/clob storage, so we
     /// specify them as SQL, deleting them from parameters
         foreach ($params as $key=>$param) {
-            if ($param == 'empty_blob()') {
+            if ($param === 'empty_blob()') {
                 $qms[] = 'empty_blob()';
                 unset($params[$key]);
-            } else if ($param == 'empty_clob()') {
+            } else if ($param === 'empty_clob()') {
                 $qms[] = 'empty_clob()';
                 unset($params[$key]);
             } else {
@@ -493,45 +493,6 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database {
         return false;
     }
 
-    /**
-     * Update record in database, as fast as possible, no safety checks, lobs not supported.
-     * (overloaded from adodb_moodle_database because of empty_blob()/empty_clob())
-     * @param string $table name
-     * @param mixed $params data record as object or array
-     * @param bool true means repeated updates expected
-     * @return bool success
-     */
-    public function update_record_raw($table, $params, $bulk=false) {
-        if (!is_array($params)) {
-            $params = (array)$params;
-        }
-        if (!isset($params['id'])) {
-            return false;
-        }
-        $id = $params['id'];
-        unset($params['id']);
-
-        if (empty($params)) {
-            return false;
-        }
-
-        $sets = array();
-        foreach ($params as $field=>$value) {
-            $sets[] = "$field = ?";
-        }
-
-        $params[] = $id; // last ? in WHERE condition
-
-        $sets = implode(',', $sets);
-        $sql = "UPDATE {$this->prefix}$table SET $sets WHERE id=?";
-
-        if (!$rs = $this->db->Execute($sql, $params)) {
-            $this->report_error($sql, $params);
-            return false;
-        }
-        return true;
-    }
-
     /**
      * This function is used to convert all the Oracle 1-space defaults to the empty string
      * like a really DIRTY HACK to allow it to work better until all those NOT NULL DEFAULT ''