CREDITS:

This class is made by unreal4u (Camilo Sperberg) and based on the Extended MySQLi class made by the same author. It haves exactly the same methods so that migrating from MySQL to PostGreSQL won't be so hard to do.

ABOUT THIS CLASS:

In a glinch:

Detailed:

This package implements a PostGreSQL database access wrapper using the PDO extension.

There is class that manages PostGreSQL database access connections so only one connection is established during the same PHP script execution.

Another class implements other database access functions like executing queries with prepared queries, measuring the time the queries take to execute and the memory usage, retrieving query results into arrays, the number of result rows, last inserted record identifier and log executed queries to a valid XML log file or directly into your page.

If the query takes just too long, you can cache the query result into an XML file, and you can also handle errors.

This package has been extensivily tested with xDebug and Suhosin so that no errors are present.

USAGE:

PENDING:

config.php:

define('CHARSET','UTF-8');
define('DB_SHOW_ERRORS',TRUE); // Show DB connection error to users?
define('DB_LOG_XML',FALSE); // Log all database activity to XML?
define('DB_URL_XML','/home/user/db-log.xml'); // Location of XML file, recommended place is outside the public html directory!
define('DB_CACHE_LOCATION','cache/'); // Location of cache file(s), with trailing slash
define('DB_CACHE_EXPIRE','60'); // DB cache file expiricy, in seconds

define('PGSQL_HOST','localhost'); // your db's host
define('PGSQL_PORT',5432);        // your db's port
define('PGSQL_USER','test'); // your db's username
define('PGSQL_PASS','test'); // your db's password
define('PGSQL_NAME','test');   // your db's database name
define('PGSQL_FETCH_MODE',PDO::FETCH_ASSOC);

VERSION HISTORY: