/** * Closes a table * * @access public * @return object PEAR_Error on failure */ function close() { if ($this->_dba->isWritable()) { // pack up the field structure and store it back in the table if (isset($this->_schema)) { $schema = $this->_packSchema($this->_schema); if (DBA::isError($schema)) { return $schema; } $this->_dba->replace(DBA_SCHEMA_KEY, $schema); } else { echo "No schema, what's the point :P\n"; } } $this->_maxKey = null; return $this->_dba->close(); }
/** * Return a textual error message for a DBA error code * * @param int $value error code * @return string error message, or false if the error code was * not recognized * @access public */ function errorMessage($value) { static $errorMessages; if (!isset($errorMessages)) { $errorMessages = array(DBA_ERROR => 'unknown error', DBA_ERROR_UNSUP_DRIVER => 'unsupported database driver', DBA_ERROR_UNSUP_PERSISTENCE => 'persistent connections not supported', DBA_ERROR_NO_DRIVER => 'no driver loaded', DBA_ERROR_NO_DBNAME => 'no databasename given', DBA_ERROR_NOSUCHDB => 'database not found', DBA_ERROR_INVALID_MODE => 'invalid file mode', DBA_ERROR_CANNOT_CREATE => 'can not create database', DBA_ERROR_CANNOT_OPEN => 'can not open database', DBA_ERROR_CANNOT_DROP => 'can not drop database', DBA_ERROR_NOT_READABLE => 'database not readable', DBA_ERROR_NOT_WRITEABLE => 'database not writeable', DBA_ERROR_NOT_OPEN => 'database not open', DBA_ERROR_NOT_FOUND => 'key not found', DBA_ERROR_ALREADY_EXISTS => 'key already exists'); } if (DBA::isError($value)) { $value = $value->getCode(); } return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[DBA_ERROR]; }