Class XOAD_Events_Storage_PearDB

Description

XOAD Events Storage PearDB Class.

This class is a XOAD_Events_Storage successor.

The class allows you to save events information in PearDB compatible database.

Pear::DB supported databases (type parameter)

  • dbase - dBase
  • fbsql - FrontBase
  • ibase - InterBase
  • ifx - Informix
  • msql - Mini SQL
  • mssql - Microsoft SQL Server
  • mysql - MySQL (for servers running MySQL <= 4.0)
  • mysqli - MySQL (for servers running MySQL >= 4.1)
  • oci8 - Oracle 7/8/9
  • odbc - Open Database Connectivity
  • pgsql - PostgreSQL
  • sqlite - SQLite
  • sybase - Sybase
Example:

  1. <?php
  2.  
  3. require_once('xoad.php');
  4. require_once('DB.php');
  5.  
  6. require_once(XOAD_BASE . '/classes/events/storage/PearDB.class.php');
  7.  
  8. $storage = new XOAD_Events_Storage_PearDB('type=?;server=?;user=?;password=?;database=?;[port=?]');
  9.  
  10. $storage->postEvent('event', 'class');
  11.  
  12. ?>

  • version: 0.6.0.0
  • author: Norm 2782

Located in /classes/events/storage/PearDB.class.php (line 86)

XOAD_Events_Storage
   |
   --XOAD_Events_Storage_PearDB
Variable Summary
 string $database
 string $password
 resource $pearDSN
 string $port
 string $server
 string $type
 string $user
Method Summary
 XOAD_Events_Storage_PearDB XOAD_Events_Storage_PearDB (string $dsn)
 bool cleanEvents ()
 void closeConnection (mixed &$connection)
 string escapeString (mixed $unescapedString, mixed &$connection)
 array filterMultipleEvents (array $eventsData)
 resource &getConnection ()
 object A &getStorage (string $dsn)
 bool postMultipleEvents (array $eventsData)
Variables
string $database (line 137)

Holds the PearDB database used in the connection string.

  • access: protected
string $password (line 127)

Holds the PearDB password used in the connection string.

  • access: protected
resource $pearDSN (line 157)

Holds the PearDB DSN for reconnection to database.

  • access: protected
string $port (line 147)

Holds the PearDB port used in the connection string.

  • access: protected
string $server (line 107)

Holds the PearDB server used in the connection string.

  • access: protected
string $type (line 96)

Holds the PearDB Database type setting used in the connection string.

  • access: protected
string $user (line 117)

Holds the PearDB user used in the connection string.

  • access: protected
Methods
Constructor XOAD_Events_Storage_PearDB (line 168)

Creates a new instance of the XOAD_Events_Storage_PearDB class.

  • access: public
XOAD_Events_Storage_PearDB XOAD_Events_Storage_PearDB (string $dsn)
  • string $dsn: The data source name and parameters to use when connecting with PearDB.
cleanEvents (line 342)

Deletes old events from the database.

This method is called before calling filterEvents or filterMultipleEvents to delete all expired events from the database.

  • return: true on success, false otherwise.
  • access: public
bool cleanEvents ()

Redefinition of:
XOAD_Events_Storage::cleanEvents()
This method should be called from each successor to retrieve the start time of the old events in the storage.
closeConnection (line 235)

Closes a PearDB connection link.

  • access: private
void closeConnection (mixed &$connection)
escapeString (line 251)

Escapes special characters in the $unescapedString, taking into account the current charset of the connection.

  • access: private
string escapeString (mixed $unescapedString, mixed &$connection)
filterMultipleEvents (line 378)

Filters the events in the database using multiple criterias.

Valid keys for each event are:

  • event - the event name (case-sensitive);
  • className - the class that is the source of the event;
  • filter - the event filter data (case-insensitive); using this argument you can filter events with the same name but with different filter data;
  • time - the event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

  • return: Sequental array that contains all events that match the supplied criterias, ordered by time (ascending).
  • access: public
array filterMultipleEvents (array $eventsData)
  • array $eventsData: Array containing associative arrays with information for each event.

Redefinition of:
XOAD_Events_Storage::filterMultipleEvents()
This method should be called from each successor to add common data to the event.
getConnection (line 218)

Creates a PearDB connection link.

  • access: private
resource &getConnection ()
getStorage (line 198)

Retrieves a static instance of the XOAD_Events_Storage_PearDB class.

This method overrides XOAD_Events_Storage::getStorage.

object A &getStorage (string $dsn)
  • string $dsn: The data source name and parameters to use when connecting with PearDB.

Redefinition of:
XOAD_Events_Storage::getStorage()
Retrieves an instanse to the configurated XOAD Events storage provider.
postMultipleEvents (line 280)

Posts multiple events to the database.

Valid keys for each event are:

  • event - the event name (case-sensitive);
  • className - the class that is the source of the event;
  • sender - the sender object of the event;
  • data - the data associated with the event;
  • filter - the event filter data (case-insensitive); using this key you can post events with the same name but with different filter data; the client will respond to them individually;
  • time - the event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT);
  • lifetime - the event lifetime (in seconds);

  • return: true on success, false otherwise.
  • access: public
bool postMultipleEvents (array $eventsData)
  • array $eventsData: Array containing associative arrays with information for each event.

Redefinition of:
XOAD_Events_Storage::postMultipleEvents()
This method should be called from each successor to add common data to the event.

Inherited Methods

Inherited From XOAD_Events_Storage

 XOAD_Events_Storage::XOAD_Events_Storage()
 XOAD_Events_Storage::cleanEvents()
 XOAD_Events_Storage::filterEvents()
 XOAD_Events_Storage::filterMultipleEvents()
 XOAD_Events_Storage::getStorage()
 XOAD_Events_Storage::postEvent()
 XOAD_Events_Storage::postMultipleEvents()

Documentation generated on Sat, 12 Nov 2005 20:24:31 +0200 by phpDocumentor 1.3.0RC3