1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-12 17:14:16 +02:00

IDibiDriver splitted into IDibiDriver & IDibiResultDriver

This commit is contained in:
David Grudl
2010-08-04 15:27:41 +02:00
parent 5cce595518
commit de85d3814e
14 changed files with 49 additions and 57 deletions

View File

@@ -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;
}

View File

@@ -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()

View File

@@ -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);
}