Sitellite Application Framework
Class Tree         Index         All Elements

Class: BDB

Source Location: Program_Root/Database/BDB.php

Class Overview


BDB is a very minimal wrapper around the Berkeley Database functions in PHP. Its purpose is simply to create an object oriented interface to those functions.


Author(s)

Version

  • 1.0, 2001-10-22, $Id: BDB.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 52]
BDB is a very minimal wrapper around the Berkeley Database functions in PHP. Its purpose is simply to create an object oriented interface to those functions.


1 <?php
2
3 $bdb = new BDB ('/tmp/object_store.db', 'w', 'db3', 0);
4
5 if ($bdb->exists ($cgi->key)) {
6 echo $bdb->fetch ($cgi->key);
7 }
8
9 $bdb->close ();
10
11 ? >




Tags:

access:  public
version:  1.0, 2001-10-22, $Id: BDB.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$connection =

[line 60]

This is a Berkeley Database connection resource returned by the dba_open () or dba_popen () function.



Tags:

access:  public

Type:   mixed


[ Top ]

$handler =

[line 85]

The database implementation used (db2, db3, gdbm, etc.).



Tags:

access:  public

Type:   mixed


[ Top ]

$mode =

[line 77]

Mode to use when opening the database (corresponds to the modes available to the dba_open () function.



Tags:

access:  public

Type:   mixed


[ Top ]

$path =

[line 68]

Path to the Berkeley Database.



Tags:

access:  public

Type:   mixed


[ Top ]

$persistent =

[line 93]

Whether or not to use persistence when connecting to the database.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor BDB [line 106]

BDB BDB( string $path, [string $mode = 'r'], [string $handler = 'db3'], [boolean $persistent = 0])

Constructor Method. Establishes a connection to the database, which can be verified by an if ($dbd->connection) {.



Tags:

access:  public


Parameters:

string   $path  
string   $mode  
string   $handler  
boolean   $persistent  

[ Top ]

method close [line 125]

void close( string $path)

Disconnects from the database.



Tags:

access:  public


Parameters:

string   $path  

[ Top ]

method delete [line 137]

boolean delete( string $key)

Deletes a record from the database.



Tags:

access:  public


Parameters:

string   $key  

[ Top ]

method delete_all [line 141]

void delete_all( )



[ Top ]

method exists [line 161]

boolean exists( string $key)

Checks if a key/value pair exists in the database.



Tags:

access:  public


Parameters:

string   $key  

[ Top ]

method fetch [line 174]

string fetch( string $key)

Retrieves a value corresponding to the provided key, from the database. Returns false on error.



Tags:

access:  public


Parameters:

string   $key  

[ Top ]

method firstkey [line 185]

string firstkey( )

Retrieves the first key in the database.



Tags:

access:  public


[ Top ]

method insert [line 198]

boolean insert( string $key, string $value)

Insert a new key/value pair into the database.



Tags:

access:  public


Parameters:

string   $key  
string   $value  

[ Top ]

method nextkey [line 210]

string nextkey( )

Retrieves the next key in the database. Used with firstkey to loop through records.



Tags:

access:  public


[ Top ]

method optimize [line 221]

boolean optimize( )

Optimizes the database.



Tags:

access:  public


[ Top ]

method replace [line 235]

boolean replace( string $key, string $value)

Replaces the value of an existing pair with the new value provided.



Tags:

access:  public


Parameters:

string   $key  
string   $value  

[ Top ]

method sync [line 247]

boolean sync( )

Synchronizes the database. This usually writes the database to disk.



Tags:

access:  public


[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:16:48 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2