1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 21:28:02 +02:00

added new Nette exceptions

This commit is contained in:
David Grudl
2008-02-01 02:12:36 +00:00
parent 89dfa9f772
commit 8da9e778a6
22 changed files with 473 additions and 352 deletions

View File

@@ -21,7 +21,7 @@
/** /**
* Nette Exception base class * Nette Exception base class.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2004, 2008 David Grudl * @copyright Copyright (c) 2004, 2008 David Grudl
@@ -44,7 +44,7 @@ class NException extends Exception
/** /**
* Initializes the cause of this throwable to the specified value * Initializes the cause of this throwable to the specified value.
* *
* @param Exception * @param Exception
* @return void * @return void
@@ -54,14 +54,14 @@ class NException extends Exception
if ($this->cause === NULL) { if ($this->cause === NULL) {
$this->cause = $cause; $this->cause = $cause;
} else { } else {
throw new BadMethodCallException('Cause was already assigned'); throw new InvalidStateException('Cause was already assigned.');
} }
} }
/** /**
* Gets the Exception instance that caused the current exception * Gets the Exception instance that caused the current exception.
* *
* @return Exception * @return Exception
*/ */
@@ -73,7 +73,7 @@ class NException extends Exception
/** /**
* Returns string represenation of exception * Returns string represenation of exception.
* *
* @return string * @return string
*/ */
@@ -85,7 +85,7 @@ class NException extends Exception
/** /**
* Enables converting all PHP errors to exceptions * Enables converting all PHP errors to exceptions.
* *
* @param Exception class to be thrown * @param Exception class to be thrown
* @return void * @return void
@@ -99,7 +99,7 @@ class NException extends Exception
/** /**
* Disables converting errors to exceptions * Disables converting errors to exceptions.
* *
* @return void * @return void
*/ */
@@ -116,7 +116,7 @@ class NException extends Exception
/** /**
* Internal error handler * Internal error handler.
*/ */
public static function _errorHandler($code, $message, $file, $line, $context) public static function _errorHandler($code, $message, $file, $line, $context)
{ {

View File

@@ -66,7 +66,7 @@ abstract class NObject
{ {
/** /**
* Returns the name of the class of this object * Returns the name of the class of this object.
* *
* @return string * @return string
*/ */
@@ -78,7 +78,7 @@ abstract class NObject
/** /**
* Access to reflection * Access to reflection.
* *
* @return ReflectionObject * @return ReflectionObject
*/ */
@@ -90,17 +90,17 @@ abstract class NObject
/** /**
* Call to undefined method * Call to undefined method.
* *
* @param string method name * @param string method name
* @param array arguments * @param array arguments
* @return mixed * @return mixed
* @throws BadMethodCallException * @throws MemberAccessException
*/ */
protected function __call($name, $args) protected function __call($name, $args)
{ {
if ($name === '') { if ($name === '') {
throw new BadMethodCallException("Call to method without name"); throw new MemberAccessException("Call to method without name.");
} }
$class = get_class($this); $class = get_class($this);
@@ -126,7 +126,7 @@ abstract class NObject
} }
} while ($cl = get_parent_class($cl)); } while ($cl = get_parent_class($cl));
throw new BadMethodCallException("Call to undefined method $class::$name()"); throw new MemberAccessException("Call to undefined method $class::$name().");
} }
@@ -136,12 +136,12 @@ abstract class NObject
* *
* @param string property name * @param string property name
* @return mixed property value * @return mixed property value
* @throws LogicException if the property is not defined. * @throws MemberAccessException if the property is not defined.
*/ */
protected function &__get($name) protected function &__get($name)
{ {
if ($name === '') { if ($name === '') {
throw new LogicException("Cannot read an property without name"); throw new MemberAccessException("Cannot read an property without name.");
} }
// property getter support // property getter support
@@ -155,7 +155,7 @@ abstract class NObject
return $val; return $val;
} else { } else {
throw new LogicException("Cannot read an undeclared property $class::\$$name"); throw new MemberAccessException("Cannot read an undeclared property $class::\$$name.");
} }
} }
@@ -167,12 +167,12 @@ abstract class NObject
* @param string property name * @param string property name
* @param mixed property value * @param mixed property value
* @return void * @return void
* @throws LogicException if the property is not defined or is read-only * @throws MemberAccessException if the property is not defined or is read-only
*/ */
protected function __set($name, $value) protected function __set($name, $value)
{ {
if ($name === '') { if ($name === '') {
throw new LogicException('Cannot assign to an property without name'); throw new MemberAccessException('Cannot assign to an property without name.');
} }
// property setter support // property setter support
@@ -183,11 +183,11 @@ abstract class NObject
$this->$m($value); $this->$m($value);
} else { } else {
throw new LogicException("Cannot assign to a read-only property $class::\$$name"); throw new MemberAccessException("Cannot assign to a read-only property $class::\$$name.");
} }
} else { } else {
throw new LogicException("Cannot assign to an undeclared property $class::\$$name"); throw new MemberAccessException("Cannot assign to an undeclared property $class::\$$name.");
} }
} }
@@ -207,16 +207,16 @@ abstract class NObject
/** /**
* Access to undeclared property * Access to undeclared property.
* *
* @param string property name * @param string property name
* @return void * @return void
* @throws LogicException * @throws MemberAccessException
*/ */
protected function __unset($name) protected function __unset($name)
{ {
$class = get_class($this); $class = get_class($this);
throw new LogicException("Cannot unset an property $class::\$$name"); throw new MemberAccessException("Cannot unset an property $class::\$$name.");
} }

119
dibi/Nette/exceptions.php Normal file
View File

@@ -0,0 +1,119 @@
<?php
/**
* Nette Framework
*
* Copyright (c) 2004, 2008 David Grudl aka -dgx- (http://www.dgx.cz)
*
* This source file is subject to the "Nette license" that is bundled
* with this package in the file license.txt.
*
* For more information please see http://nettephp.com/
*
* @copyright Copyright (c) 2004, 2008 David Grudl
* @license http://nettephp.com/license Nette license
* @link http://nettephp.com/
* @category Nette
* @package Nette
*/
// no namespace;
/*
some useful SPL exception:
- LogicException
- InvalidArgumentException
- LengthException
- RuntimeException
- OutOfBoundsException
- UnexpectedValueException
other SPL exceptions are ambiguous; do not use them
*/
/**
* The exception that is thrown when the value of an argument is
* outside the allowable range of values as defined by the invoked method.
*/
class ArgumentOutOfRangeException extends InvalidArgumentException
{
}
/**
* The exception that is thrown when a method call is invalid for the object's
* current state, method has been invoked at an illegal or inappropriate time.
*/
class InvalidStateException extends RuntimeException // or InvalidOperationException?
{
}
/**
* The exception that is thrown when a requested method or operation is not implemented.
*/
class NotImplementedException extends LogicException
{
}
/**
* The exception that is thrown when an invoked method is not supported. For scenarios where
* it is sometimes possible to perform the requested operation, see InvalidStateException.
*/
class NotSupportedException extends LogicException
{
}
/**
* The exception that is thrown when accessing a class member (property or method) fails.
*/
class MemberAccessException extends LogicException
{
}
/**
* The exception that is thrown when an I/O error occurs.
*/
class IOException extends RuntimeException
{
}
/**
* The exception that is thrown when accessing a file that does not exist on disk.
*/
class FileNotFoundException extends IOException
{
}
/**
* The exception that is thrown when part of a file or directory cannot be found.
*/
class DirectoryNotFoundException extends IOException
{
}
/**
* User attempt to terminate the current script
*/
class AbortException extends RuntimeException
{
}

