mirror of
https://github.com/dg/dibi.git
synced 2025-08-15 10:34:06 +02:00
- removed NException, ability of catching PHP error moved to DibiDriverException
This commit is contained in:
@@ -88,22 +88,26 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
}
|
||||
}
|
||||
|
||||
DibiDriverException::catchError();
|
||||
DibiDriverException::tryError();
|
||||
if (isset($config['persistent'])) {
|
||||
$this->connection = @pg_connect($string, PGSQL_CONNECT_FORCE_NEW);
|
||||
$this->connection = pg_connect($string, PGSQL_CONNECT_FORCE_NEW);
|
||||
} else {
|
||||
$this->connection = @pg_pconnect($string, PGSQL_CONNECT_FORCE_NEW);
|
||||
$this->connection = pg_pconnect($string, PGSQL_CONNECT_FORCE_NEW);
|
||||
}
|
||||
if (DibiDriverException::catchError($msg)) {
|
||||
throw new DibiDriverException($msg, 0);
|
||||
}
|
||||
DibiDriverException::restore();
|
||||
|
||||
if (!is_resource($this->connection)) {
|
||||
throw new DibiDriverException('Connecting error.');
|
||||
}
|
||||
|
||||
if (isset($config['charset'])) {
|
||||
DibiDriverException::catchError();
|
||||
@pg_set_client_encoding($this->connection, $config['charset']);
|
||||
DibiDriverException::restore();
|
||||
DibiDriverException::tryError();
|
||||
pg_set_client_encoding($this->connection, $config['charset']);
|
||||
if (DibiDriverException::catchError($msg)) {
|
||||
throw new DibiDriverException($msg, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['schema'])) {
|
||||
|
@@ -127,13 +127,15 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
|
||||
*/
|
||||
public function query($sql)
|
||||
{
|
||||
DibiDriverException::catchError();
|
||||
DibiDriverException::tryError();
|
||||
if ($this->buffered) {
|
||||
$this->resultset = sqlite_query($this->connection, $sql);
|
||||
} else {
|
||||
$this->resultset = sqlite_unbuffered_query($this->connection, $sql);
|
||||
}
|
||||
DibiDriverException::restore();
|
||||
if (DibiDriverException::catchError($msg)) {
|
||||
throw new DibiDriverException($msg, sqlite_last_error($this->connection), $sql);
|
||||
}
|
||||
|
||||
return is_resource($this->resultset);
|
||||
}
|
||||
|
Reference in New Issue
Block a user