Added support for PostgreSQL and SQLite.

This commit is contained in:
Josh Sherman 2010-10-13 23:06:46 -04:00
parent 83e8447d8a
commit 1e0a7cd719
6 changed files with 429 additions and 201 deletions

View file

@ -23,6 +23,14 @@
*/
abstract class Database_Common extends Object
{
/**
* Driver
*
* @access protected
* @var string
*/
protected $driver;
/**
* Hostname for the server
*
@ -39,6 +47,14 @@ abstract class Database_Common extends Object
*/
protected $port = null;
/**
* UNIX socket for the server
*
* @access protected
* @var integer
*/
protected $socket = null;
/**
* Username for the server
*
@ -79,6 +95,27 @@ abstract class Database_Common extends Object
*/
protected $results = null;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
// Checks the driver is set and available
if ($this->driver == null)
{
throw new Exception('Driver name is not set');
}
else
{
if (extension_loaded($this->driver) == false)
{
throw new Exception('Driver "' . $this->driver . '" is not loaded');
}
}
}
/**
* Set Hostname
*
@ -99,6 +136,16 @@ abstract class Database_Common extends Object
return $this->port = $port;
}
/**
* Set Socket
*
* @param string $socket name of the UNIX socket
*/
public function setSocket($socket)
{
return $this->socket = $socket;
}
/**
* Set Username
*