DBA
[ class tree: DBA ] [ index: DBA ] [ all elements ]

Class: DBA_Driver_Builtin

Source Location: /DBA-1.1.1/DBA/Driver/Builtin.php

Class Overview

PEAR
   |
   --DBA
      |
      --DBA_Driver_Builtin

DBA_Driver_Builtin uses the builtin dba functions of PHP as the underlying driver for a DBA class. Depending on the driver, this can be faster or slower than the DBA_Driver_File class.


Author(s):

Version:

  • 1.0

Methods


Inherited Variables

Inherited Methods

Class: DBA

DBA::DBA()
Default constructor
DBA::create()
Creates a new DBA object
DBA::db_drop()
Deletes a DBA database from the filesystem
DBA::db_exists()
Returns whether a database exists
DBA::errorMessage()
Return a textual error message for a DBA error code
DBA::getDriverList()
Returns an array of the currently supported drivers
DBA::isError()
Returns whether a result code from a DBA method is an error
DBA::raiseError()
This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.

Class Details

[line 39]
DBA_Driver_Builtin uses the builtin dba functions of PHP as the underlying driver for a DBA class. Depending on the driver, this can be faster or slower than the DBA_Driver_File class.

This class has been tested with DB3 and GDBM and probably works with DB2. Other drivers may have quirks that this class does not address yet. CDB is known to be unsuitable as a driver due to its lack of write ability.



[ Top ]


Method Detail

DBA_Driver_Builtin (Constructor)   [line 80]

DBA_Driver_Builtin DBA_Driver_Builtin( [ $driver = 'gdbm'])


Parameters:

   $driver     

[ Top ]

close   [line 170]

object PEAR_Error close( )

Closes an open database.
  • Return: on failure
  • Access: public

[ Top ]

create   [line 442]

object PEAR_Error create( string $dbName, [string $driver = 'gdbm'])

Creates a new database file if one does not exist. If it already exists, updates the last-updated timestamp on the database
  • Return: on failure
  • Access: public

Overrides DBA::create() (Creates a new DBA object)

Parameters:

string   $dbName     the database to create
string   $driver     the dba driver to use

[ Top ]

db_drop   [line 480]

object PEAR_Error db_drop( string $dbName)

Removes a database from existence
  • Return: on failure
  • Access: public

Overrides DBA::db_drop() (Deletes a DBA database from the filesystem)

Parameters:

string   $dbName     the database name to drop

[ Top ]

db_exists   [line 466]

boolean db_exists( string $dbName)

Indicates whether a database with given name exists
  • Return: true if the database exists, false if it doesn't
  • Access: public

Overrides DBA::db_exists() (Returns whether a database exists)

Parameters:

string   $dbName     the database name to check for existence

[ Top ]

drop   [line 501]

object PEAR_Error drop( )

Removes the last open database from existence
  • Return: on failure
  • Access: public

[ Top ]

exists   [line 516]

boolean exists( string $key)

Check whether key exists
  • Return: true if the key exists, false if it doesn't
  • Access: public

Parameters:

string   $key     

[ Top ]

fetch   [line 289]

mixed fetch( string $key)

Returns the value that is stored at $key.
  • Return: the requested value on success, false on failure
  • Access: public

Parameters:

string   $key     key to examine

[ Top ]

firstkey   [line 310]

mixed firstkey( )

Returns the first key in the database
  • Return: string on success, false on failure
  • Access: public

[ Top ]

getkeys   [line 363]

mixed getkeys( )

Returns all keys in the database
  • Return: array
  • Access: public

[ Top ]

insert   [line 387]

object PEAR_Error insert( string $key, string $value)

Inserts a new value at $key. Will not overwrite if the key/value pair already exist
  • Return: on failure
  • Access: public

Parameters:

string   $key     key to insert
string   $value     value to store

[ Top ]

isOpen   [line 229]

boolean isOpen( )

Returns the current open status for the database
  • Return: true if open, false if closed
  • Access: public

[ Top ]

isReadable   [line 242]

boolean isReadable( )

Returns the current read status for the database
  • Return: true if readable, false if not
  • Access: public

[ Top ]

isWritable   [line 255]

boolean isWritable( )

Returns the current write status for the database
  • Return: true if writable, false if not
  • Access: public

[ Top ]

nextkey   [line 346]

mixed nextkey( )

Returns the next key in the database, false if there is a problem
  • Return: string on success, false on failure
  • Access: public

[ Top ]

open   [line 104]

object PEAR_Error open( [string $dbName = ''], [string $mode = 'r'], [boolean $persistent = false])

Opens a database.
  • Return: on failure
  • Access: public

Parameters:

string   $dbName     The name of a database
string   $mode     The mode in which to open a database. 'r' opens read-only. 'w' opens read-write. 'n' creates a new database and opens read-write. 'c' creates a new database if the database does not exist and opens read-write.
boolean   $persistent     Determines whether to open the database peristently. Not supported here.

[ Top ]

optimize   [line 538]

void optimize( )

Optimizes an open database
  • Access: public

[ Top ]

remove   [line 269]

object PEAR_Error remove( string $key)

Removes the value at location $key
  • Return: on failure
  • Access: public

Parameters:

string   $key     key to delete

[ Top ]

reopen   [line 193]

object PEAR_Error reopen( string $mode)

Reopens an already open database in read-only or write mode.

If the database is already in the requested mode, then this function does nothing.

  • Return: on failure
  • Access: public

Parameters:

string   $mode     'r' for read-only, 'w' for read/write

[ Top ]

replace   [line 412]

object PEAR_Error replace( $key $key, $value $value)

Inserts a new value at key. If the key/value pair already exist, overwrites the value
  • Return: on failure
  • Access: public

Parameters:

$key   $key     string the key to insert
$value   $value     string the value to store

[ Top ]

size   [line 327]

int size( )

Calculates the size of the database in number of keys
  • Return: number of keys in the database
  • Access: public

[ Top ]

sync   [line 527]

void sync( )

Synchronizes an open database to disk
  • Access: public

[ Top ]


Documentation generated on Mon, 16 Apr 2007 04:00:05 -0400 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.