View File

@@ -21,18 +21,19 @@
/** /**
* Check PHP configuration * Check PHP configuration.
*/ */
if (version_compare(PHP_VERSION , '5.1.0', '<')) { if (version_compare(PHP_VERSION , '5.1.0', '<')) {
throw new Exception('dibi needs PHP 5.1.0 or newer'); throw new LogicException('dibi needs PHP 5.1.0 or newer.');
} }
// nette libraries // nette libraries
if (!class_exists('NObject', FALSE)) { require_once dirname(__FILE__) . '/libs/NObject.php'; } if (!class_exists('NotImplementedException', FALSE)) { require_once dirname(__FILE__) . '/Nette/exceptions.php'; }
if (!class_exists('NException', FALSE)) { require_once dirname(__FILE__) . '/libs/NException.php'; } if (!class_exists('NObject', FALSE)) { require_once dirname(__FILE__) . '/Nette/NObject.php'; }
if (!class_exists('NException', FALSE)) { require_once dirname(__FILE__) . '/Nette/NException.php'; }
// dibi libraries // dibi libraries
require_once dirname(__FILE__) . '/libs/interfaces.php'; require_once dirname(__FILE__) . '/libs/interfaces.php';
@@ -51,7 +52,7 @@ require_once dirname(__FILE__) . '/libs/DibiDataSource.php';
/** /**
* Interface for database drivers * Interface for database drivers.
* *
* This class is static container class for creating DB objects and * This class is static container class for creating DB objects and
* store connections info. * store connections info.
@@ -64,7 +65,7 @@ require_once dirname(__FILE__) . '/libs/DibiDataSource.php';
class dibi class dibi
{ {
/** /**
* Column type in relation to PHP native type * Column type in relation to PHP native type.
*/ */
const const
FIELD_TEXT = 's', // as 'string' FIELD_TEXT = 's', // as 'string'
@@ -85,19 +86,19 @@ class dibi
/** /**
* Connection registry storage for DibiConnection objects * Connection registry storage for DibiConnection objects.
* @var DibiConnection[] * @var DibiConnection[]
*/ */
private static $registry = array(); private static $registry = array();
/** /**
* Current connection * Current connection.
* @var DibiConnection * @var DibiConnection
*/ */
private static $connection; private static $connection;
/** /**
* Substitutions for identifiers * Substitutions for identifiers.
* @var array * @var array
*/ */
private static $substs = array(); private static $substs = array();
@@ -115,25 +116,25 @@ class dibi
public static $sql; public static $sql;
/** /**
* Elapsed time for last query * Elapsed time for last query.
* @var int * @var int
*/ */
public static $elapsedTime; public static $elapsedTime;
/** /**
* Elapsed time for all queries * Elapsed time for all queries.
* @var int * @var int
*/ */
public static $totalTime; public static $totalTime;
/** /**
* Number or queries * Number or queries.
* @var int * @var int
*/ */
public static $numOfQueries = 0; public static $numOfQueries = 0;
/** /**
* Default dibi driver * Default dibi driver.
* @var string * @var string
*/ */
public static $defaultDriver = 'mysql'; public static $defaultDriver = 'mysql';
@@ -144,7 +145,7 @@ class dibi
/** /**
* Static class - cannot be instantiated * Static class - cannot be instantiated.
*/ */
final public function __construct() final public function __construct()
{ {
@@ -154,7 +155,7 @@ class dibi
/** /**
* Creates a new DibiConnection object and connects it to specified database * Creates a new DibiConnection object and connects it to specified database.
* *
* @param array|string connection parameters * @param array|string connection parameters
* @param string connection name * @param string connection name
@@ -174,7 +175,7 @@ class dibi
/** /**
* Disconnects from database (doesn't destroy DibiConnection object) * Disconnects from database (doesn't destroy DibiConnection object).
* *
* @return void * @return void
*/ */
@@ -186,7 +187,7 @@ class dibi
/** /**
* Returns TRUE when connection was established * Returns TRUE when connection was established.
* *
* @return bool * @return bool
*/ */
@@ -198,7 +199,7 @@ class dibi
/** /**
* Retrieve active connection * Retrieve active connection.
* *
* @param string connection registy name * @param string connection registy name
* @return object DibiConnection object. * @return object DibiConnection object.
@@ -208,7 +209,7 @@ class dibi
{ {
if ($name === NULL) { if ($name === NULL) {
if (!self::$connection) { if (!self::$connection) {
throw new DibiException('Dibi is not connected to database'); throw new DibiException('Dibi is not connected to database.');
} }
return self::$connection; return self::$connection;
@@ -224,7 +225,7 @@ class dibi
/** /**
* Change active connection * Change active connection.
* *
* @param string connection registy name * @param string connection registy name
* @return void * @return void
@@ -238,7 +239,7 @@ class dibi
/** /**
* Generates and executes SQL query - Monostate for DibiConnection::query() * Generates and executes SQL query - Monostate for DibiConnection::query().
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return DibiResult Result set object (if any) * @return DibiResult Result set object (if any)
@@ -253,7 +254,7 @@ class dibi
/** /**
* Executes the SQL query - Monostate for DibiConnection::nativeQuery() * Executes the SQL query - Monostate for DibiConnection::nativeQuery().
* *
* @param string SQL statement. * @param string SQL statement.
* @return DibiResult Result set object (if any) * @return DibiResult Result set object (if any)
@@ -266,7 +267,7 @@ class dibi
/** /**
* Generates and prints SQL query - Monostate for DibiConnection::test() * Generates and prints SQL query - Monostate for DibiConnection::test().
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return bool * @return bool
@@ -280,7 +281,7 @@ class dibi
/** /**
* Executes SQL query and fetch result - Monostate for DibiConnection::query() & fetch() * Executes SQL query and fetch result - Monostate for DibiConnection::query() & fetch().
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return array * @return array
@@ -295,7 +296,7 @@ class dibi
/** /**
* Executes SQL query and fetch results - Monostate for DibiConnection::query() & fetchAll() * Executes SQL query and fetch results - Monostate for DibiConnection::query() & fetchAll().
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return array * @return array
@@ -310,7 +311,7 @@ class dibi
/** /**
* Executes SQL query and fetch first column - Monostate for DibiConnection::query() & fetchSingle() * Executes SQL query and fetch first column - Monostate for DibiConnection::query() & fetchSingle().
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return string * @return string
@@ -325,7 +326,7 @@ class dibi
/** /**
* Gets the number of affected rows * Gets the number of affected rows.
* Monostate for DibiConnection::affectedRows() * Monostate for DibiConnection::affectedRows()
* *
* @return int number of rows * @return int number of rows
@@ -339,7 +340,7 @@ class dibi
/** /**
* 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.
* Monostate for DibiConnection::insertId() * Monostate for DibiConnection::insertId()
* *
* @param string optional sequence name * @param string optional sequence name
@@ -354,7 +355,7 @@ class dibi
/** /**
* Begins a transaction - Monostate for DibiConnection::begin() * Begins a transaction - Monostate for DibiConnection::begin().
* @return void * @return void
* @throws DibiException * @throws DibiException
*/ */
@@ -366,7 +367,7 @@ class dibi
/** /**
* Commits statements in a transaction - Monostate for DibiConnection::commit() * Commits statements in a transaction - Monostate for DibiConnection::commit().
* @return void * @return void
* @throws DibiException * @throws DibiException
*/ */
@@ -378,7 +379,7 @@ class dibi
/** /**
* Rollback changes in a transaction - Monostate for DibiConnection::rollback() * Rollback changes in a transaction - Monostate for DibiConnection::rollback().
* @return void * @return void
* @throws DibiException * @throws DibiException
*/ */
@@ -403,7 +404,7 @@ class dibi
/** /**
* Experimental; will be used in PHP 5.3 * Experimental; will be used in PHP 5.3.
*/ */
public static function __callStatic($name, $args) public static function __callStatic($name, $args)
{ {
@@ -413,7 +414,7 @@ class dibi
/** /**
* Pseudotype for timestamp representation * Pseudotype for timestamp representation.
* *
* @param mixed datetime * @param mixed datetime
* @return DibiVariable * @return DibiVariable
@@ -433,7 +434,7 @@ class dibi
/** /**
* Pseudotype for date representation * Pseudotype for date representation.
* *
* @param mixed date * @param mixed date
* @return DibiVariable * @return DibiVariable
@@ -448,7 +449,7 @@ class dibi
/** /**
* Create a new substitution pair for indentifiers * Create a new substitution pair for indentifiers.
* *
* @param string from * @param string from
* @param string to * @param string to
@@ -462,7 +463,7 @@ class dibi
/** /**
* Remove substitution pair * Remove substitution pair.
* *
* @param mixed from or TRUE * @param mixed from or TRUE
* @return void * @return void
@@ -479,7 +480,7 @@ class dibi
/** /**
* Returns substitution pairs * Returns substitution pairs.
* *
* @return array * @return array
*/ */
@@ -491,7 +492,7 @@ class dibi
/** /**
* Add new event handler * Add new event handler.
* *
* @param callback * @param callback
* @return void * @return void
@@ -500,7 +501,7 @@ class dibi
public static function addHandler($callback) public static function addHandler($callback)
{ {
if (!is_callable($callback)) { if (!is_callable($callback)) {
throw new InvalidArgumentException("Invalid callback"); throw new InvalidArgumentException("Invalid callback.");
} }
self::$handlers[] = $callback; self::$handlers[] = $callback;
@@ -509,7 +510,7 @@ class dibi
/** /**
* Event notification (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback) * Event notification (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback).
* *
* @param DibiConnection * @param DibiConnection
* @param string event name * @param string event name
@@ -526,7 +527,7 @@ class dibi
/** /**
* Enable profiler & logger * Enable profiler & logger.
* *
* @param string filename * @param string filename
* @param bool log all queries? * @param bool log all queries?
@@ -543,7 +544,7 @@ class dibi
/** /**
* Prints out a syntax highlighted version of the SQL command or DibiResult * Prints out a syntax highlighted version of the SQL command or DibiResult.
* *
* @param string|DibiResult * @param string|DibiResult
* @param bool return output instead of printing it? * @param bool return output instead of printing it?

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for MS SQL database * The dibi driver for MS SQL database.
* *
* Connection options: * Connection options:
* - 'host' - the MS SQL server host name. It can also include a port number (hostname:port) * - 'host' - the MS SQL server host name. It can also include a port number (hostname:port)
@@ -38,14 +38,14 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var resource * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
@@ -58,14 +58,14 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('mssql')) { if (!extension_loaded('mssql')) {
throw new DibiDriverException("PHP extension 'mssql' is not loaded"); throw new DibiDriverException("PHP extension 'mssql' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -83,18 +83,18 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
} }
if (!is_resource($this->connection)) { if (!is_resource($this->connection)) {
throw new DibiDriverException("Can't connect to DB"); throw new DibiDriverException("Can't connect to DB.");
} }
if (isset($config['database']) && !@mssql_select_db($config['database'], $this->connection)) { if (isset($config['database']) && !@mssql_select_db($config['database'], $this->connection)) {
throw new DibiDriverException("Can't select DB '$config[database]'"); throw new DibiDriverException("Can't select DB '$config[database]'.");
} }
} }
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -106,7 +106,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -126,7 +126,7 @@ class DibiMsSqlDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -138,13 +138,13 @@ class DibiMsSqlDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
public function insertId($sequence) public function insertId($sequence)
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotSupportedException('MS SQL does not support autoincrementing.');
} }
@@ -186,7 +186,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -200,13 +200,13 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value); 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); 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -221,14 +221,14 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
} }
if ($offset) { if ($offset) {
throw new InvalidArgumentException('Offset is not implemented'); throw new NotImplementedException('Offset is not implemented.');
} }
} }
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
@@ -240,7 +240,7 @@ class DibiMsSqlDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -254,7 +254,7 @@ class DibiMsSqlDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -268,7 +268,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -281,7 +281,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -301,7 +301,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -313,7 +313,7 @@ class DibiMsSqlDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for MySQL database * The dibi driver for MySQL database.
* *
* Connection options: * Connection options:
* - 'host' - the MySQL server host name * - 'host' - the MySQL server host name
@@ -44,14 +44,14 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var resource * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
@@ -71,14 +71,14 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('mysql')) { if (!extension_loaded('mysql')) {
throw new DibiDriverException("PHP extension 'mysql' is not loaded"); throw new DibiDriverException("PHP extension 'mysql' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -143,7 +143,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -155,7 +155,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -179,7 +179,7 @@ class DibiMySqlDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -191,7 +191,7 @@ class DibiMySqlDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
@@ -239,7 +239,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -253,13 +253,13 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value); 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); 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -278,14 +278,14 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
public function rowCount() public function rowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries'); throw new DibiDriverException('Row count is not available for unbuffered queries.');
} }
return mysql_num_rows($this->resultset); return mysql_num_rows($this->resultset);
} }
@@ -293,7 +293,7 @@ class DibiMySqlDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -307,7 +307,7 @@ class DibiMySqlDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -316,7 +316,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set'); throw new DibiDriverException('Cannot seek an unbuffered result set.');
} }
return mysql_data_seek($this->resultset, $row); return mysql_data_seek($this->resultset, $row);
@@ -325,7 +325,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -338,7 +338,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -356,7 +356,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Converts database error to DibiDriverException * Converts database error to DibiDriverException.
* *
* @throws DibiDriverException * @throws DibiDriverException
*/ */
@@ -368,7 +368,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -380,7 +380,7 @@ class DibiMySqlDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for MySQL database via improved extension * The dibi driver for MySQL database via improved extension.
* *
* Connection options: * Connection options:
* - 'host' - the MySQL server host name * - 'host' - the MySQL server host name
@@ -44,14 +44,14 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var mysqli * @var mysqli
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var mysqli_result * @var mysqli_result
*/ */
private $resultset; private $resultset;
@@ -71,14 +71,14 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('mysqli')) { if (!extension_loaded('mysqli')) {
throw new DibiDriverException("PHP extension 'mysqli' is not loaded"); throw new DibiDriverException("PHP extension 'mysqli' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -127,7 +127,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -139,7 +139,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -159,7 +159,7 @@ class DibiMySqliDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -171,7 +171,7 @@ class DibiMySqliDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
@@ -219,7 +219,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -233,13 +233,13 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value); 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); 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -258,14 +258,14 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
public function rowCount() public function rowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries'); throw new DibiDriverException('Row count is not available for unbuffered queries.');
} }
return mysqli_num_rows($this->resultset); return mysqli_num_rows($this->resultset);
} }
@@ -273,7 +273,7 @@ class DibiMySqliDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -287,7 +287,7 @@ class DibiMySqliDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -296,7 +296,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set'); throw new DibiDriverException('Cannot seek an unbuffered result set.');
} }
return mysqli_data_seek($this->resultset, $row); return mysqli_data_seek($this->resultset, $row);
} }
@@ -304,7 +304,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -317,7 +317,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -335,7 +335,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Converts database error to DibiDriverException * Converts database error to DibiDriverException.
* *
* @throws DibiDriverException * @throws DibiDriverException
*/ */
@@ -347,7 +347,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mysqli * @return mysqli
*/ */
@@ -359,7 +359,7 @@ class DibiMySqliDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mysqli_result * @return mysqli_result
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver interacting with databases via ODBC connections * The dibi driver interacting with databases via ODBC connections.
* *
* Connection options: * Connection options:
* - 'dsn' - driver specific DSN * - 'dsn' - driver specific DSN
@@ -37,21 +37,21 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var resource * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
/** /**
* Cursor * Cursor.
* @var int * @var int
*/ */
private $row = 0; private $row = 0;
@@ -64,14 +64,14 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('odbc')) { if (!extension_loaded('odbc')) {
throw new DibiDriverException("PHP extension 'odbc' is not loaded"); throw new DibiDriverException("PHP extension 'odbc' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -100,7 +100,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -112,7 +112,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -132,7 +132,7 @@ class DibiOdbcDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -144,13 +144,13 @@ class DibiOdbcDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
public function insertId($sequence) public function insertId($sequence)
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotSupportedException('ODBC does not support autoincrementing.');
} }
@@ -200,7 +200,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -214,13 +214,13 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0;
if ($type === dibi::FIELD_DATE) return date("#m/d/Y#", $value); if ($type === dibi::FIELD_DATE) return date("#m/d/Y#", $value);
if ($type === dibi::FIELD_DATETIME) return date("#m/d/Y H:i:s#", $value); if ($type === dibi::FIELD_DATETIME) return date("#m/d/Y 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -234,13 +234,13 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')'; $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
} }
if ($offset) throw new InvalidArgumentException('Offset is not implemented in driver odbc'); if ($offset) throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
} }
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
@@ -253,7 +253,7 @@ class DibiOdbcDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -276,7 +276,7 @@ class DibiOdbcDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -291,7 +291,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -304,7 +304,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -329,7 +329,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Converts database error to DibiDriverException * Converts database error to DibiDriverException.
* *
* @throws DibiDriverException * @throws DibiDriverException
*/ */
@@ -341,7 +341,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -353,7 +353,7 @@ class DibiOdbcDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for Oracle database * The dibi driver for Oracle database.
* *
* Connection options: * Connection options:
* - 'database' (or 'db') - the name of the local Oracle instance or the name of the entry in tnsnames.ora * - 'database' (or 'db') - the name of the local Oracle instance or the name of the entry in tnsnames.ora
@@ -37,14 +37,14 @@ class DibiOracleDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var resource * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
@@ -63,14 +63,14 @@ class DibiOracleDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('oci8')) { if (!extension_loaded('oci8')) {
throw new DibiDriverException("PHP extension 'oci8' is not loaded"); throw new DibiDriverException("PHP extension 'oci8' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -93,7 +93,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -105,7 +105,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -131,25 +131,25 @@ class DibiOracleDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
public function affectedRows() public function affectedRows()
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotImplementedException;
} }
/** /**
* 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 * @return int|FALSE int on success or FALSE on failure
*/ */
public function insertId($sequence) public function insertId($sequence)
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotSupportedException('Oracle does not support autoincrementing.');
} }
@@ -197,7 +197,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -211,13 +211,13 @@ class DibiOracleDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("U", $value); if ($type === dibi::FIELD_DATE) return date("U", $value);
if ($type === dibi::FIELD_DATETIME) return date("U", $value); if ($type === dibi::FIELD_DATETIME) return date("U", $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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -233,7 +233,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
@@ -245,7 +245,7 @@ class DibiOracleDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -259,7 +259,7 @@ class DibiOracleDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -267,13 +267,13 @@ class DibiOracleDriver extends NObject implements IDibiDriver
*/ */
public function seek($row) public function seek($row)
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotImplementedException;
} }
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -286,7 +286,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -311,7 +311,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Converts database error to DibiDriverException * Converts database error to DibiDriverException.
* *
* @throws DibiDriverException * @throws DibiDriverException
*/ */
@@ -324,7 +324,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -336,7 +336,7 @@ class DibiOracleDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for PDO * The dibi driver for PDO.
* *
* Connection options: * Connection options:
* - 'dsn' - driver specific DSN * - 'dsn' - driver specific DSN
@@ -37,21 +37,21 @@ class DibiPdoDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var PDO * @var PDO
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var PDOStatement * @var PDOStatement
*/ */
private $resultset; private $resultset;
/** /**
* Affected rows * Affected rows.
* @var int * @var int
*/ */
private $affectedRows = FALSE; private $affectedRows = FALSE;
@@ -64,14 +64,14 @@ class DibiPdoDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('pdo')) { if (!extension_loaded('pdo')) {
throw new DibiDriverException("PHP extension 'pdo' is not loaded"); throw new DibiDriverException("PHP extension 'pdo' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -90,14 +90,14 @@ class DibiPdoDriver extends NObject implements IDibiDriver
} }
if (!$this->connection) { if (!$this->connection) {
throw new DibiDriverException('Connecting error'); throw new DibiDriverException('Connecting error.');
} }
} }
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -109,7 +109,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -146,7 +146,7 @@ class DibiPdoDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -158,7 +158,7 @@ class DibiPdoDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
@@ -212,7 +212,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -226,13 +226,13 @@ class DibiPdoDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value); 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); 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -241,25 +241,25 @@ class DibiPdoDriver extends NObject implements IDibiDriver
*/ */
public function applyLimit(&$sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotSupportedException('PDO does not support applying limit or offset.');
} }
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
public function rowCount() public function rowCount()
{ {
throw new DibiDriverException('Row count is not available for unbuffered queries'); throw new DibiDriverException('Row count is not available for unbuffered queries.');
} }
/** /**
* 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -273,7 +273,7 @@ class DibiPdoDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -281,13 +281,13 @@ class DibiPdoDriver extends NObject implements IDibiDriver
*/ */
public function seek($row) public function seek($row)
{ {
throw new DibiDriverException('Cannot seek an unbuffered result set'); throw new DibiDriverException('Cannot seek an unbuffered result set.');
} }
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -299,7 +299,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
* @throws DibiException * @throws DibiException
@@ -312,7 +312,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
// items 'name' and 'table' are required // items 'name' and 'table' are required
$info = @$this->resultset->getColumnsMeta($i); $info = @$this->resultset->getColumnsMeta($i);
if ($info === FALSE) { if ($info === FALSE) {
throw new DibiDriverException('Driver does not support meta data'); throw new DibiDriverException('Driver does not support meta data.');
} }
$meta[] = $info; $meta[] = $info;
} }
@@ -322,7 +322,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Converts database error to DibiDriverException * Converts database error to DibiDriverException.
* *
* @throws DibiDriverException * @throws DibiDriverException
*/ */
@@ -335,7 +335,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return PDO * @return PDO
*/ */
@@ -347,7 +347,7 @@ class DibiPdoDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return PDOStatement * @return PDOStatement
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for PostgreSQL database * The dibi driver for PostgreSQL database.
* *
* Connection options: * Connection options:
* - 'host','hostaddr','port','dbname','user','password','connect_timeout','options','sslmode','service' - see PostgreSQL API * - '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 * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
/** /**
* Escape method * Escape method.
* @var bool * @var bool
*/ */
private $escMethod = FALSE; private $escMethod = FALSE;
@@ -64,14 +64,14 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('pgsql')) { 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 * @return void
* @throws DibiException * @throws DibiException
@@ -96,7 +96,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
DibiDriverException::restore(); DibiDriverException::restore();
if (!is_resource($this->connection)) { if (!is_resource($this->connection)) {
throw new DibiDriverException('Connecting error'); throw new DibiDriverException('Connecting error.');
} }
if (isset($config['charset'])) { if (isset($config['charset'])) {
@@ -111,7 +111,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @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 string SQL statement.
* @param bool update affected rows? * @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 * @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 * @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 value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @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_BOOL) return $value ? 'TRUE' : 'FALSE';
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value); 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); 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 string &$sql The SQL query that will be modified.
* @param int $limit * @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 * @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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @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 * @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 * @return array
*/ */
@@ -342,7 +342,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -354,7 +354,7 @@ class DibiPostgreDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -19,7 +19,7 @@
/** /**
* The dibi driver for SQLite database * The dibi driver for SQLite database.
* *
* Connection options: * Connection options:
* - 'database' (or 'file') - the filename of the SQLite database * - 'database' (or 'file') - the filename of the SQLite database
@@ -38,14 +38,14 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
{ {
/** /**
* Connection resource * Connection resource.
* @var resource * @var resource
*/ */
private $connection; private $connection;
/** /**
* Resultset resource * Resultset resource.
* @var resource * @var resource
*/ */
private $resultset; private $resultset;
@@ -59,7 +59,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Date and datetime format * Date and datetime format.
* @var string * @var string
*/ */
private $fmtDate, $fmtDateTime; private $fmtDate, $fmtDateTime;
@@ -72,14 +72,14 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
public function __construct() public function __construct()
{ {
if (!extension_loaded('sqlite')) { if (!extension_loaded('sqlite')) {
throw new DibiDriverException("PHP extension 'sqlite' is not loaded"); throw new DibiDriverException("PHP extension 'sqlite' is not loaded.");
} }
} }
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -107,7 +107,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -119,7 +119,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -141,7 +141,7 @@ class DibiSqliteDriver 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -153,7 +153,7 @@ class DibiSqliteDriver 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 * @return int|FALSE int on success or FALSE on failure
*/ */
@@ -201,7 +201,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -215,13 +215,13 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0; if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date($this->fmtDate, $value); if ($type === dibi::FIELD_DATE) return date($this->fmtDate, $value);
if ($type === dibi::FIELD_DATETIME) return date($this->fmtDateTime, $value); if ($type === dibi::FIELD_DATETIME) return date($this->fmtDateTime, $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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -237,14 +237,14 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
public function rowCount() public function rowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries'); throw new DibiDriverException('Row count is not available for unbuffered queries.');
} }
return sqlite_num_rows($this->resultset); return sqlite_num_rows($this->resultset);
} }
@@ -252,7 +252,7 @@ class DibiSqliteDriver 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -266,7 +266,7 @@ class DibiSqliteDriver 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 * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -275,7 +275,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set'); throw new DibiDriverException('Cannot seek an unbuffered result set.');
} }
return sqlite_seek($this->resultset, $row); return sqlite_seek($this->resultset, $row);
} }
@@ -283,7 +283,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -295,7 +295,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
*/ */
@@ -316,7 +316,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -328,7 +328,7 @@ class DibiSqliteDriver extends NObject implements IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */

