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();
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();
$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);
/// 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;
/// 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 {
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 ''