コード例 #1
0
 function dba_open($filename, $mode, $handler)
 {
     $dba = new DBA_Driver_File();
     $dba->open($filename, $mode);
     if (PEAR::isError($dba)) {
         return false;
     } else {
         return $dba;
     }
 }
コード例 #2
0
ファイル: DBA.php プロジェクト: GeekyNinja/LifesavingCAD
 /**
  * Deletes a DBA database from the filesystem
  *
  * @static
  * @param   string $driver type of storage object to return
  * @return  object DBA storage object, returned by reference
  */
 function db_drop($name, $driver = 'file')
 {
     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);
     }
 }
コード例 #3
0
ファイル: File.php プロジェクト: altesien/FinalProject
 /**
  * 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(DBA_ERROR_CANNOT_DROP, NULL, NULL, 'dbname: ' . $dbName);
         }
     } else {
         return $this->raiseError(DBA_ERROR_NOSUCHDB, NULL, NULL, 'dbname: ' . $dbName);
     }
 }