cvs: /php4/pear DB.php Makefile.in /php4/pear/DB mssql.php mysql.php odbc.php pgsql.php storage.php
| From: | Stig Bakken | Date: | Thu, 09 Mar 2000 21:57:44 +0000 |
| Subject: | cvs: /php4/pear DB.php Makefile.in /php4/pear/DB mssql.php mysql.php odbc.php pgsql.php storage.php | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11826@lists.php.net to get a copy of this message | ||
ssb Thu Mar 9 13:57:44 2000 EDT
Modified files:
/php4/pear DB.php Makefile.in
/php4/pear/DB mssql.php mysql.php odbc.php pgsql.php storage.php
Log:
PEAR now uses "use" instead of "include".
Index: php4/pear/DB.php
diff -u php4/pear/DB.php:1.17 php4/pear/DB.php:1.18
--- php4/pear/DB.php:1.17 Sun Feb 27 06:46:27 2000
+++ php4/pear/DB.php Thu Mar 9 13:57:14 2000
@@ -17,14 +17,11 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: DB.php,v 1.17 2000/02/27 14:46:27 ssb Exp $
+// $Id: DB.php,v 1.18 2000/03/09 21:57:14 ssb Exp $
//
// Database independent query interface.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB'])) return;
-$GLOBALS['USED_PACKAGES']['DB'] = true;
-
// {{{ Database independent error codes.
/*
@@ -164,15 +161,8 @@
* error
*/
function &factory($type) {
- global $USED_PACKAGES;
- // "include" should be replaced with "import" once PHP gets it
- $pkgname = 'DB/' . $type;
- if (!is_array($USED_PACKAGES) || !$USED_PACKAGES[$pkgname]) {
- if (!@include("${pkgname}.php")) {
- return DB_ERROR_NOT_FOUND;
- } else {
- $USED_PACKAGES[$pkgname] = true;
- }
+ if (!@import("DB/${type}.php")) {
+ return DB_ERROR_NOT_FOUND;
}
$classname = 'DB_' . $type;
$obj = new $classname;
@@ -200,23 +190,8 @@
$dsninfo = DB::parseDSN($dsn);
$type = $dsninfo['phptype'];
- // "include" should be replaced with "import" once PHP gets it
- $pkgname = 'DB/' . $type;
- if (!is_array($USED_PACKAGES) || !$USED_PACKAGES[$pkgname]) {
- $file = "${pkgname}.php";
- include($file);
-/*
-
- This suddenly stopped working. I thought include() was supposed to
- return a boolean? [ssb 20000218]
-
- if (!include($file)) {
- print "'$file' not found<br>\n";
- return DB_ERROR_NOT_FOUND;
- } else {
- $USED_PACKAGES[$pkgname] = true;
- }
-*/
+ if (!@import("DB/${type}.php")) {
+ return DB_ERROR_NOT_FOUND;
}
$classname = 'DB_' . $type;
$obj = new $classname;
@@ -281,7 +256,7 @@
* not recognized
*/
function errorMessage($code) {
- if (!is_array($errorMessages)) {
+ if (!isset($errorMessages)) {
$errorMessages = array(
DB_OK => "no error",
DB_ERROR => "unknown error",
Index: php4/pear/Makefile.in
diff -u php4/pear/Makefile.in:1.6 php4/pear/Makefile.in:1.7
--- php4/pear/Makefile.in:1.6 Tue Feb 22 06:26:12 2000
+++ php4/pear/Makefile.in Thu Mar 9 13:57:14 2000
@@ -18,7 +18,8 @@
$(INSTALL_DATA) $(srcdir)/DB/odbc.php $(pear_DBdir) && \
$(INSTALL_DATA) $(srcdir)/DB/mysql.php $(pear_DBdir) && \
$(INSTALL_DATA) $(srcdir)/DB/pgsql.php $(pear_DBdir) && \
- $(INSTALL_DATA) $(srcdir)/DB/storage.php $(pear_DBdir)
+ $(INSTALL_DATA) $(srcdir)/DB/storage.php $(pear_DBdir) && \
+ $(INSTALL_DATA) $(srcdir)/HTTP.php $(peardir)
phpincludedir = $(includedir)/php
builddir = $(prefix)/lib/php/build
Index: php4/pear/DB/mssql.php
diff -u php4/pear/DB/mssql.php:1.3 php4/pear/DB/mssql.php:1.4
--- php4/pear/DB/mssql.php:1.3 Tue Mar 7 12:18:13 2000
+++ php4/pear/DB/mssql.php Thu Mar 9 13:57:14 2000
@@ -17,17 +17,13 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: mssql.php,v 1.3 2000/03/07 20:18:13 sterling Exp $
+// $Id: mssql.php,v 1.4 2000/03/09 21:57:14 ssb Exp $
//
// Database independent query interface definition for PHP's Microsoft SQL Server
// extension.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB/mssql'])) return;
-$GLOBALS['USED_PACKAGES']['DB/mssql'] = true;
-if (empty($GLOBALS['USED_PACKAGES']['DB/common'])) {
- include("DB/common.php");
-}
+use "DB/common";
class DB_mssql extends DB_common {
@@ -199,4 +195,5 @@
return DB_ERROR_NOT_CAPABLE;
}
}
+
?>
Index: php4/pear/DB/mysql.php
diff -u php4/pear/DB/mysql.php:1.13 php4/pear/DB/mysql.php:1.14
--- php4/pear/DB/mysql.php:1.13 Sun Feb 27 06:46:27 2000
+++ php4/pear/DB/mysql.php Thu Mar 9 13:57:14 2000
@@ -28,11 +28,7 @@
// be registered here.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB/mysql'])) return;
-$GLOBALS['USED_PACKAGES']['DB/mysql'] = true;
-if (empty($GLOBALS['USED_PACKAGES']['DB/common'])) {
- include("DB/common.php");
-}
+use "DB/common";
class DB_mysql extends DB_common {
// {{{ properties
@@ -327,6 +323,7 @@
*/
function execute($stmt, $data = false) {
$realquery = $this->execute_emulate_query($stmt, $data);
+ print "<!-- realquery=$realquery -->\n";
$result = mysql_query($realquery, $this->connection);
if (!$result) {
return $this->errorCode(mysql_errno($this->connection));
Index: php4/pear/DB/odbc.php
diff -u php4/pear/DB/odbc.php:1.5 php4/pear/DB/odbc.php:1.6
--- php4/pear/DB/odbc.php:1.5 Sun Feb 27 06:46:27 2000
+++ php4/pear/DB/odbc.php Thu Mar 9 13:57:14 2000
@@ -31,11 +31,7 @@
// a reference.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB/odbc'])) return;
-$GLOBALS['USED_PACKAGES']['DB/odbc'] = true;
-if (empty($GLOBALS['USED_PACKAGES']['DB/common'])) {
- include("DB/common.php");
-}
+use "DB/common";
class DB_odbc extends DB_common {
// {{{ properties
Index: php4/pear/DB/pgsql.php
diff -u php4/pear/DB/pgsql.php:1.4 php4/pear/DB/pgsql.php:1.5
--- php4/pear/DB/pgsql.php:1.4 Sun Feb 27 06:46:27 2000
+++ php4/pear/DB/pgsql.php Thu Mar 9 13:57:14 2000
@@ -46,11 +46,7 @@
// be registered here.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB/pgsql'])) return;
-$GLOBALS['USED_PACKAGES']['DB/pgsql'] = true;
-if (empty($GLOBALS['USED_PACKAGES']['DB/common'])) {
- include("DB/common.php");
-}
+use "DB/common";
class DB_pgsql extends DB_common {
// {{{ properties
Index: php4/pear/DB/storage.php
diff -u php4/pear/DB/storage.php:1.3 php4/pear/DB/storage.php:1.4
--- php4/pear/DB/storage.php:1.3 Sun Feb 27 06:46:27 2000
+++ php4/pear/DB/storage.php Thu Mar 9 13:57:14 2000
@@ -21,11 +21,7 @@
// can be manipulated and that updates the database accordingly.
//
-if (!empty($GLOBALS['USED_PACKAGES']['DB/storage'])) return;
-$GLOBALS['USED_PACKAGES']['DB/storage'] = true;
-if (empty($GLOBALS['USED_PACKAGES']['DB'])) {
- include('DB.php');
-}
+use "DB";
function DB_storage_destructor() {
global $DB_storage_object_list;