1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-22 18:26:13 +02:00

+ rewritten support for logging & error handling

+ modifier %sn
* modifier %sql
* changed modifier behaviour: NULL is always 'NULL'
This commit is contained in:
David Grudl
2007-01-29 05:08:52 +00:00
parent ac980fe8c9
commit 6536dfb7dd
17 changed files with 800 additions and 181 deletions

View File

@@ -32,7 +32,6 @@ class DibiMySqlDriver extends DibiDriver {
public
$formats = array(
'NULL' => "NULL",
'TRUE' => "1",
'FALSE' => "0",
'date' => "'Y-m-d'",
@@ -107,16 +106,11 @@ class DibiMySqlDriver extends DibiDriver {
$this->insertId = $this->affectedRows = FALSE;
$res = @mysql_query($sql, $this->conn);
if ($res === FALSE) return FALSE;
if (is_resource($res))
return new DibiMySqlResult($res);
if ($res === FALSE)
throw new DibiException("Query error", array(
'message' => mysql_error($this->conn),
'code' => mysql_errno($this->conn),
'sql' => $sql,
));
$this->affectedRows = mysql_affected_rows($this->conn);
if ($this->affectedRows < 0) $this->affectedRows = FALSE;
@@ -157,6 +151,15 @@ class DibiMySqlDriver extends DibiDriver {
}
public function errorInfo()
{
return array(
'message' => mysql_error($this->conn),
'code' => mysql_errno($this->conn),
);
}
public function escape($value, $appendQuotes = FALSE)
{
return $appendQuotes