View File

@@ -20,7 +20,7 @@
/** /**
* dibi connection * dibi connection.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -30,13 +30,13 @@
class DibiConnection extends NObject class DibiConnection extends NObject
{ {
/** /**
* Current connection configuration * Current connection configuration.
* @var array * @var array
*/ */
private $config; private $config;
/** /**
* IDibiDriver * IDibiDriver.
* @var array * @var array
*/ */
private $driver; private $driver;
@@ -56,7 +56,7 @@ class DibiConnection extends NObject
/** /**
* Creates object and (optionally) connects to a database * Creates object and (optionally) connects to a database.
* *
* @param array|string connection parameters * @param array|string connection parameters
* @throws DibiException * @throws DibiException
@@ -93,7 +93,7 @@ class DibiConnection extends NObject
/** /**
* Automatically frees the resources allocated for this result set * Automatically frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -106,7 +106,7 @@ class DibiConnection extends NObject
/** /**
* Connects to a database * Connects to a database.
* *
* @return void * @return void
*/ */
@@ -122,7 +122,7 @@ class DibiConnection extends NObject
/** /**
* Disconnects from a database * Disconnects from a database.
* *
* @return void * @return void
*/ */
@@ -164,7 +164,7 @@ class DibiConnection extends NObject
/** /**
* Apply configuration alias or default values * Apply configuration alias or default values.
* *
* @param array connect configuration * @param array connect configuration
* @param string key * @param string key
@@ -186,7 +186,7 @@ class DibiConnection extends NObject
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return resource * @return resource
*/ */
@@ -198,7 +198,7 @@ class DibiConnection extends NObject
/** /**
* Generates (translates) and executes SQL query * Generates (translates) and executes SQL query.
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return DibiResult Result set object (if any) * @return DibiResult Result set object (if any)
@@ -219,7 +219,7 @@ class DibiConnection extends NObject
/** /**
* Generates and prints SQL query * Generates and prints SQL query.
* *
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return bool * @return bool
@@ -227,6 +227,7 @@ class DibiConnection extends NObject
final public function test($args) final public function test($args)
{ {
$args = func_get_args(); $args = func_get_args();
$this->connect();
$trans = new DibiTranslator($this->driver); $trans = new DibiTranslator($this->driver);
$ok = $trans->translate($args); $ok = $trans->translate($args);
dibi::dump($trans->sql); dibi::dump($trans->sql);
@@ -236,7 +237,7 @@ class DibiConnection extends NObject
/** /**
* Executes the SQL query * Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return DibiResult Result set object (if any) * @return DibiResult Result set object (if any)
@@ -265,7 +266,7 @@ class DibiConnection extends NObject
/** /**
* 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 number of rows * @return int number of rows
* @throws DibiException * @throws DibiException
@@ -273,14 +274,14 @@ class DibiConnection extends NObject
public function affectedRows() public function affectedRows()
{ {
$rows = $this->driver->affectedRows(); $rows = $this->driver->affectedRows();
if (!is_int($rows) || $rows < 0) throw new DibiException('Cannot retrieve number of affected rows'); if (!is_int($rows) || $rows < 0) throw new DibiException('Cannot retrieve number of affected rows.');
return $rows; return $rows;
} }
/** /**
* 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.
* *
* @param string optional sequence name * @param string optional sequence name
* @return int * @return int
@@ -289,7 +290,7 @@ class DibiConnection extends NObject
public function insertId($sequence = NULL) public function insertId($sequence = NULL)
{ {
$id = $this->driver->insertId($sequence); $id = $this->driver->insertId($sequence);
if ($id < 1) throw new DibiException('Cannot retrieve last generated ID'); if ($id < 1) throw new DibiException('Cannot retrieve last generated ID.');
return (int) $id; return (int) $id;
} }
@@ -303,7 +304,7 @@ class DibiConnection extends NObject
{ {
$this->connect(); $this->connect();
if ($this->inTxn) { if ($this->inTxn) {
throw new DibiException('There is already an active transaction'); throw new DibiException('There is already an active transaction.');
} }
$this->driver->begin(); $this->driver->begin();
$this->inTxn = TRUE; $this->inTxn = TRUE;
@@ -319,7 +320,7 @@ class DibiConnection extends NObject
public function commit() public function commit()
{ {
if (!$this->inTxn) { if (!$this->inTxn) {
throw new DibiException('There is no active transaction'); throw new DibiException('There is no active transaction.');
} }
$this->driver->commit(); $this->driver->commit();
$this->inTxn = FALSE; $this->inTxn = FALSE;
@@ -335,7 +336,7 @@ class DibiConnection extends NObject
public function rollback() public function rollback()
{ {
if (!$this->inTxn) { if (!$this->inTxn) {
throw new DibiException('There is no active transaction'); throw new DibiException('There is no active transaction.');
} }
$this->driver->rollback(); $this->driver->rollback();
$this->inTxn = FALSE; $this->inTxn = FALSE;
@@ -345,7 +346,7 @@ class DibiConnection extends NObject
/** /**
* Escapes the string * Escapes the string.
* *
* @param string unescaped string * @param string unescaped string
* @return string escaped and optionally quoted string * @return string escaped and optionally quoted string
@@ -359,7 +360,7 @@ class DibiConnection extends NObject
/** /**
* Delimites identifier (table's or column's name, etc.) * Delimites identifier (table's or column's name, etc.).
* *
* @param string identifier * @param string identifier
* @return string delimited identifier * @return string delimited identifier
@@ -372,7 +373,7 @@ class DibiConnection extends NObject
/** /**
* 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -400,7 +401,7 @@ class DibiConnection extends NObject
$handle = @fopen($file, 'r'); $handle = @fopen($file, 'r');
if (!$handle) { if (!$handle) {
throw new DibiException("Cannot open file '$file'"); throw new FileNotFoundException("Cannot open file '$file'.");
} }
$count = 0; $count = 0;
@@ -427,27 +428,27 @@ class DibiConnection extends NObject
*/ */
public function getDibiReflection() public function getDibiReflection()
{ {
throw new BadMethodCallException(__METHOD__ . ' is not implemented'); throw new NotImplementedException;
} }
/** /**
* Prevents unserialization * Prevents unserialization.
*/ */
public function __wakeup() public function __wakeup()
{ {
throw new DibiException('You cannot serialize or unserialize ' . $this->getClass() . ' instances'); throw new NotSupportedException('You cannot serialize or unserialize ' . $this->getClass() . ' instances.');
} }
/** /**
* Prevents serialization * Prevents serialization.
*/ */
public function __sleep() public function __sleep()
{ {
throw new DibiException('You cannot serialize or unserialize ' . $this->getClass() . ' instances'); throw new NotSupportedException('You cannot serialize or unserialize ' . $this->getClass() . ' instances.');
} }
} }

