mirror of
https://github.com/dg/dibi.git
synced 2025-07-16 03:56:24 +02:00
optimizations
This commit is contained in:
@ -320,18 +320,6 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts database error to DibiDriverException
|
|
||||||
*
|
|
||||||
* @throws DibiDriverException
|
|
||||||
*/
|
|
||||||
protected function throwException($sql=NULL)
|
|
||||||
{
|
|
||||||
throw new DibiDriverException();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the connection resource
|
* Returns the connection resource
|
||||||
*
|
*
|
||||||
|
@ -117,7 +117,7 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
|
|||||||
$this->resultset = @pg_query($this->connection, $sql);
|
$this->resultset = @pg_query($this->connection, $sql);
|
||||||
|
|
||||||
if ($this->resultset === FALSE) {
|
if ($this->resultset === FALSE) {
|
||||||
$this->throwException($sql);
|
throw new DibiDriverException(pg_last_error($this->connection), 0, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_resource($this->resultset);
|
return is_resource($this->resultset);
|
||||||
@ -326,18 +326,6 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts database error to DibiDriverException
|
|
||||||
*
|
|
||||||
* @throws DibiDriverException
|
|
||||||
*/
|
|
||||||
protected function throwException($sql=NULL)
|
|
||||||
{
|
|
||||||
throw new DibiDriverException(pg_last_error($this->connection), 0, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the connection resource
|
* Returns the connection resource
|
||||||
*
|
*
|
||||||
|
@ -120,16 +120,12 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
|
|||||||
|
|
||||||
DibiDriverException::catchError();
|
DibiDriverException::catchError();
|
||||||
if ($this->buffered) {
|
if ($this->buffered) {
|
||||||
$this->resultset = sqlite_query($this->connection, $sql, SQLITE_ASSOC);
|
$this->resultset = sqlite_query($this->connection, $sql);
|
||||||
} else {
|
} else {
|
||||||
$this->resultset = sqlite_unbuffered_query($this->connection, $sql, SQLITE_ASSOC);
|
$this->resultset = sqlite_unbuffered_query($this->connection, $sql);
|
||||||
}
|
}
|
||||||
DibiDriverException::restore();
|
DibiDriverException::restore();
|
||||||
|
|
||||||
if (sqlite_last_error($this->connection)) {
|
|
||||||
$this->throwException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_resource($this->resultset);
|
return is_resource($this->resultset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,19 +299,6 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts database error to DibiDriverException
|
|
||||||
*
|
|
||||||
* @throws DibiDriverException
|
|
||||||
*/
|
|
||||||
protected function throwException($sql=NULL)
|
|
||||||
{
|
|
||||||
$errno = sqlite_last_error($this->connection);
|
|
||||||
throw new DibiDriverException(sqlite_error_string($errno), $errno, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the connection resource
|
* Returns the connection resource
|
||||||
*
|
*
|
||||||
|
@ -419,15 +419,4 @@ class DibiConnection extends NObject
|
|||||||
throw new DibiException('You cannot serialize or unserialize '.__CLASS__.' instances');
|
throw new DibiException('You cannot serialize or unserialize '.__CLASS__.' instances');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns last error
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public function errorInfo()
|
|
||||||
{
|
|
||||||
throw new BadMethodCallException(__METHOD__ . ' has been deprecated');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ $array3 = array(
|
|||||||
$array4 = array(
|
$array4 = array(
|
||||||
'a' => 12,
|
'a' => 12,
|
||||||
'b' => NULL,
|
'b' => NULL,
|
||||||
'c%t' => time(), // modifier 'T' means datetime
|
'c' => dibi::datetime(),
|
||||||
'd' => 'any string',
|
'd' => 'any string',
|
||||||
);
|
);
|
||||||
$array5 = array('RAND()', '[col1] > [col2]');
|
$array5 = array('RAND()', '[col1] > [col2]');
|
||||||
|
Reference in New Issue
Block a user