Fix Firebird Tests, update README

This commit is contained in:
Timothy Warren 2012-02-09 12:00:39 -05:00
parent c36cd13dd6
commit 49dc7fad11
3 changed files with 32 additions and 12 deletions

View File

@ -1,8 +1,8 @@
#OpenSQLManager #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. 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 ## 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
* PDO drivers for the databases you wish to use * 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 ## Planned Features
* CRUD (Create, Read, Update, Delete) functionality * CRUD (Create, Read, Update, Delete) functionality
* Database table creation and backup * Database table creation and backup
@ -33,5 +36,4 @@ Plan to implement, not support:
## Won't Support ## Won't Support
Closed source DBs, like Oracle, MSSQL, etc. Closed source DBs, like Oracle, MSSQL, etc.

View File

@ -120,7 +120,7 @@ class firebird {
/** /**
* Emulate PDO prepare * Emulate PDO prepare
* *
* @return resource * @return resource
*/ */
function prepare() function prepare()
@ -136,10 +136,19 @@ class firebird {
*/ */
function get_tables() 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); $this->statement = $this->query($sql);
return $this->fetch(); $tables = array();
while($row = $this->fetch(PDO::FETCH_ASSOC))
{
$tables[] = $row['RDB$RELATION_NAME'];
}
return $tables;
} }
/** /**

View File

@ -37,23 +37,32 @@ class FirebirdTest extends UnitTestCase {
$this->assertIsA($this->db, 'Firebird'); $this->assertIsA($this->db, 'Firebird');
} }
/*function TestGetTables() function TestGetTables()
{ {
$tables = $this->db->get_tables(); $tables = $this->db->get_tables();
print_r($tables);
} }
function TestCreateDatabase() function TestCreateDatabase()
{ {
//Attempt to create the table //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); $this->db->query($sql);
//Check
$tables = $this->db->get_tables();
$table_exists = in_array('create_test', $tables);
$this->assertTrue($table_exists);
} }
function TestDeleteDatabase() function TestDeleteDatabase()
{ {
//Attempt to delete the table
$sql = $this->db->manip->delete_table('create_test'); $sql = $this->db->manip->delete_table('create_test');
$this->db->query($sql); $this->db->query($sql);
}*/
//Check
$tables = $this->db->get_tables();
$table_exists = in_array('create_test', $tables);
$this->assertFalse($table_exists);
}
} }