View File

@@ -20,7 +20,7 @@
/** /**
* Default implementation of IDataSource for dibi * Default implementation of IDataSource for dibi.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl

View File

@@ -20,7 +20,7 @@
/** /**
* dibi common exception * dibi common exception.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -35,7 +35,7 @@ class DibiException extends NException
/** /**
* database server exception * database server exception.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -49,7 +49,7 @@ class DibiDriverException extends DibiException
/** /**
* Construct an dibi driver exception * Construct an dibi driver exception.
* *
* @param string Message describing the exception * @param string Message describing the exception
* @param int Some code * @param int Some code

View File

@@ -20,7 +20,7 @@
/** /**
* dibi basic logger & profiler (experimental) * dibi basic logger & profiler (experimental).
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -51,7 +51,7 @@ final class DibiLogger extends NObject
/** /**
* Event handler (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback) * Event handler (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback).
* *
* @param DibiConnection * @param DibiConnection
* @param string event name * @param string event name

View File

@@ -20,7 +20,7 @@
/** /**
* dibi result-set abstract class * dibi result-set abstract class.
* *
* <code> * <code>
* $result = dibi::query('SELECT * FROM [table]'); * $result = dibi::query('SELECT * FROM [table]');
@@ -44,25 +44,25 @@
class DibiResult extends NObject implements IDataSource class DibiResult extends NObject implements IDataSource
{ {
/** /**
* IDibiDriver * IDibiDriver.
* @var array * @var array
*/ */
private $driver; private $driver;
/** /**
* Translate table * Translate table.
* @var array * @var array
*/ */
private $xlat; private $xlat;
/** /**
* Cache for $driver->getColumnsMeta() * Cache for $driver->getColumnsMeta().
* @var array * @var array
*/ */
private $metaCache; private $metaCache;
/** /**
* Already fetched? Used for allowance for first seek(0) * Already fetched? Used for allowance for first seek(0).
* @var bool * @var bool
*/ */
private $fetched = FALSE; private $fetched = FALSE;
@@ -105,7 +105,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Automatically frees the resources allocated for this result set * Automatically frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -117,7 +117,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */
@@ -129,7 +129,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Moves cursor position without fetching row * Moves cursor position without fetching row.
* *
* @param int the 0-based cursor pos to seek to * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -143,7 +143,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
@@ -155,7 +155,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @return void * @return void
*/ */
@@ -216,7 +216,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Fetches the row at current position, process optional type conversion * Fetches the row at current position, process optional type conversion.
* and moves the internal cursor to the next position * and moves the internal cursor to the next position
* *
* @param bool fetch as object? Overrides $this->asObjects * @param bool fetch as object? Overrides $this->asObjects
@@ -255,7 +255,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Like fetch(), but returns only first field * Like fetch(), but returns only first field.
* *
* @return mixed value on success, FALSE if no next record * @return mixed value on success, FALSE if no next record
*/ */
@@ -308,7 +308,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Fetches all records from table and returns associative tree * Fetches all records from table and returns associative tree.
* Associative descriptor: assoc1,#,assoc2,=,assoc3,@ * Associative descriptor: assoc1,#,assoc2,=,assoc3,@
* builds a tree: $data[assoc1][index][assoc2]['assoc3']->value = {record} * builds a tree: $data[assoc1][index][assoc2]['assoc3']->value = {record}
* *
@@ -328,7 +328,7 @@ class DibiResult extends NObject implements IDataSource
// check columns // check columns
foreach ($assoc as $as) { foreach ($assoc as $as) {
if ($as !== '#' && $as !== '=' && $as !== '@' && !array_key_exists($as, $row)) { if ($as !== '#' && $as !== '=' && $as !== '@' && !array_key_exists($as, $row)) {
throw new InvalidArgumentException("Unknown column '$as' in associative descriptor"); throw new InvalidArgumentException("Unknown column '$as' in associative descriptor.");
} }
} }
@@ -392,7 +392,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Fetches all records from table like $key => $value pairs * Fetches all records from table like $key => $value pairs.
* *
* @param string associative key * @param string associative key
* @param string value * @param string value
@@ -409,11 +409,11 @@ class DibiResult extends NObject implements IDataSource
if ($value === NULL) { if ($value === NULL) {
if ($key !== NULL) { if ($key !== NULL) {
throw new InvalidArgumentException("Either none or both columns must be specified"); throw new InvalidArgumentException("Either none or both columns must be specified.");
} }
if (count($row) < 2) { if (count($row) < 2) {
throw new LoginException("Result must have at least two columns"); throw new UnexpectedValueException("Result must have at least two columns.");
} }
// autodetect // autodetect
@@ -423,7 +423,7 @@ class DibiResult extends NObject implements IDataSource
} else { } else {
if (!array_key_exists($value, $row)) { if (!array_key_exists($value, $row)) {
throw new InvalidArgumentException("Unknown value column '$value'"); throw new InvalidArgumentException("Unknown value column '$value'.");
} }
if ($key === NULL) { // indexed-array if ($key === NULL) { // indexed-array
@@ -434,7 +434,7 @@ class DibiResult extends NObject implements IDataSource
} }
if (!array_key_exists($key, $row)) { if (!array_key_exists($key, $row)) {
throw new InvalidArgumentException("Unknown key column '$key'"); throw new InvalidArgumentException("Unknown key column '$key'.");
} }
} }
@@ -491,7 +491,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Gets an array of meta informations about column * Gets an array of meta informations about column.
* *
* @return array * @return array
*/ */
@@ -512,7 +512,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Displays complete result-set as HTML table for debug purposes * Displays complete result-set as HTML table for debug purposes.
* *
* @return void * @return void
*/ */
@@ -549,7 +549,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Required by the IteratorAggregate interface * Required by the IteratorAggregate interface.
* @param int offset * @param int offset
* @param int limit * @param int limit
* @return ArrayIterator * @return ArrayIterator
@@ -562,7 +562,7 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Required by the Countable interface * Required by the Countable interface.
* @return int * @return int
*/ */
final public function count() final public function count()
@@ -573,15 +573,15 @@ class DibiResult extends NObject implements IDataSource
/** /**
* Safe access to property $driver * Safe access to property $driver.
* *
* @return IDibiDriver * @return IDibiDriver
* @throws DibiException * @throws InvalidStateException
*/ */
private function getDriver() private function getDriver()
{ {
if ($this->driver === NULL) { if ($this->driver === NULL) {
throw new DibiException('Resultset was released from memory'); throw new InvalidStateException('Resultset was released from memory.');
} }
return $this->driver; return $this->driver;

View File

@@ -20,7 +20,7 @@
/** /**
* External result set iterator * External result set iterator.
* *
* This can be returned by DibiResult::getIterator() method or using foreach * This can be returned by DibiResult::getIterator() method or using foreach
* <code> * <code>
@@ -62,7 +62,7 @@ final class DibiResultIterator implements Iterator
/** /**
* Required by the Iterator interface * Required by the Iterator interface.
* @param int offset * @param int offset
* @param int limit * @param int limit
*/ */
@@ -76,7 +76,7 @@ final class DibiResultIterator implements Iterator
/** /**
* Rewinds the Iterator to the first element * Rewinds the Iterator to the first element.
* @return void * @return void
*/ */
public function rewind() public function rewind()

View File

@@ -54,7 +54,7 @@ abstract class DibiTable extends NObject
/** /**
* Table constructor * Table constructor.
* @param array * @param array
* @return void * @return void
*/ */
@@ -72,7 +72,7 @@ abstract class DibiTable extends NObject
/** /**
* Returns the table name * Returns the table name.
* @return string * @return string
*/ */
public function getName() public function getName()
@@ -83,7 +83,7 @@ abstract class DibiTable extends NObject
/** /**
* Returns the primary key name * Returns the primary key name.
* @return string * @return string
*/ */
public function getPrimary() public function getPrimary()
@@ -94,7 +94,7 @@ abstract class DibiTable extends NObject
/** /**
* Returns the dibi connection * Returns the dibi connection.
* @return DibiConnection * @return DibiConnection
*/ */
public function getConnection() public function getConnection()
@@ -105,7 +105,7 @@ abstract class DibiTable extends NObject
/** /**
* Setup object * Setup object.
* @return void * @return void
*/ */
protected function setup() protected function setup()
@@ -135,7 +135,7 @@ abstract class DibiTable extends NObject
/** /**
* Inserts row into a table * Inserts row into a table.
* @param array|object * @param array|object
* @return int new primary key * @return int new primary key
*/ */
@@ -150,7 +150,7 @@ abstract class DibiTable extends NObject
/** /**
* Updates rows in a table * Updates rows in a table.
* @param mixed primary key value(s) * @param mixed primary key value(s)
* @param array|object * @param array|object
* @return int number of updated rows * @return int number of updated rows
@@ -168,7 +168,7 @@ abstract class DibiTable extends NObject
/** /**
* Deletes rows from a table by primary key * Deletes rows from a table by primary key.
* @param mixed primary key value(s) * @param mixed primary key value(s)
* @return int number of deleted rows * @return int number of deleted rows
*/ */
@@ -184,7 +184,7 @@ abstract class DibiTable extends NObject
/** /**
* Finds rows by primary key * Finds rows by primary key.
* @param mixed primary key value(s) * @param mixed primary key value(s)
* @return DibiResult * @return DibiResult
*/ */
@@ -202,7 +202,7 @@ abstract class DibiTable extends NObject
/** /**
* Selects all rows * Selects all rows.
* @param string column to order by * @param string column to order by
* @return DibiResult * @return DibiResult
*/ */
@@ -224,7 +224,7 @@ abstract class DibiTable extends NObject
/** /**
* Fetches single row * Fetches single row.
* @param scalar primary key value * @param scalar primary key value
* @return array|object row * @return array|object row
*/ */
@@ -239,7 +239,7 @@ abstract class DibiTable extends NObject
/** /**
* Returns a blank row (not fetched from database) * Returns a blank row (not fetched from database).
* @return array|object * @return array|object
*/ */
public function createBlank() public function createBlank()
@@ -255,7 +255,7 @@ abstract class DibiTable extends NObject
/** /**
* User data pre-processing * User data pre-processing.
* @param array|object * @param array|object
* @return array * @return array
*/ */
@@ -267,13 +267,13 @@ abstract class DibiTable extends NObject
return $data; return $data;
} }
throw new DibiException('Dataset must be array or anonymous object'); throw new InvalidArgumentException('Dataset must be array or anonymous object.');
} }
/** /**
* User DibiResult post-processing * User DibiResult post-processing.
* @param DibiResult * @param DibiResult
* @return DibiResult * @return DibiResult
*/ */

