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:
@@ -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
|
||||
|
Reference in New Issue
Block a user