cvs: pear /MDB MDB.php mysql.php pgsql.php
| From: | Lukas Smith | Date: | Fri, 19 Jul 2002 14:46:23 +0000 |
| Subject: | cvs: pear /MDB MDB.php mysql.php pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5195@lists.php.net to get a copy of this message | ||
lsmith Fri Jul 19 10:46:23 2002 EDT
Modified files:
/pear/MDB pgsql.php mysql.php MDB.php
Log:
$dsninfo and $options are now passed to the constructor in MDB_common
this ensures that the driver contstructor can use that data
this fixes issues in the pgsql driver constructor and not being able to run _doConnect()
Index: pear/MDB/pgsql.php
diff -u pear/MDB/pgsql.php:1.14 pear/MDB/pgsql.php:1.15
--- pear/MDB/pgsql.php:1.14 Fri Jul 19 08:10:56 2002
+++ pear/MDB/pgsql.php Fri Jul 19 10:46:23 2002
@@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
-// $Id: pgsql.php,v 1.14 2002/07/19 12:10:56 pgc Exp $
+// $Id: pgsql.php,v 1.15 2002/07/19 14:46:23 lsmith Exp $
// MDB postgresql driver.
@@ -71,9 +71,11 @@
/**
* Constructor
**/
- function MDB_driver_pgsql()
+ function MDB_driver_pgsql($dsninfo, $options)
{
- $this->MDB_common();
+ if(MDB::isError($common_contructor = $this->MDB_common($dsninfo, $options))) {
+ return $common_contructor;
+ }
$this->phptype = 'pgsql';
$this->dbsyntax = 'pgsql';
@@ -90,11 +92,9 @@
$this->supported["LOBs"] = 1;
$this->supported["Replace"] = 1;
$this->supported["SubSelects"] = 1;
-
+
$this->decimal_factor = pow(10.0, $this->options['decimal_places']);
- $this->errorcode_map = array();
-
if (function_exists("pg_cmdTuples")) {
$connection = $this->_doConnect("template1", 0);
if (!MDB::isError($connection)) {
@@ -106,7 +106,7 @@
}
error_reporting($error_reporting);
} else {
- $err = $this->raiseError(DB_ERROR, NULL, NULL, "Setup: " .
pg_ErrorMessage($connection));
+ $err = $this->raiseError(DB_ERROR, NULL, NULL, "Setup:
".pg_ErrorMessage($connection));
}
pg_Close($connection);
} else {
Index: pear/MDB/mysql.php
diff -u pear/MDB/mysql.php:1.25 pear/MDB/mysql.php:1.26
--- pear/MDB/mysql.php:1.25 Wed Jul 17 10:39:06 2002
+++ pear/MDB/mysql.php Fri Jul 19 10:46:23 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.25 2002/07/17 14:39:06 lsmith Exp $
+// $Id: mysql.php,v 1.26 2002/07/19 14:46:23 lsmith Exp $
//
// MDB mysql driver.
//
@@ -75,9 +75,11 @@
/**
* Constructor
*/
- function MDB_driver_mysql()
+ function MDB_driver_mysql($dsninfo, $options)
{
- $this->MDB_common();
+ if(MDB::isError($common_contructor = $this->MDB_common($dsninfo, $options))) {
+ return $common_contructor;
+ }
$this->phptype = 'mysql';
$this->dbsyntax = 'mysql';
@@ -91,7 +93,7 @@
$this->supported["LOBs"] = 1;
$this->supported["Replace"] = 1;
$this->supported["SubSelects"] = 0;
- if (!MDB::isError($this->getOption("UseTransactions"))) {
+ if ($this->options["UseTransactions"]) {
$this->supported["Transactions"] = 1;
}
$this->decimal_factor = pow(10.0, $this->options['decimal_places']);
@@ -711,7 +713,7 @@
*
* @access public
*/
- function fetchBLobResult($result, $row, $field)
+ function fetchBlobResult($result, $row, $field)
{
return ($this->fetchLobResult($result, $row, $field));
}
@@ -910,7 +912,7 @@
* @return string DBMS specific SQL code portion that should be used to
* declare the specified field.
*/
- function getBLobDeclaration($name, &$field)
+ function getBlobDeclaration($name, &$field)
{
if (isset($field['length'])) {
$length = $field['length'];
@@ -1208,7 +1210,7 @@
*
* @access private
*/
- function freeBLobValue($prepared_query, $blob)
+ function freeBlobValue($prepared_query, $blob)
{
unset($value);
return (DB_OK);
Index: pear/MDB/MDB.php
diff -u pear/MDB/MDB.php:1.21 pear/MDB/MDB.php:1.22
--- pear/MDB/MDB.php:1.21 Thu Jul 18 15:59:28 2002
+++ pear/MDB/MDB.php Fri Jul 19 10:46:23 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB.php,v 1.21 2002/07/18 19:59:28 lsmith Exp $
+// $Id: MDB.php,v 1.22 2002/07/19 14:46:23 lsmith Exp $
//
// Database independent query interface.
//
@@ -345,40 +345,13 @@
return PEAR::raiseError(NULL, DB_ERROR_NOT_FOUND,
NULL, NULL, NULL, 'MDB_Error', TRUE);
}
- $db = new $class_name;
+ $db = new $class_name($dsninfo, $options);
global $databases;
$database = count($databases)+1;
$databases[$database] = &$db;
$db->database = $database;
- $db->include_path = $include_path;
- if (isset($dsninfo["hostspec"])) {
- $db->host = $dsninfo["hostspec"];
- }
- if (isset($dsninfo["username"])) {
- $db->user = $dsninfo["username"];
- }
- if (isset($dsninfo["password"])) {
- $db->password = $dsninfo["password"];
- }
- 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();
- if (MDB::isError($err)) {
- $err->addUserInfo($dsn);
- return $err;
- }
- }
return $db;
}