diff --git a/dibi/dibi.php b/dibi/dibi.php index 90a7d7dc..2f33b23e 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -13,11 +13,10 @@ * * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) + * @license http://php7.org/dibi/license dibi license * @version 0.9 (Revision: $WCREV$, Date: $WCDATE$) - * @category Database - * @package Dibi * @link http://php7.org/dibi/ + * @package dibi */ @@ -46,6 +45,7 @@ require_once __FILE__ . '/../libs/DibiLogger.php'; /** * Interface for user variable, used for generating SQL + * @package dibi */ interface DibiVariableInterface { @@ -69,7 +69,10 @@ interface DibiVariableInterface * This class is static container class for creating DB objects and * store connections info. * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ class dibi extends NClass { @@ -532,4 +535,4 @@ class dibi extends NClass } -} // class dibi +} diff --git a/dibi/drivers/mssql.php b/dibi/drivers/mssql.php index 8c8755e9..6ed5a625 100644 --- a/dibi/drivers/mssql.php +++ b/dibi/drivers/mssql.php @@ -11,21 +11,29 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** * The dibi driver for MS SQL database * - * @version $Revision$ $Date$ + * Connection options: + * - 'host' - the MS SQL server host name. It can also include a port number (hostname:port) + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'persistent' - try to find a persistent link? + * - 'database' - the database name to select + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiMsSqlDriver extends DibiDriver +class DibiMsSqlDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -47,9 +55,9 @@ final class DibiMsSqlDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); - self::config($config, 'host'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); + self::alias($config, 'host'); parent::__construct($config); } @@ -229,9 +237,9 @@ final class DibiMsSqlDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -269,7 +277,15 @@ final class DibiMsSqlDriver extends DibiDriver -final class DibiMSSqlResult extends DibiResult +/** + * The dibi result-set class for MS SQL database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiMSSqlResult extends DibiResult { /** diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index 0367512a..79e54019 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -11,21 +11,34 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** * The dibi driver for MySQL database * - * @version $Revision$ $Date$ + * Connection options: + * - 'host' - the MySQL server host name + * - 'port' - the port number to attempt to connect to the MySQL server + * - 'socket' - the socket or named pipe + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'persistent' - try to find a persistent link? + * - 'database' - the database name to select + * - 'charset' - sets the encoding + * - 'unbuffered' - sends query without fetching and buffering the result rows automatically? + * - 'options' - driver specific constants (MYSQL_*) + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiMySqlDriver extends DibiDriver +class DibiMySqlDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -47,16 +60,22 @@ final class DibiMySqlDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); + self::alias($config, 'options'); // default values - if ($config['username'] === NULL) $config['username'] = ini_get('mysql.default_user'); - if ($config['password'] === NULL) $config['password'] = ini_get('mysql.default_password'); + if (!isset($config['username'])) $config['username'] = ini_get('mysql.default_user'); + if (!isset($config['password'])) $config['password'] = ini_get('mysql.default_password'); if (!isset($config['host'])) { - $config['host'] = ini_get('mysql.default_host'); - if (!isset($config['port'])) ini_get('mysql.default_port'); - if (!isset($config['host'])) $config['host'] = 'localhost'; + $host = ini_get('mysql.default_host'); + if ($host) { + $config['host'] = $host; + $config['port'] = ini_get('mysql.default_port'); + } else { + if (!isset($config['socket'])) $config['socket'] = ini_get('mysql.default_socket'); + $config['host'] = NULL; + } } parent::__construct($config); @@ -78,10 +97,10 @@ final class DibiMySqlDriver extends DibiDriver $config = $this->getConfig(); - if (isset($config['protocol']) && $config['protocol'] === 'unix') { // host can be socket - $host = ':' . $config['host']; + if (empty($config['socket'])) { + $host = $config['host'] . (empty($config['port']) ? '' : ':' . $config['port']); } else { - $host = $config['host'] . (isset($config['port']) ? ':'.$config['port'] : ''); + $host = ':' . $config['socket']; } // some errors aren't handled. Must use $php_errormsg @@ -92,9 +111,9 @@ final class DibiMySqlDriver extends DibiDriver $php_errormsg = ''; if (empty($config['persistent'])) { - $connection = @mysql_connect($host, $config['username'], $config['password'], TRUE); + $connection = @mysql_connect($host, $config['username'], $config['password'], TRUE, $config['options']); } else { - $connection = @mysql_pconnect($host, $config['username'], $config['password']); + $connection = @mysql_pconnect($host, $config['username'], $config['password'], $config['options']); } if (function_exists('ini_set')) { @@ -143,7 +162,12 @@ final class DibiMySqlDriver extends DibiDriver protected function doQuery($sql) { $connection = $this->getConnection(); - $res = @mysql_query($sql, $connection); + + if ($this->getConfig('unbuffered')) { + $res = @mysql_unbuffered_query($sql, $connection); + } else { + $res = @mysql_query($sql, $connection); + } if ($errno = mysql_errno($connection)) { throw new DibiDatabaseException(mysql_error($connection), $errno, $sql); @@ -265,9 +289,9 @@ final class DibiMySqlDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -302,7 +326,15 @@ final class DibiMySqlDriver extends DibiDriver -final class DibiMySqlResult extends DibiResult +/** + * The dibi result-set class for MySQL database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiMySqlResult extends DibiResult { /** diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index 275995f0..27ed7c86 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -11,21 +11,34 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** - * The dibi driver for MySQLi database + * The dibi driver for MySQL database via improved extension * - * @version $Revision$ $Date$ + * Connection options: + * - 'host' - the MySQL server host name + * - 'port' - the port number to attempt to connect to the MySQL server + * - 'socket' - the socket or named pipe + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'persistent' - try to find a persistent link? + * - 'database' - the database name to select + * - 'charset' - sets the encoding + * - 'unbuffered' - sends query without fetching and buffering the result rows automatically? + * - 'options' - driver specific constants (MYSQLI_*) + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiMySqliDriver extends DibiDriver +class DibiMySqliDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -47,13 +60,15 @@ final class DibiMySqliDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); - self::config($config, 'database'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); + self::alias($config, 'options'); + self::alias($config, 'database'); // default values - if ($config['username'] === NULL) $config['username'] = ini_get('mysqli.default_user'); - if ($config['password'] === NULL) $config['password'] = ini_get('mysqli.default_password'); + if (!isset($config['username'])) $config['username'] = ini_get('mysqli.default_user'); + if (!isset($config['password'])) $config['password'] = ini_get('mysqli.default_password'); + if (!isset($config['socket'])) $config['socket'] = ini_get('mysqli.default_socket'); if (!isset($config['host'])) { $config['host'] = ini_get('mysqli.default_host'); if (!isset($config['port'])) ini_get('mysqli.default_port'); @@ -79,10 +94,11 @@ final class DibiMySqliDriver extends DibiDriver $config = $this->getConfig(); - $connection = @mysqli_connect($config['host'], $config['username'], $config['password'], $config['database'], $config['port']); + $connection = mysqli_init(); + @mysqli_real_connect($connection, $config['host'], $config['username'], $config['password'], $config['database'], $config['port'], $config['socket'], $config['options']); - if (!$connection) { - throw new DibiDatabaseException(mysqli_connect_error(), mysqli_connect_errno()); + if ($errno = mysqli_connect_errno()) { + throw new DibiDatabaseException(mysqli_connect_error(), $errno); } if (isset($config['charset'])) { @@ -116,7 +132,7 @@ final class DibiMySqliDriver extends DibiDriver protected function doQuery($sql) { $connection = $this->getConnection(); - $res = @mysqli_query($connection, $sql); + $res = @mysqli_query($connection, $sql, $this->getConfig('unbuffered') ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT); if ($errno = mysqli_errno($connection)) { throw new DibiDatabaseException(mysqli_error($connection), $errno, $sql); @@ -249,9 +265,9 @@ final class DibiMySqliDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -286,7 +302,15 @@ final class DibiMySqliDriver extends DibiDriver -final class DibiMySqliResult extends DibiResult +/** + * The dibi result-set class for MySQL database via improved extension + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiMySqliResult extends DibiResult { /** diff --git a/dibi/drivers/odbc.php b/dibi/drivers/odbc.php index 6a72efb0..ffb62aa3 100644 --- a/dibi/drivers/odbc.php +++ b/dibi/drivers/odbc.php @@ -11,21 +11,28 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** * The dibi driver interacting with databases via ODBC connections * - * @version $Revision$ $Date$ + * Connection options: + * - 'dsn' - driver specific DSN + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'persistent' - try to find a persistent link? + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiOdbcDriver extends DibiDriver +class DibiOdbcDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -54,14 +61,13 @@ final class DibiOdbcDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); - self::config($config, 'database'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); // default values - if ($config['username'] === NULL) $config['username'] = ini_get('odbc.default_user'); - if ($config['password'] === NULL) $config['password'] = ini_get('odbc.default_pw'); - if ($config['database'] === NULL) $config['database'] = ini_get('odbc.default_db'); + if (!isset($config['username'])) $config['username'] = ini_get('odbc.default_user'); + if (!isset($config['password'])) $config['password'] = ini_get('odbc.default_pw'); + if (!isset($config['dsn'])) $config['dsn'] = ini_get('odbc.default_db'); parent::__construct($config); } @@ -83,9 +89,9 @@ final class DibiOdbcDriver extends DibiDriver $config = $this->getConfig(); if (empty($config['persistent'])) { - $connection = @odbc_connect($config['database'], $config['username'], $config['password']); + $connection = @odbc_connect($config['dsn'], $config['username'], $config['password']); } else { - $connection = @odbc_pconnect($config['database'], $config['username'], $config['password']); + $connection = @odbc_pconnect($config['dsn'], $config['username'], $config['password']); } if (!is_resource($connection)) { @@ -255,9 +261,9 @@ final class DibiOdbcDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -291,7 +297,15 @@ final class DibiOdbcDriver extends DibiDriver -final class DibiOdbcResult extends DibiResult +/** + * The dibi result-set class for ODBC database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiOdbcResult extends DibiResult { private $row = 0; diff --git a/dibi/drivers/oracle.php b/dibi/drivers/oracle.php index 280d10e9..e820967d 100644 --- a/dibi/drivers/oracle.php +++ b/dibi/drivers/oracle.php @@ -11,21 +11,28 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** * The dibi driver for Oracle database * - * @version $Revision$ $Date$ + * Connection options: + * - 'database' (or 'db') - the name of the local Oracle instance or the name of the entry in tnsnames.ora + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'charset' - sets the encoding + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiOracleDriver extends DibiDriver +class DibiOracleDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -50,10 +57,10 @@ final class DibiOracleDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); - self::config($config, 'database', 'db'); - self::config($config, 'charset'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); + self::alias($config, 'database', 'db'); + self::alias($config, 'charset'); parent::__construct($config); } @@ -238,9 +245,9 @@ final class DibiOracleDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -271,7 +278,15 @@ final class DibiOracleDriver extends DibiDriver -final class DibiOracleResult extends DibiResult +/** + * The dibi result-set class for Oracle database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiOracleResult extends DibiResult { /** diff --git a/dibi/drivers/pdo.php b/dibi/drivers/pdo.php index b65c8276..71bb0f65 100644 --- a/dibi/drivers/pdo.php +++ b/dibi/drivers/pdo.php @@ -11,21 +11,28 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** * The dibi driver for PDO * - * @version $Revision$ $Date$ + * Connection options: + * - 'dsn' - driver specific DSN + * - 'username' (or 'user') + * - 'password' (or 'pass') + * - 'options' - driver specific options array + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiPdoDriver extends DibiDriver +class DibiPdoDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -47,9 +54,10 @@ final class DibiPdoDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'username', 'user'); - self::config($config, 'password', 'pass'); - self::config($config, 'dsn'); + self::alias($config, 'username', 'user'); + self::alias($config, 'password', 'pass'); + self::alias($config, 'dsn'); + self::alias($config, 'options'); parent::__construct($config); } @@ -68,7 +76,7 @@ final class DibiPdoDriver extends DibiDriver } $config = $this->getConfig(); - $connection = new PDO($config['dsn'], $config['username'], $config['password']); + $connection = new PDO($config['dsn'], $config['username'], $config['password'], $config['options']); $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $connection; } @@ -212,9 +220,9 @@ final class DibiPdoDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -244,7 +252,15 @@ final class DibiPdoDriver extends DibiDriver -final class DibiPdoResult extends DibiResult +/** + * The dibi result-set class for PDOStatement + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiPdoResult extends DibiResult { private $row = 0; diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index d38104de..846f2f83 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -11,21 +11,27 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** - * The dibi driver for PostgreSql database + * The dibi driver for PostgreSQL database * - * @version $Revision$ $Date$ + * Connection options: + * - 'database' (or 'string') - connection string + * - 'persistent' - try to find a persistent link? + * - 'charset' - sets the encoding + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiPostgreDriver extends DibiDriver +class DibiPostgreDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -54,8 +60,8 @@ final class DibiPostgreDriver extends DibiDriver */ public function __construct(array $config) { - self::config($config, 'database', 'string'); - self::config($config, 'type'); + self::alias($config, 'database', 'string'); + self::alias($config, 'type'); parent::__construct($config); } @@ -83,9 +89,9 @@ final class DibiPostgreDriver extends DibiDriver $php_errormsg = ''; if (isset($config['persistent'])) { - $connection = @pg_connect($config['database'], $config['type']); + $connection = @pg_connect($config['database'], PGSQL_CONNECT_FORCE_NEW); } else { - $connection = @pg_pconnect($config['database'], $config['type']); + $connection = @pg_pconnect($config['database'], PGSQL_CONNECT_FORCE_NEW); } if (function_exists('ini_set')) { @@ -267,9 +273,9 @@ final class DibiPostgreDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -304,7 +310,15 @@ final class DibiPostgreDriver extends DibiDriver -final class DibiPostgreResult extends DibiResult +/** + * The dibi result-set class for PostgreSQL database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiPostgreResult extends DibiResult { /** diff --git a/dibi/drivers/sqlite.php b/dibi/drivers/sqlite.php index 1a41037f..4c6061c1 100644 --- a/dibi/drivers/sqlite.php +++ b/dibi/drivers/sqlite.php @@ -11,21 +11,27 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ /** - * The dibi driver for SQlite database + * The dibi driver for SQLite database * - * @version $Revision$ $Date$ + * Connection options: + * - 'database' (or 'file') - the filename of the SQLite database + * - 'persistent' - try to find a persistent link? + * - 'unbuffered' - sends query without fetching and buffering the result rows automatically? + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ -final class DibiSqliteDriver extends DibiDriver +class DibiSqliteDriver extends DibiDriver { /** * Describes how convert some datatypes to SQL command @@ -47,8 +53,7 @@ final class DibiSqliteDriver extends DibiDriver */ public function __construct($config) { - self::config($config, 'database', 'file'); - if (!isset($config['mode'])) $config['mode'] = 0666; + self::alias($config, 'database', 'file'); parent::__construct($config); } @@ -70,9 +75,9 @@ final class DibiSqliteDriver extends DibiDriver $errorMsg = ''; if (empty($config['persistent'])) { - $connection = @sqlite_open($config['database'], $config['mode'], $errorMsg); + $connection = @sqlite_open($config['database'], 0666, $errorMsg); } else { - $connection = @sqlite_popen($config['database'], $config['mode'], $errorMsg); + $connection = @sqlite_popen($config['database'], 0666, $errorMsg); } if (!$connection) { @@ -107,7 +112,13 @@ final class DibiSqliteDriver extends DibiDriver { $connection = $this->getConnection(); $errorMsg = NULL; - $res = @sqlite_query($connection, $sql, SQLITE_ASSOC, $errorMsg); + + if ($this->getConfig('unbuffered')) { + $res = @sqlite_unbuffered_query($connection, $sql, SQLITE_ASSOC, $errorMsg); + } else { + $res = @sqlite_query($connection, $sql, SQLITE_ASSOC, $errorMsg); + } + if ($errorMsg !== NULL) { throw new DibiDatabaseException($errorMsg, sqlite_last_error($connection), $sql); @@ -228,9 +239,9 @@ final class DibiSqliteDriver extends DibiDriver /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - public function getMetaData() + public function getDibiReflection() { throw new BadMethodCallException(__METHOD__ . ' is not implemented'); } @@ -261,7 +272,15 @@ final class DibiSqliteDriver extends DibiDriver -final class DibiSqliteResult extends DibiResult +/** + * The dibi result-set class for SQLite database + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ + */ +class DibiSqliteResult extends DibiResult { /** diff --git a/dibi/libs/DibiDriver.php b/dibi/libs/DibiDriver.php index af452aeb..d4527758 100644 --- a/dibi/libs/DibiDriver.php +++ b/dibi/libs/DibiDriver.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -24,7 +22,10 @@ /** * dibi Common Driver * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ abstract class DibiDriver extends NObject { @@ -213,7 +214,7 @@ abstract class DibiDriver extends NObject * @param string alias key * @return void */ - protected static function config(&$config, $key, $alias=NULL) + protected static function alias(&$config, $key, $alias=NULL) { if (isset($config[$key])) return; @@ -333,9 +334,9 @@ abstract class DibiDriver extends NObject /** * Gets a information of the current database. * - * @return DibiMetaData + * @return DibiReflection */ - abstract public function getMetaData(); + abstract public function getDibiReflection(); diff --git a/dibi/libs/DibiException.php b/dibi/libs/DibiException.php index efd830f0..e63c47ab 100644 --- a/dibi/libs/DibiException.php +++ b/dibi/libs/DibiException.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -24,7 +22,10 @@ /** * dibi common exception * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ class DibiException extends Exception { @@ -33,6 +34,11 @@ class DibiException extends Exception /** * database server exception + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ class DibiDatabaseException extends DibiException { diff --git a/dibi/libs/DibiLogger.php b/dibi/libs/DibiLogger.php index d77914e9..0b689cc6 100644 --- a/dibi/libs/DibiLogger.php +++ b/dibi/libs/DibiLogger.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -24,7 +22,10 @@ /** * dibi basic logger & profiler (experimental) * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ final class DibiLogger extends NObject { diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index b3e96c59..3737984d 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -37,7 +35,10 @@ * unset($result); * * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ abstract class DibiResult extends NObject implements IteratorAggregate, Countable { diff --git a/dibi/libs/DibiResultIterator.php b/dibi/libs/DibiResultIterator.php index 598bd5d9..a9657b56 100644 --- a/dibi/libs/DibiResultIterator.php +++ b/dibi/libs/DibiResultIterator.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -39,6 +37,11 @@ * print_r($row); * } * + * + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ final class DibiResultIterator implements Iterator { diff --git a/dibi/libs/DibiTranslator.php b/dibi/libs/DibiTranslator.php index 5415ac72..44578292 100644 --- a/dibi/libs/DibiTranslator.php +++ b/dibi/libs/DibiTranslator.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi + * @license http://php7.org/dibi/license dibi license * @link http://php7.org/dibi/ + * @package dibi */ @@ -24,7 +22,10 @@ /** * dibi SQL translator * - * @version $Revision$ $Date$ + * @author David Grudl + * @copyright Copyright (c) 2005, 2007 David Grudl + * @package dibi + * @version $Revision$ $Date$ */ final class DibiTranslator extends NObject { diff --git a/dibi/libs/NObject.php b/dibi/libs/NObject.php index 0122a82f..77a9a313 100644 --- a/dibi/libs/NObject.php +++ b/dibi/libs/NObject.php @@ -11,12 +11,10 @@ * * For more information please see http://php7.org/dibi/ * - * @author David Grudl - * @copyright Copyright (c) 2005, 2007 David Grudl - * @license http://php7.org/dibi/license (dibi license) - * @category Database - * @package Dibi - * @link http://php7.org/dibi/ + * @copyright Copyright (c) 2004, 2007 David Grudl + * @license http://php7.org/nette/license Nette license + * @link http://php7.org/nette/ + * @package Nette */ @@ -55,8 +53,9 @@ if (!class_exists('NObject', FALSE)) { * * @author David Grudl * @copyright Copyright (c) 2004, 2007 David Grudl - * @license http://php7.org/nette/license (Nette license) + * @license http://php7.org/nette/license Nette license * @link http://php7.org/nette/ + * @package Nette */ abstract class NObject { @@ -226,6 +225,12 @@ abstract class NObject /** * NClass is the ultimate ancestor of all uninstantiable classes. + * + * @author David Grudl + * @copyright Copyright (c) 2004, 2007 David Grudl + * @license http://php7.org/nette/license Nette license + * @link http://php7.org/nette/ + * @package Nette */ abstract class NClass { diff --git a/examples/connect.php b/examples/connect.php index 00d273be..afa4a17c 100644 --- a/examples/connect.php +++ b/examples/connect.php @@ -63,7 +63,7 @@ try { 'driver' => 'odbc', 'username' => 'root', 'password' => '***', - 'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq='.dirname(__FILE__).'/sample.mdb', + 'dsn' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq='.dirname(__FILE__).'/sample.mdb', )); echo 'OK';