cvs: pear /MDB2 MDB2.php
| From: | Lukas Smith | Date: | Fri, 21 May 2004 11:43:16 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-19726@lists.php.net to get a copy of this message | ||
lsmith Fri May 21 07:43:16 2004 EDT
Modified files:
/pear/MDB2 MDB2.php
Log:
- for PHP versions lower than 4 the transaction shutdown function is registered on load of
MDB2.php (used to be a BC hack in the constructor of MDB_Driver_Common)
- allow errorInfo() to be called when no connection has been established yet
- cleaned up constructor handling
http://cvs.php.net/diff.php/pear/MDB2/MDB2.php?r1=1.33&r2=1.34&ty=u
Index: pear/MDB2/MDB2.php
diff -u pear/MDB2/MDB2.php:1.33 pear/MDB2/MDB2.php:1.34
--- pear/MDB2/MDB2.php:1.33 Wed May 12 11:52:47 2004
+++ pear/MDB2/MDB2.php Fri May 21 07:43:16 2004
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2.php,v 1.33 2004/05/12 15:52:47 quipo Exp $
+// $Id: MDB2.php,v 1.34 2004/05/21 11:43:16 lsmith Exp $
//
/**
@@ -57,6 +57,10 @@
*/
require_once 'PEAR.php';
+if (substr(PHP_VERSION, 0, 1) < 5) {
+ register_shutdown_function('_MDB2_shutdownTransactions');
+}
+
/**
* The method mapErrorCode in each MDB2_dbtype implementation maps
* native error codes to one of these.
@@ -1005,17 +1009,6 @@
$this->PEAR();
}
- function MDB2_Driver_Common()
- {
- static $register_shutdown;
- if (isset($register_shutdown)) {
- $register_shutdown = true;
- register_shutdown_function('_MDB2_shutdownTransactions');
- }
- $this->phpversion = 4;
- $this->__construct();
- }
-
// }}}
// {{{ __toString()
@@ -1086,7 +1079,7 @@
return PEAR::raiseError($code, null, null, null, null, null, true);
}
- if (is_null($userinfo) && isset($this->connection) &&
$this->connection) {
+ if (is_null($userinfo) && isset($this->connection)) {
if (!empty($this->last_query)) {
$userinfo = "[Last query: {$this->last_query}]\n";
}
@@ -2567,13 +2560,12 @@
var $offset_count = 0;
var $limit;
- // }}}
// {{{ constructor
/**
* Constructor
*/
- function MDB2_Result_Common(&$mdb, &$result, $offset, $limit)
+ function __construct(&$mdb, &$result, $offset = 0, $limit = 0)
{
$this->mdb =& $mdb;
$this->result =& $result;
@@ -2581,6 +2573,11 @@
$this->limit = max(0, $limit - 1);
}
+ function MDB2_Result_Common(&$mdb, &$result, $offset = 0, $limit = 0)
+ {
+ $this->__construct($mdb, $result, $offset, $limit);
+ }
+
// }}}
// {{{ setResultTypes()
@@ -2953,12 +2950,17 @@
*
* @param resource row data as array
*/
- function MDB2_Row(&$row)
+ function __construct(&$row)
{
foreach ($row as $key => $value) {
$this->$key = &$row[$key];
}
}
+
+ function MDB2_Row(&$row)
+ {
+ $this->__construct($row);
+ }
}
// }}}