cvs: pear /DBA DBA.php /DBA/tests test_drivers.php
| From: | Brent Cook | Date: | Sat, 11 Jan 2003 01:59:46 +0000 |
| Subject: | cvs: pear /DBA DBA.php /DBA/tests test_drivers.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8185@lists.php.net to get a copy of this message | ||
busterb Fri Jan 10 20:59:46 2003 EDT
Modified files:
/pear/DBA DBA.php
/pear/DBA/tests test_drivers.php
Log:
renamed DBA::drop to DBA::db_drop, for consistency with the
DBA_Driver_*::db_drop method. Other fixes to the function.
Index: pear/DBA/DBA.php
diff -u pear/DBA/DBA.php:1.33 pear/DBA/DBA.php:1.34
--- pear/DBA/DBA.php:1.33 Wed Jan 8 16:37:32 2003
+++ pear/DBA/DBA.php Fri Jan 10 20:59:45 2003
@@ -21,7 +21,7 @@
// | Olaf Conradi <conrado@drake.bt.co.uk> |
// +----------------------------------------------------------------------+
//
-// $Id: DBA.php,v 1.33 2003/01/08 21:37:32 busterb Exp $
+// $Id: DBA.php,v 1.34 2003/01/11 01:59:45 busterb Exp $
//
require_once('PEAR.php');
@@ -97,10 +97,18 @@
* @param string $driver type of storage object to return
* @return object DBA storage object, returned by reference
*/
- function drop($name, $driver = 'file')
+ function db_drop($name, $driver = 'file')
{
- $db = DBA::create($driver);
- return $db->db_drop($name);
+ if (!function_exists('dba_open') || ($driver=='file')) {
+ require_once 'DBA/Driver/File.php';
+ return DBA_Driver_File::db_drop($name);
+ } elseif (in_array($driver, DBA::getDriverList())) {
+ require_once 'DBA/Driver/Builtin.php';
+ return DBA_Driver_Builtin::db_drop($name);
+ } else {
+ return DBA::raiseError(DBA_ERROR_UNSUP_DRIVER, NULL, NULL,
+ 'driver: '.$driver);
+ }
}
/**
Index: pear/DBA/tests/test_drivers.php
diff -u pear/DBA/tests/test_drivers.php:1.3 pear/DBA/tests/test_drivers.php:1.4
--- pear/DBA/tests/test_drivers.php:1.3 Wed Jan 8 16:37:33 2003
+++ pear/DBA/tests/test_drivers.php Fri Jan 10 20:59:46 2003
@@ -20,7 +20,7 @@
// | Author: Brent Cook <busterb@mail.utexas.edu> |
// +----------------------------------------------------------------------+
//
-// $Id: test_drivers.php,v 1.3 2003/01/08 21:37:33 busterb Exp $
+// $Id: test_drivers.php,v 1.4 2003/01/11 01:59:46 busterb Exp $
//
// test functionality of the file-based dba driver
@@ -113,7 +113,7 @@
exit;
}
- if (PEAR::isError($result = DBA::drop('test_db'))) {
+ if (PEAR::isError($result = DBA::db_drop('test_db', $driver))) {
echo $result->getMessage();
exit;
}