| version 1.3, 2011/06/17 13:56:38 |
version 1.4, 2014/10/15 13:00:16 |
|
|
| * |
* |
| * @see DB_common::setOption() |
* @see DB_common::setOption() |
| */ |
*/ |
| function &factory($type, $options = false) |
static function &factory($type, $options = false) |
| { |
{ |
| if (!is_array($options)) { |
if (!is_array($options)) { |
| $options = array('persistent' => $options); |
$options = array('persistent' => $options); |
|
|
| * |
* |
| * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError() |
* @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError() |
| */ |
*/ |
| function &connect($dsn, $options = array()) |
static function &connect($dsn, $options = array()) |
| { |
{ |
| $dsninfo = DB::parseDSN($dsn); |
$dsninfo = DB::parseDSN($dsn); |
| $type = $dsninfo['phptype']; |
$type = $dsninfo['phptype']; |
|
|
| * |
* |
| * @return string the DB API version number |
* @return string the DB API version number |
| */ |
*/ |
| function apiVersion() |
static function apiVersion() |
| { |
{ |
| return '1.7.14RC2'; |
return '1.7.14RC2'; |
| } |
} |
|
|
| * |
* |
| * @return bool whether $value is DB_Error object |
* @return bool whether $value is DB_Error object |
| */ |
*/ |
| function isError($value) |
static function isError($value) |
| { |
{ |
| return is_a($value, 'DB_Error'); |
return is_a($value, 'DB_Error'); |
| } |
} |
|
|
| * |
* |
| * @return bool whether $value is a DB_<driver> object |
* @return bool whether $value is a DB_<driver> object |
| */ |
*/ |
| function isConnection($value) |
static function isConnection($value) |
| { |
{ |
| return (is_object($value) && |
return (is_object($value) && |
| is_subclass_of($value, 'db_common') && |
is_subclass_of($value, 'db_common') && |
|
|
| * |
* |
| * @return boolean whether $query is a data manipulation query |
* @return boolean whether $query is a data manipulation query |
| */ |
*/ |
| function isManip($query) |
static function isManip($query) |
| { |
{ |
| $manips = 'INSERT|UPDATE|DELETE|REPLACE|' |
$manips = 'INSERT|UPDATE|DELETE|REPLACE|' |
| . 'CREATE|DROP|' |
. 'CREATE|DROP|' |
|
|
| * @return string the error message or false if the error code was |
* @return string the error message or false if the error code was |
| * not recognized |
* not recognized |
| */ |
*/ |
| function errorMessage($value) |
static function errorMessage($value) |
| { |
{ |
| static $errorMessages; |
static $errorMessages; |
| if (!isset($errorMessages)) { |
if (!isset($errorMessages)) { |
|
|
| * + username: User name for login |
* + username: User name for login |
| * + password: Password for login |
* + password: Password for login |
| */ |
*/ |
| function parseDSN($dsn) |
static function parseDSN($dsn) |
| { |
{ |
| $parsed = array( |
$parsed = array( |
| 'phptype' => false, |
'phptype' => false, |
|
|
| * @param boolean true to hide the password, false to include it |
* @param boolean true to hide the password, false to include it |
| * @return string |
* @return string |
| */ |
*/ |
| function getDSNString($dsn, $hidePassword) { |
static function getDSNString($dsn, $hidePassword) { |
| /* Calling parseDSN will ensure that we have all the array elements |
/* Calling parseDSN will ensure that we have all the array elements |
| * defined, and means that we deal with strings and array in the same |
* defined, and means that we deal with strings and array in the same |
| * manner. */ |
* manner. */ |