File/inc/PdoQuery.php

Description

PDO query class and associated functions

This subpackage provides some functions that are useful around database activity and a PdoDialect, PdoDatabase and PdoQuery classes to simplify handling of database queries and provide some access for a limited ability to handle varying database dialects.

The class is intended to be a very lightweight wrapper with some features that have proved useful in developing and debugging web-based applications:

  • All queries are timed, and an expected time can be provided.
  • Parameters replaced into the SQL will be escaped correctly in order to minimise the chances of SQL injection errors.
  • Queries which fail, or which exceed their expected execution time, will be logged for potential further analysis.
  • Debug logging of queries may be enabled globally, or restricted to particular sets of queries.
  • Simple syntax for iterating through a result set.
See http://wiki.davical.org/w/PdoQuery for design and usage information.

If not already connected, PdoQuery will attempt to connect to the database, successively applying connection parameters from the array in $c->pdo_connect.

We will die if the database is not currently connected and we fail to find a working connection.

Classes
Class Description
 class PdoDialect The PdoDialect class handles
 class PdoDatabase Typically there will only be a single instance of the database level class in an application.
 class PdoQuery A variable of this class is normally constructed through a call to PdoDatabase::Query or PdoDatabase::Prepare, associating it on construction with the database which is to be queried.

Documentation generated on Fri, 10 Apr 2009 23:45:53 +1200 by phpDocumentor 1.3.2