cvs: pear /MDB MDB.php

From: Date: Wed, 17 Jul 2002 11:28:07 +0000
Subject: cvs: pear /MDB MDB.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5151@lists.php.net to get a copy of this message
lsmith Wed Jul 17 07:28:07 2002 EDT Modified files: /pear/MDB MDB.php Log: added the following constants: DB_ERROR_NOSUCHDB DB_ERROR_ACCESS_VIOLATION renamed all driver classes to MDB_driver_* removed the fowlling unsupported rdbms from MDB::connection() Warning constants MDB::isWarning added new connection options: includelob includemanager Index: pear/MDB/MDB.php diff -u pear/MDB/MDB.php:1.19 pear/MDB/MDB.php:1.20 --- pear/MDB/MDB.php:1.19 Wed Jul 10 06:53:53 2002 +++ pear/MDB/MDB.php Wed Jul 17 07:28:07 2002 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: MDB.php,v 1.19 2002/07/10 10:53:53 lsmith Exp $ +// $Id: MDB.php,v 1.20 2002/07/17 11:28:07 lsmith Exp $ // // Database independent query interface. // @@ -83,20 +83,13 @@ define("DB_ERROR_INVALID_DSN", -23); define("DB_ERROR_CONNECT_FAILED", -24); define("DB_ERROR_EXTENSION_NOT_FOUND",-25); -define("DB_ERROR_CANNOT_REPLACE", -26); -define("DB_ERROR_CANNOT_ALTER", -27); -define("DB_ERROR_MANAGER", -28); -define("DB_ERROR_MANAGER_PARSE", -29); -define("DB_ERROR_LOADEXTENSION", -30); - -/** - * Warnings are not detected as errors by MDB::isError(), and are not - * fatal. You can detect whether an error is in fact a warning with - * MDB::isWarning(). - */ - -define('DB_WARNING', -1000); -define('DB_WARNING_READ_ONLY', -1001); +define("DB_ERROR_NOSUCHDB", -26); +define("DB_ERROR_ACCESS_VIOLATION", -27); +define("DB_ERROR_CANNOT_REPLACE", -28); +define("DB_ERROR_CANNOT_ALTER", -29); +define("DB_ERROR_MANAGER", -30); +define("DB_ERROR_MANAGER_PARSE", -31); +define("DB_ERROR_LOADEXTENSION", -32); /** * These constants are used when storing information about prepared @@ -211,15 +204,14 @@ * | the actual DB implementations as well as a bunch of * | query utility functions. * | - * +-MDB_mysql The DB implementation for MySQL. Inherits MDB_Common. + * +-MDB_driver_mysql The DB implementation for MySQL. Inherits MDB_Common. * When calling MDB::factory or MDB::connect for MySQL * connections, the object returned is an instance of this * class. * * @package MDB - * @version 0.9.2 + * @version 0.9.9 * @author Lukas Smith <smith@dybnet.de> - * @since PHP 4.0 */ class MDB { @@ -282,46 +274,16 @@ } switch(isset($dsninfo["phptype"]) ? $dsninfo["phptype"] : "") { - case "ibase"; - $include = "ibase.php"; - $class_name = "MDB_ibase"; - $included = "IBASE_INCLUDED"; - break; - case "ifx"; - $include = "ifx.php"; - $class_name = "MDB_ifx"; - $included = "IFX_INCLUDED"; - break; - case "msql"; - $include = "msql.php"; - $class_name = "MDB_msql"; - $included = "MSQL_INCLUDED"; - break; - case "mssql"; - $include = "mssql.php"; - $class_name = "MDB_mssql"; - $included = "MSSQL_INCLUDED"; - break; case "mysql"; $include = "mysql.php"; - $class_name = "MDB_mysql"; + $class_name = "MDB_driver_mysql"; $included = "MYSQL_INCLUDED"; break; case "pgsql"; $include = "pgsql.php"; - $class_name = "MDB_pgsql"; + $class_name = "MDB_driver_pgsql"; $included = "PGSQL_INCLUDED"; break; - case "odbc"; - $include = "odbc.php"; - $class_name = "MDB_odbc"; - $included = "ODBC_INCLUDED"; - break; - case "oci"; - $include = "oci.php"; - $class_name = "MDB_oci"; - $included = "OCI_INCLUDED"; - break; default: $included = (isset($options["includedconstant"]) ? $options["includedconstant"] : ""); @@ -356,7 +318,7 @@ if($length) { $directory_separator = (defined("DIRECTORY_SEPARATOR") ? DIRECTORY_SEPARATOR : "/"); - if ($include_path[$length-1]!=$directory_separator) + if ($include_path[$length-1] != $directory_separator) $separator = $directory_separator; } @@ -403,6 +365,12 @@ if (is_array($options)) { $db->options = array_merge($db->options, $options); } + if ($db->options['includelob']) { + $db->loadLob('load at start'); + } + if ($db->options['includemanager']) { + $db->loadManager('load at start'); + } if(isset($dsninfo["database"])) { $db->setDatabase($dsninfo["database"]); $err = $db->connect(); @@ -463,24 +431,6 @@ } /** - * Tell whether a result code from a MDB method is a warning. - * Warnings differ from errors in that they are generated by DB, - * and are not fatal. - * - * @access public - * - * @param mixed $value result value - * - * @return boolean whether $value is an MDB_Warning - */ - function isWarning($value) - { - return (is_object($value) && - (get_class($value) == "mdb_warning" || - is_subclass_of($value, "mdb_warning"))); - } - - /** * Return a textual error message for a MDB error code * * @param int $value error code @@ -518,12 +468,12 @@ DB_ERROR_INVALID_DSN => 'invalid DSN', DB_ERROR_CONNECT_FAILED => 'connect failed', DB_OK => 'no error', - DB_WARNING => 'unknown warning', - DB_WARNING_READ_ONLY => 'read only', DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found', + DB_ERROR_NOSUCHDB => 'no such database', + DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions', DB_ERROR_MANAGER => 'MDB_manager error', - DB_ERROR_MANAGER_PARSE => 'MDB_manager schema parseerror', + DB_ERROR_MANAGER_PARSE => 'MDB_manager schema parse error', DB_ERROR_LOADEXTENSION => 'Error while including on demand extension' ); }

« previous php.pear.cvs (#5151) next »