cvs: pear /DBA DBA.php

From: Date: Wed, 18 Dec 2002 02:27:28 +0000
Subject: cvs: pear /DBA DBA.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7919@lists.php.net to get a copy of this message
busterb Tue Dec 17 21:27:28 2002 EDT Modified files: /pear/DBA DBA.php Log: expand db_exists() to work with more driver types Index: pear/DBA/DBA.php diff -u pear/DBA/DBA.php:1.29 pear/DBA/DBA.php:1.30 --- pear/DBA/DBA.php:1.29 Sat Nov 30 00:12:28 2002 +++ pear/DBA/DBA.php Tue Dec 17 21:27:28 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA.php,v 1.29 2002/11/30 05:12:28 busterb Exp $ +// $Id: DBA.php,v 1.30 2002/12/18 02:27:28 busterb Exp $ // require_once('PEAR.php'); @@ -179,10 +179,13 @@ function db_exists($name, $driver = 'file') { if (!function_exists('dba_open') || ($driver=='file')) { + // the file driver stores data in two files return (file_exists($name.'.dat') && file_exists($name.'.idx')); - } elseif (($driver == 'db3') || ($driver == 'gdbm')){ + } elseif (in_array($driver, array('db2', 'db3', 'db4', 'gdbm'))) { + // these drivers store data in one file return file_exists($name); } else { + // do not know how other drivers store data return DBA::raiseError(DBA_ERROR_NO_DRIVER, NULL, NULL, 'driver: '.$driver); } }

« previous php.pear.cvs (#7919) next »