Class XOAD_Events_Storage_MySQL

Description

XOAD Events Storage MySQL Class.

This class is a XOAD_Events_Storage successor.

The class allows you to save events information in MySQL database.

Example:

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

  • version: 0.6.0.0
  • author: Stanimir Angeloff

Located in /classes/events/storage/MySQL.class.php (line 70)

XOAD_Events_Storage
   |
   --XOAD_Events_Storage_MySQL
Variable Summary
 string $database
 bool $openNew
 string $password
 string $port
 string $server
 string $user
Method Summary
 XOAD_Events_Storage_MySQL XOAD_Events_Storage_MySQL (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 110)

Holds the MySQL database used in the connection string.

  • access: protected
bool $openNew (line 131)

Indicates whether to open a new connection to the MySQL server if an old one already exists.

  • access: protected
string $password (line 100)

Holds the MySQL password used in the connection string.

  • access: protected
string $port = 3306 (line 120)

Holds the MySQL port used in the connection string.

  • access: protected
string $server (line 80)

Holds the MySQL server used in the connection string.

  • access: protected
string $user (line 90)

Holds the MySQL user used in the connection string.

  • access: protected
Methods
Constructor XOAD_Events_Storage_MySQL (line 142)

Creates a new instance of the XOAD_Events_Storage_MySQL class.

  • access: public
XOAD_Events_Storage_MySQL XOAD_Events_Storage_MySQL (string $dsn)
  • string $dsn: The data source name and parameters to use when connecting to MySQL.
cleanEvents (line 319)

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 207)

Closes a MySQL connection link.

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

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 355)

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 183)

Creates a MySQL connection link.

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

Retrieves a static instance of the XOAD_Events_Storage_MySQL 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 to MySQL.

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

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:25 +0200 by phpDocumentor 1.3.0RC3