|
cvs: pear /DBA/DBA/Driver Builtin.php File.php: msg#00668php.cvs.pear
busterb Sun Sep 29 23:22:23 2002 EDT Modified files: /pear/DBA/DBA/Driver Builtin.php File.php Log: add new drop() and db_drop() methods Index: pear/DBA/DBA/Driver/Builtin.php diff -u pear/DBA/DBA/Driver/Builtin.php:1.7 pear/DBA/DBA/Driver/Builtin.php:1.8 --- pear/DBA/DBA/Driver/Builtin.php:1.7 Sun Sep 29 22:51:21 2002 +++ pear/DBA/DBA/Driver/Builtin.php Sun Sep 29 23:22:23 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: Builtin.php,v 1.7 2002/09/30 02:51:21 busterb Exp $ +// $Id: Builtin.php,v 1.8 2002/09/30 03:22:23 busterb Exp $ require_once 'DBA.php'; @@ -435,6 +435,40 @@ function db_exists($dbName) { return file_exists($dbName); + } + // }}} + + // {{{ db_drop($dbName) + /** + * Removes a database from existence + * + * @access public + * @param string $dbName the database name to drop + * @return object PEAR_Error on failure + */ + function db_drop($dbName) + { + if (DBA_Driver_Builtin::db_exists($dbName)) { + if (!unlink($dbName)) { + return $this->raiseError('Could not unlink '.$dbName); + } + } else { + return $this->raiseError($dbName.' does not exist'); + } + } + // }}} + + // {{{ drop() + /** + * Removes the last open database from existence + * + * @access public + * @return object PEAR_Error on failure + */ + function drop() + { + $this->close(); + return $this->db_drop($this->_dbName); } // }}} Index: pear/DBA/DBA/Driver/File.php diff -u pear/DBA/DBA/Driver/File.php:1.5 pear/DBA/DBA/Driver/File.php:1.6 --- pear/DBA/DBA/Driver/File.php:1.5 Thu Sep 26 01:18:07 2002 +++ pear/DBA/DBA/Driver/File.php Sun Sep 29 23:22:23 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: File.php,v 1.5 2002/09/26 05:18:07 busterb Exp $ +// $Id: File.php,v 1.6 2002/09/30 03:22:23 busterb Exp $ require_once 'DBA.php'; @@ -636,6 +636,40 @@ function db_exists($dbName) { return(file_exists($dbName.'.dat') && file_exists($dbName.'.idx')); + } + // }}} + + // {{{ db_drop($dbName) + /** + * Removes a database from existence + * + * @access public + * @param string $dbName the database name to drop + * @return object PEAR_Error on failure + */ + function db_drop($dbName) + { + if (DBA_Driver_File::db_exists($dbName)) { + if (!unlink($dbName.'.dat') || !unlink($dbName.'.idx')) { + return $this->raiseError('Could not unlink '.$dbName); + } + } else { + return $this->raiseError($dbName.' does not exist'); + } + } + // }}} + + // {{{ drop($dbName) + /** + * Removes the last open database from existence + * + * @access public + * @return object PEAR_Error on failure + */ + function drop() + { + $this->close(); + return $this->db_drop($this->_dbName); } // }}} -- PEAR CVS Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | cvs: pear /DBA/tests test_drivers.php test_file_driver.php: 00668, Brent Cook |
|---|---|
| Next by Date: | cvs: pear /DBA DBA.php package.xml /DBA/DBA Compatibility.php /DBA/DBA/Driver File.php: 00668, Brent Cook |
| Previous by Thread: | cvs: pear /DBA/tests test_drivers.php test_file_driver.phpi: 00668, Brent Cook |
| Next by Thread: | cvs: pear /DBA DBA.php package.xml /DBA/DBA Compatibility.php /DBA/DBA/Driver File.php: 00668, Brent Cook |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |