From 49dc7fad11f5ef6a1dd9d6cf717cfafc59421fc8 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 9 Feb 2012 12:00:39 -0500 Subject: [PATCH] Fix Firebird Tests, update README --- README.md | 10 ++++++---- src/databases/firebird.php | 15 ++++++++++++--- tests/databases/firebird.php | 19 ++++++++++++++----- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index abe6b36..a7879cc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ #OpenSQLManager -OpenSQLManager is an attempt to create an alternative to Navicat that is free and open. It is built with PHP-GTK, so I'm looking for a way to create normal binaries. +OpenSQLManager is an attempt to create an alternative to Navicat that is free and open. It is build with PHP-GTK, so I'm looking for a way to create normal binaries. -### Included pre-configured version of php for windows +### Pre-configured version of php for windows Because php-gtk is such a pain to compile on Windows, I've put together this package from the latest php-gtk windows package. It's available in the downloads section. ## PHP Requirements @@ -15,6 +15,9 @@ Because php-gtk is such a pain to compile on Windows, I've put together this pac * PDO * PDO drivers for the databases you wish to use +## Want to Contribute? +See [Dev Guide](https://github.com/aviat4ion/OpenSQLManager/blob/master/DEV_README.md) + ## Planned Features * CRUD (Create, Read, Update, Delete) functionality * Database table creation and backup @@ -33,5 +36,4 @@ Plan to implement, not support: ## Won't Support -Closed source DBs, like Oracle, MSSQL, etc. - +Closed source DBs, like Oracle, MSSQL, etc. \ No newline at end of file diff --git a/src/databases/firebird.php b/src/databases/firebird.php index 400ae86..ce3944c 100644 --- a/src/databases/firebird.php +++ b/src/databases/firebird.php @@ -120,7 +120,7 @@ class firebird { /** * Emulate PDO prepare - * + * * @return resource */ function prepare() @@ -136,10 +136,19 @@ class firebird { */ function get_tables() { - $sql="SELECT rdb\$relation_name FROM rdb\$relations WHERE rdb\$relation_name NOT LIKE 'RDB\$%'"; + $sql='SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" + WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' + AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; $this->statement = $this->query($sql); - return $this->fetch(); + $tables = array(); + + while($row = $this->fetch(PDO::FETCH_ASSOC)) + { + $tables[] = $row['RDB$RELATION_NAME']; + } + + return $tables; } /** diff --git a/tests/databases/firebird.php b/tests/databases/firebird.php index 56bad23..e412db2 100644 --- a/tests/databases/firebird.php +++ b/tests/databases/firebird.php @@ -37,23 +37,32 @@ class FirebirdTest extends UnitTestCase { $this->assertIsA($this->db, 'Firebird'); } - /*function TestGetTables() + function TestGetTables() { $tables = $this->db->get_tables(); - - print_r($tables); } function TestCreateDatabase() { //Attempt to create the table - $sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT'), array('id' => 'PRIMARY KEY')); + $sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT')); $this->db->query($sql); + + //Check + $tables = $this->db->get_tables(); + $table_exists = in_array('create_test', $tables); + $this->assertTrue($table_exists); } function TestDeleteDatabase() { + //Attempt to delete the table $sql = $this->db->manip->delete_table('create_test'); $this->db->query($sql); - }*/ + + //Check + $tables = $this->db->get_tables(); + $table_exists = in_array('create_test', $tables); + $this->assertFalse($table_exists); + } } \ No newline at end of file