Line 32 | Line 32 |
---|
class dbal_mssql_odbc extends dbal { var $last_query_text = '';
|
class dbal_mssql_odbc extends dbal { var $last_query_text = '';
|
| var $connect_error = '';
|
/** * Connect to server
| /** * Connect to server
|
Line 68 | Line 69 |
---|
@ini_set('odbc.defaultlrl', $max_size); }
|
@ini_set('odbc.defaultlrl', $max_size); }
|
$this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword);
| if ($this->persistency) { if (!function_exists('odbc_pconnect')) { $this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?'; return $this->sql_error(''); } $this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword); } else { if (!function_exists('odbc_connect')) { $this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?'; return $this->sql_error(''); } $this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword); }
|
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); }
| return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); }
|
Line 253 | Line 271 |
---|
}
return ($query_id !== false) ? @odbc_fetch_array($query_id) : false;
|
}
return ($query_id !== false) ? @odbc_fetch_array($query_id) : false;
|
}
/** * Seek to given row number * rownum is zero-based */ function sql_rowseek($rownum, &$query_id) { global $cache;
if ($query_id === false) { $query_id = $this->query_result; }
if (isset($cache->sql_rowset[$query_id])) { return $cache->sql_rowseek($rownum, $query_id); }
if ($query_id === false) { return false; }
$this->sql_freeresult($query_id); $query_id = $this->sql_query($this->last_query_text);
if ($query_id === false) { return false; }
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row for ($i = 0; $i < $rownum; $i++) { if (!$this->sql_fetchrow($query_id)) { return false; } }
return true;
| |
}
/**
| }
/**
|
Line 351 | Line 326 |
---|
function sql_escape($msg) { return str_replace(array("'", "\0"), array("''", ''), $msg);
|
function sql_escape($msg) { return str_replace(array("'", "\0"), array("''", ''), $msg);
|
| }
/** * {@inheritDoc} */ function sql_lower_text($column_name) { return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
|
}
/**
| }
/**
|
Line 377 | Line 360 |
---|
*/ function _sql_error() {
|
*/ function _sql_error() {
|
return array(
| if (function_exists('odbc_errormsg')) { $error = array(
|
'message' => @odbc_errormsg(),
|
'message' => @odbc_errormsg(),
|
'code' => @odbc_error()
| 'code' => @odbc_error(),
|
);
|
);
|
| } else { $error = array( 'message' => $this->connect_error, 'code' => '', ); }
return $error;
|
}
/**
| }
/**
|