1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 00:24:19 +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

@@ -28,11 +28,11 @@ class DibiSqliteDriver extends DibiDriver {
private
$conn,
$insertId = FALSE,
$affectedRows = FALSE;
$affectedRows = FALSE,
$errorMsg;
public
$formats = array(
'NULL' => "NULL",
'TRUE' => "1",
'FALSE' => "0",
'date' => "'Y-m-d'",
@@ -75,13 +75,9 @@ class DibiSqliteDriver extends DibiDriver {
$this->insertId = $this->affectedRows = FALSE;
$errorMsg = '';
$res = @sqlite_query($this->conn, $sql, SQLITE_ASSOC, $errorMsg);
$res = @sqlite_query($this->conn, $sql, SQLITE_ASSOC, $this->errorMsg);
if ($res === FALSE)
throw new DibiException("Query error", array(
'message' => $errorMsg,
'sql' => $sql,
));
if ($res === FALSE) return FALSE;
if (is_resource($res))
return new DibiSqliteResult($res);
@@ -126,6 +122,15 @@ class DibiSqliteDriver extends DibiDriver {
}
public function errorInfo()
{
return array(
'message' => $this->errorMsg,
'code' => NULL,
);
}
public function escape($value, $appendQuotes = FALSE)
{
return $appendQuotes