diff --git a/src/databases/firebird.php b/src/databases/firebird.php index 0c4dfd1..3b806ac 100644 --- a/src/databases/firebird.php +++ b/src/databases/firebird.php @@ -12,6 +12,12 @@ // -------------------------------------------------------------------------- +// Test for support +if( ! function_exists('ibase_connect')) +{ + return FALSE; +} + /** * Firebird Database class * diff --git a/src/databases/mysql.php b/src/databases/mysql.php index a053704..5460a34 100644 --- a/src/databases/mysql.php +++ b/src/databases/mysql.php @@ -12,6 +12,12 @@ // -------------------------------------------------------------------------- +// Test for support +if( ! in_array('mysql', pdo_drivers())) +{ + return FALSE; +} + /** * MySQL specific class * diff --git a/src/databases/odbc.php b/src/databases/odbc.php index 8236ef5..b9dfdec 100644 --- a/src/databases/odbc.php +++ b/src/databases/odbc.php @@ -12,6 +12,12 @@ // -------------------------------------------------------------------------- +// Test for support +if( ! in_array('odbc', pdo_drivers())) +{ + return FALSE; +} + /** * ODBC Database Driver * diff --git a/src/databases/pgsql.php b/src/databases/pgsql.php index 8557e5b..5a313bd 100644 --- a/src/databases/pgsql.php +++ b/src/databases/pgsql.php @@ -12,6 +12,12 @@ // -------------------------------------------------------------------------- +// Test for support +if( ! in_array('pgsql', pdo_drivers())) +{ + return FALSE; +} + /** * PostgreSQL specifc class * diff --git a/src/databases/sqlite.php b/src/databases/sqlite.php index 6e8c742..b59381a 100644 --- a/src/databases/sqlite.php +++ b/src/databases/sqlite.php @@ -12,6 +12,12 @@ // -------------------------------------------------------------------------- +// Test for support +if( ! in_array('sqlite', pdo_drivers())) +{ + return FALSE; +} + /** * SQLite specific class * diff --git a/src/windows/add_db.php b/src/windows/add_db.php index e0f89b9..f9c807c 100644 --- a/src/windows/add_db.php +++ b/src/windows/add_db.php @@ -39,12 +39,7 @@ class Add_DB extends GtkWindow { { $table = new GtkTable(); - $db_types = array( - 'MySQL', - 'PostgreSQL', - 'SQLite', - 'ODBC' - ); + $db_types = $this->get_available_dbs(); //Table attach //$tbl->attach(left_start, right_stop, top_start, bottom_stop) @@ -102,6 +97,33 @@ class Add_DB extends GtkWindow { return $table; } + + /** + * Checks what database drivers are available + * + * @return array + */ + function get_available_dbs() + { + $drivers = array(); + + // Check if there is pdo support + if( ! function_exists('pdo_drivers')) + { + return FALSE; + } + + $drivers = pdo_drivers(); + + if(function_exists('ibase_connect')) + { + $drivers[] = "Firebird"; + } + + sort($drivers); + + return $drivers; + } } // End of add_db.php \ No newline at end of file