View File

@@ -20,7 +20,7 @@
/** /**
* dibi SQL translator * dibi SQL translator.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -69,7 +69,7 @@ final class DibiTranslator extends NObject
/** /**
* return IDibiDriver * return IDibiDriver.
*/ */
public function getDriver() public function getDriver()
{ {
@@ -79,7 +79,7 @@ final class DibiTranslator extends NObject
/** /**
* Generates SQL * Generates SQL.
* *
* @param array * @param array
* @return bool * @return bool
@@ -187,7 +187,7 @@ final class DibiTranslator extends NObject
/** /**
* Apply modifier to single value * Apply modifier to single value.
* @param mixed * @param mixed
* @param string * @param string
* @return string * @return string
@@ -342,7 +342,7 @@ final class DibiTranslator extends NObject
/** /**
* PREG callback from translate() or formatValue() * PREG callback from translate() or formatValue().
* @param array * @param array
* @return string * @return string
*/ */
@@ -426,7 +426,7 @@ final class DibiTranslator extends NObject
if ($matches[2]) // SQL identifiers: [ident] if ($matches[2]) // SQL identifiers: [ident]
return $this->delimite($matches[2]); return $this->delimite($matches[2]);
if ($matches[3]) // SQL strings: '....' if ($matches[3]) // SQL strings: '...'
return $this->driver->format( str_replace("''", "'", $matches[4]), dibi::FIELD_TEXT); return $this->driver->format( str_replace("''", "'", $matches[4]), dibi::FIELD_TEXT);
if ($matches[5]) // SQL strings: "..." if ($matches[5]) // SQL strings: "..."
@@ -443,7 +443,7 @@ final class DibiTranslator extends NObject
/** /**
* Apply substitutions to indentifier and delimites it * Apply substitutions to indentifier and delimites it.
* *
* @param string indentifier * @param string indentifier
* @return string * @return string

View File

@@ -20,7 +20,7 @@
/** /**
* Default implemenation of IDibiVariable * Default implemenation of IDibiVariable.
* @package dibi * @package dibi
*/ */
class DibiVariable extends NObject implements IDibiVariable class DibiVariable extends NObject implements IDibiVariable

View File

@@ -20,13 +20,13 @@
/** /**
* Interface for user variable, used for generating SQL * Interface for user variable, used for generating SQL.
* @package dibi * @package dibi
*/ */
interface IDibiVariable interface IDibiVariable
{ {
/** /**
* Format for SQL * Format for SQL.
* *
* @param object DibiTranslator * @param object DibiTranslator
* @param string optional modifier * @param string optional modifier
@@ -40,7 +40,7 @@ interface IDibiVariable
/** /**
* Provides an interface between a dataset and data-aware components * Provides an interface between a dataset and data-aware components.
* @package dibi * @package dibi
*/ */
interface IDataSource extends Countable, IteratorAggregate interface IDataSource extends Countable, IteratorAggregate
@@ -54,7 +54,7 @@ interface IDataSource extends Countable, IteratorAggregate
/** /**
* dibi driver interface * dibi driver interface.
* *
* @author David Grudl * @author David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl * @copyright Copyright (c) 2005, 2008 David Grudl
@@ -65,7 +65,7 @@ interface IDibiDriver
{ {
/** /**
* Internal: Connects to a database * Internal: Connects to a database.
* *
* @param array * @param array
* @return void * @return void
@@ -76,7 +76,7 @@ interface IDibiDriver
/** /**
* Internal: Disconnects from a database * Internal: Disconnects from a database.
* *
* @return void * @return void
* @throws DibiException * @throws DibiException
@@ -86,7 +86,7 @@ interface IDibiDriver
/** /**
* Internal: Executes the SQL query * Internal: Executes the SQL query.
* *
* @param string SQL statement. * @param string SQL statement.
* @return bool have resultset? * @return bool have resultset?
@@ -97,7 +97,7 @@ interface 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 * @return int|FALSE number of rows or FALSE on error
*/ */
@@ -106,7 +106,7 @@ interface 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 * @return int|FALSE int on success or FALSE on failure
*/ */
@@ -142,7 +142,7 @@ interface IDibiDriver
/** /**
* Format to SQL command * Format to SQL command.
* *
* @param string value * @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
@@ -152,7 +152,7 @@ interface IDibiDriver
/** /**
* 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 string &$sql The SQL query that will be modified.
* @param int $limit * @param int $limit
@@ -164,7 +164,7 @@ interface IDibiDriver
/** /**
* Returns the number of rows in a result set * Returns the number of rows in a result set.
* *
* @return int * @return int
*/ */
@@ -173,7 +173,7 @@ interface IDibiDriver
/** /**
* Moves cursor position without fetching row * Moves cursor position without fetching row.
* *
* @param int the 0-based cursor pos to seek to * @param int the 0-based cursor pos to seek to
* @return boolean TRUE on success, FALSE if unable to seek to specified record * @return boolean TRUE on success, FALSE if unable to seek to specified record
@@ -184,7 +184,7 @@ interface 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 * internal usage only
* *
* @param bool TRUE for associative array, FALSE for numeric * @param bool TRUE for associative array, FALSE for numeric
@@ -195,7 +195,7 @@ interface IDibiDriver
/** /**
* Frees the resources allocated for this result set * Frees the resources allocated for this result set.
* *
* @param resource resultset resource * @param resource resultset resource
* @return void * @return void
@@ -205,7 +205,7 @@ interface IDibiDriver
/** /**
* Returns metadata for all columns in a result set * Returns metadata for all columns in a result set.
* *
* @return array * @return array
* @throws DibiException * @throws DibiException
@@ -215,7 +215,7 @@ interface IDibiDriver
/** /**
* Returns the connection resource * Returns the connection resource.
* *
* @return mixed * @return mixed
*/ */
@@ -224,7 +224,7 @@ interface IDibiDriver
/** /**
* Returns the resultset resource * Returns the resultset resource.
* *
* @return mixed * @return mixed
*/ */