Firebird updates
This commit is contained in:
parent
13e3c3f807
commit
f6e08d8765
@ -158,9 +158,9 @@ class firebird {
|
|||||||
*/
|
*/
|
||||||
function get_system_tables()
|
function get_system_tables()
|
||||||
{
|
{
|
||||||
$sql='SELECT RDB$RELATION_NAME as "rn" FROM "RDB$RELATIONS"
|
$sql='SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS"
|
||||||
WHERE "rn" LIKE \'RDB$\'
|
WHERE "RDB$RELATION_NAME" LIKE \'RDB$%\'
|
||||||
OR "rn" LIKE \'RDB$\'';
|
OR "RDB$RELATION_NAME" LIKE \'MON$%\'';
|
||||||
|
|
||||||
$this->statement = $this->query($sql);
|
$this->statement = $this->query($sql);
|
||||||
|
|
||||||
|
@ -28,8 +28,18 @@ class FirebirdTest extends UnitTestCase {
|
|||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUp()
|
||||||
|
{
|
||||||
$this->db = new Firebird(dirname(__FILE__)."/../test_dbs/FB_TEST_DB.FDB");
|
$this->db = new Firebird(dirname(__FILE__)."/../test_dbs/FB_TEST_DB.FDB");
|
||||||
|
$this->tables = $this->db->get_tables();
|
||||||
|
}
|
||||||
|
|
||||||
|
function tearDown()
|
||||||
|
{
|
||||||
|
unset($this->db);
|
||||||
|
unset($this->tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestConnection()
|
function TestConnection()
|
||||||
@ -39,7 +49,24 @@ class FirebirdTest extends UnitTestCase {
|
|||||||
|
|
||||||
function TestGetTables()
|
function TestGetTables()
|
||||||
{
|
{
|
||||||
$tables = $this->db->get_tables();
|
$tables = $this->tables;
|
||||||
|
$this->assertTrue(is_array($tables));
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestGetSystemTables()
|
||||||
|
{
|
||||||
|
$only_system = TRUE;
|
||||||
|
|
||||||
|
foreach($this->tables as $t)
|
||||||
|
{
|
||||||
|
if(stripos($t, 'rdb$') !== 0 && stripos($t, 'mon$') !== 0)
|
||||||
|
{
|
||||||
|
$only_system = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertTrue($only_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestCreateDatabase()
|
function TestCreateDatabase()
|
||||||
@ -48,9 +75,17 @@ class FirebirdTest extends UnitTestCase {
|
|||||||
$sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT'));
|
$sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT'));
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
//Reset
|
||||||
|
$this->tearDown();
|
||||||
|
$this->setUp();
|
||||||
|
|
||||||
|
?><pre><?= print_r($this->tables, TRUE) ?></pre><?php
|
||||||
|
|
||||||
//Check
|
//Check
|
||||||
$tables = $this->db->get_tables();
|
$table_exists = (bool)in_array('create_test', $this->tables);
|
||||||
$table_exists = in_array('create_test', $tables);
|
|
||||||
|
echo "create_test exists :".(int)$table_exists.'<br />';
|
||||||
|
|
||||||
$this->assertTrue($table_exists);
|
$this->assertTrue($table_exists);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +95,12 @@ class FirebirdTest extends UnitTestCase {
|
|||||||
$sql = $this->db->manip->delete_table('create_test');
|
$sql = $this->db->manip->delete_table('create_test');
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
//Reset
|
||||||
|
$this->tearDown();
|
||||||
|
$this->setUp();
|
||||||
|
|
||||||
//Check
|
//Check
|
||||||
$tables = $this->db->get_tables();
|
$table_exists = in_array('create_test', $this->tables);
|
||||||
$table_exists = in_array('create_test', $tables);
|
|
||||||
$this->assertFalse($table_exists);
|
$this->assertFalse($table_exists);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user