More DB class improvements

This commit is contained in:
Timothy Warren 2012-01-31 17:52:46 -05:00
parent a9b0a99119
commit 4f49c8b9be
4 changed files with 34 additions and 1 deletions

View File

@ -12,6 +12,12 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Make sure PDO exists!
if( ! function_exists('pdo_drivers'))
{
return FALSE;
}
/** /**
* Base Database class * Base Database class
* *

View File

@ -27,8 +27,23 @@ class firebird {
protected $conn; protected $conn;
/**
* Open the link to the database
*
* @param string $db
* @param string $user
* @param string $pass
*/
function __construct($db, $user, $pass) function __construct($db, $user, $pass)
{ {
$this->conn = @ibase_connect($db, $user, $pass); $this->conn = @ibase_connect($db, $user, $pass);
} }
/**
* Close the link to the database
*/
function __destruct()
{
@ibase_close($this->conn);
}
} }

View File

@ -42,6 +42,7 @@ function log_fatal()
register_shutdown_function('log_fatal'); register_shutdown_function('log_fatal');
// Make sure php-gtk works
if ( ! class_exists('gtk')) if ( ! class_exists('gtk'))
{ {
die("Please load the php-gtk2 module in your php.ini\r\n"); die("Please load the php-gtk2 module in your php.ini\r\n");

View File

@ -113,8 +113,19 @@ class Add_DB extends GtkWindow {
return FALSE; return FALSE;
} }
$drivers = pdo_drivers(); // Add PDO drivers
foreach(pdo_drivers() as $d)
{
// Skip sqlite2
if($d === 'sqlite2')
{
continue;
}
$drivers[] = $d;
}
// Add firebird support, if exists
if(function_exists('ibase_connect')) if(function_exists('ibase_connect'))
{ {
$drivers[] = "Firebird"; $drivers[] = "Firebird";