diff --git a/dibi/drivers/firebird.php b/dibi/drivers/firebird.php index 2c9440dd..3c7303d4 100644 --- a/dibi/drivers/firebird.php +++ b/dibi/drivers/firebird.php @@ -27,7 +27,7 @@ * @copyright Copyright (c) 2010 * @package dibi\drivers */ -class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { const ERROR_EXCEPTION_THROWN = -836; @@ -109,7 +109,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiReflect /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException|DibiException */ public function query($sql) @@ -331,7 +331,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiReflect * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/mssql.php b/dibi/drivers/mssql.php index 6ef5f354..e4b25075 100644 --- a/dibi/drivers/mssql.php +++ b/dibi/drivers/mssql.php @@ -26,7 +26,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiMsSqlDriver extends DibiObject implements IDibiDriver +class DibiMsSqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriver { /** @var resource Connection resource */ private $connection; @@ -88,7 +88,7 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -276,7 +276,6 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/mssql2005.php b/dibi/drivers/mssql2005.php index 156471d7..b3414875 100644 --- a/dibi/drivers/mssql2005.php +++ b/dibi/drivers/mssql2005.php @@ -27,7 +27,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiMsSql2005Driver extends DibiObject implements IDibiDriver +class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResultDriver { /** @var resource Connection resource */ private $connection; @@ -89,7 +89,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -278,7 +278,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index db184aa3..057d9995 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { const ERROR_ACCESS_DENIED = 1045; const ERROR_DUPLICATE_ENTRY = 1062; @@ -146,7 +146,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiReflector /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -353,7 +353,6 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiReflector * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index 605e1405..07f7009b 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -33,7 +33,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { const ERROR_ACCESS_DENIED = 1045; const ERROR_DUPLICATE_ENTRY = 1062; @@ -147,7 +147,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiReflector /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -349,7 +349,6 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiReflector * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/odbc.php b/dibi/drivers/odbc.php index 4d6f4409..3307bc20 100644 --- a/dibi/drivers/odbc.php +++ b/dibi/drivers/odbc.php @@ -25,7 +25,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { /** @var resource Connection resource */ private $connection; @@ -93,7 +93,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiReflector /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -293,7 +293,6 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiReflector * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/oracle.php b/dibi/drivers/oracle.php index 91ead6f3..feafcfe5 100644 --- a/dibi/drivers/oracle.php +++ b/dibi/drivers/oracle.php @@ -27,7 +27,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { /** @var resource Connection resource */ private $connection; @@ -94,7 +94,7 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiReflector /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -291,7 +291,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiReflector * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/pdo.php b/dibi/drivers/pdo.php index 8474d91a..464dd02a 100644 --- a/dibi/drivers/pdo.php +++ b/dibi/drivers/pdo.php @@ -25,7 +25,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiPdoDriver extends DibiObject implements IDibiDriver +class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver { /** @var PDO Connection resource */ private $connection; @@ -97,7 +97,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -356,7 +356,6 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index 1616b1e4..3570e5cf 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -26,7 +26,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { /** @var resource Connection resource */ private $connection; @@ -119,8 +119,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiReflecto /** * Executes the SQL query. * @param string SQL statement. - * @param bool update affected rows? - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -332,7 +331,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiReflecto * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/sqlite.php b/dibi/drivers/sqlite.php index eeea8279..ddcbefde 100644 --- a/dibi/drivers/sqlite.php +++ b/dibi/drivers/sqlite.php @@ -28,7 +28,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { /** @var resource Connection resource */ private $connection; @@ -108,7 +108,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiReflector /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -295,7 +295,6 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiReflector * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/drivers/sqlite3.php b/dibi/drivers/sqlite3.php index 5341f888..f3f4aa21 100644 --- a/dibi/drivers/sqlite3.php +++ b/dibi/drivers/sqlite3.php @@ -26,7 +26,7 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi\drivers */ -class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiReflector +class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDriver, IDibiReflector { /** @var SQLite3 Connection resource */ private $connection; @@ -103,7 +103,7 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiReflecto /** * Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ public function query($sql) @@ -285,7 +285,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiReflecto * Fetches the row at current position and moves the internal cursor to the next position. * @param bool TRUE for associative array, FALSE for numeric * @return array array on success, nonarray if no next record - * @internal */ public function fetch($assoc) { diff --git a/dibi/libs/DibiDatabaseInfo.php b/dibi/libs/DibiDatabaseInfo.php index 83e7a4f8..b9b37133 100644 --- a/dibi/libs/DibiDatabaseInfo.php +++ b/dibi/libs/DibiDatabaseInfo.php @@ -349,7 +349,7 @@ class DibiTableInfo extends DibiObject */ class DibiResultInfo extends DibiObject { - /** @var IDibiReflector */ + /** @var IDibiResultDriver */ private $driver; /** @var array */ @@ -360,7 +360,7 @@ class DibiResultInfo extends DibiObject - public function __construct(IDibiReflector $driver) + public function __construct(IDibiResultDriver $driver) { $this->driver = $driver; } diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index c35bfdc7..69159e6c 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -32,7 +32,7 @@ * @package dibi * * @property-read mixed $resource - * @property-read IDibiDriver $driver + * @property-read IDibiResultDriver $driver * @property-read int $rowCount * @property-read DibiResultIterator $iterator * @property string $rowClass @@ -40,7 +40,7 @@ */ class DibiResult extends DibiObject implements IDataSource { - /** @var array IDibiDriver */ + /** @var array IDibiResultDriver */ private $driver; /** @var array Translate table */ @@ -61,7 +61,7 @@ class DibiResult extends DibiObject implements IDataSource /** - * @param IDibiDriver + * @param IDibiResultDriver * @param array */ public function __construct($driver, $config) @@ -106,7 +106,7 @@ class DibiResult extends DibiObject implements IDataSource /** * Safe access to property $driver. - * @return IDibiDriver + * @return IDibiResultDriver * @throws InvalidStateException */ private function getDriver() diff --git a/dibi/libs/interfaces.php b/dibi/libs/interfaces.php index ee2b9915..10157230 100644 --- a/dibi/libs/interfaces.php +++ b/dibi/libs/interfaces.php @@ -104,7 +104,7 @@ interface IDibiDriver /** * Internal: Executes the SQL query. * @param string SQL statement. - * @return IDibiDriver|NULL + * @return IDibiResultDriver|NULL * @throws DibiDriverException */ function query($sql); @@ -151,12 +151,6 @@ interface IDibiDriver */ function getResource(); - - - /********************* SQL ****************d*g**/ - - - /** * Encodes data for use in a SQL statement. * @param string value @@ -166,15 +160,6 @@ interface IDibiDriver */ function escape($value, $type); - /** - * Decodes data from result set. - * @param string value - * @param string type (dibi::BINARY) - * @return string decoded value - * @throws InvalidArgumentException - */ - function unescape($value, $type); - /** * Injects LIMIT/OFFSET to the SQL query. * @param string &$sql The SQL query that will be modified. @@ -184,12 +169,21 @@ interface IDibiDriver */ function applyLimit(&$sql, $limit, $offset); +} - /********************* result set ****************d*g**/ +/** + * dibi result set driver interface. + * + * @copyright Copyright (c) 2005, 2010 David Grudl + * @package dibi + */ +interface IDibiResultDriver +{ + /** * Returns the number of rows in a result set. * @return int @@ -230,6 +224,16 @@ interface IDibiDriver * @return mixed */ function getResultResource(); + + /** + * Decodes data from result set. + * @param string value + * @param string type (dibi::BINARY) + * @return string decoded value + * @throws InvalidArgumentException + */ + function unescape($value, $type); + }