mirror of
https://github.com/dg/dibi.git
synced 2025-08-30 09:19:48 +02:00
added new Nette exceptions
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* The dibi driver for PostgreSQL database
|
||||
* The dibi driver for PostgreSQL database.
|
||||
*
|
||||
* Connection options:
|
||||
* - 'host','hostaddr','port','dbname','user','password','connect_timeout','options','sslmode','service' - see PostgreSQL API
|
||||
@@ -37,21 +37,21 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
{
|
||||
|
||||
/**
|
||||
* Connection resource
|
||||
* Connection resource.
|
||||
* @var resource
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
|
||||
/**
|
||||
* Resultset resource
|
||||
* Resultset resource.
|
||||
* @var resource
|
||||
*/
|
||||
private $resultset;
|
||||
|
||||
|
||||
/**
|
||||
* Escape method
|
||||
* Escape method.
|
||||
* @var bool
|
||||
*/
|
||||
private $escMethod = FALSE;
|
||||
@@ -64,14 +64,14 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
public function __construct()
|
||||
{
|
||||
if (!extension_loaded('pgsql')) {
|
||||
throw new DibiDriverException("PHP extension 'pgsql' is not loaded");
|
||||
throw new DibiDriverException("PHP extension 'pgsql' is not loaded.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connects to a database
|
||||
* Connects to a database.
|
||||
*
|
||||
* @return void
|
||||
* @throws DibiException
|
||||
@@ -96,7 +96,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
DibiDriverException::restore();
|
||||
|
||||
if (!is_resource($this->connection)) {
|
||||
throw new DibiDriverException('Connecting error');
|
||||
throw new DibiDriverException('Connecting error.');
|
||||
}
|
||||
|
||||
if (isset($config['charset'])) {
|
||||
@@ -111,7 +111,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database
|
||||
* Disconnects from a database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -123,7 +123,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Executes the SQL query
|
||||
* Executes the SQL query.
|
||||
*
|
||||
* @param string SQL statement.
|
||||
* @param bool update affected rows?
|
||||
@@ -144,7 +144,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||
*
|
||||
* @return int|FALSE number of rows or FALSE on error
|
||||
*/
|
||||
@@ -156,7 +156,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
*
|
||||
* @return int|FALSE int on success or FALSE on failure
|
||||
*/
|
||||
@@ -215,7 +215,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Format to SQL command
|
||||
* Format to SQL command.
|
||||
*
|
||||
* @param string value
|
||||
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
|
||||
@@ -239,13 +239,13 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
if ($type === dibi::FIELD_BOOL) return $value ? 'TRUE' : 'FALSE';
|
||||
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
|
||||
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
|
||||
throw new InvalidArgumentException('Unsupported formatting type');
|
||||
throw new InvalidArgumentException('Unsupported formatting type.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Injects LIMIT/OFFSET to the SQL query
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
*
|
||||
* @param string &$sql The SQL query that will be modified.
|
||||
* @param int $limit
|
||||
@@ -264,7 +264,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -276,7 +276,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the row at current position and moves the internal cursor to the next position
|
||||
* Fetches the row at current position and moves the internal cursor to the next position.
|
||||
* internal usage only
|
||||
*
|
||||
* @param bool TRUE for associative array, FALSE for numeric
|
||||
@@ -290,7 +290,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Moves cursor position without fetching row
|
||||
* Moves cursor position without fetching row.
|
||||
*
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
* @return boolean TRUE on success, FALSE if unable to seek to specified record
|
||||
@@ -304,7 +304,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set
|
||||
* Frees the resources allocated for this result set.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -317,7 +317,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a result set
|
||||
* Returns metadata for all columns in a result set.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -342,7 +342,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -354,7 +354,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
|
||||
|
||||
|
||||
/**
|
||||
* Returns the resultset resource
|
||||
* Returns the resultset resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
Reference in New Issue
Block a user