More firebird coverage

This commit is contained in:
Timothy Warren 2014-02-07 15:43:25 -05:00
parent 29f824b562
commit 7c0b951539
3 changed files with 58 additions and 39 deletions

View File

@ -148,13 +148,8 @@ class Firebird_Result extends PDOStatement {
* @param mixed $offset
* @return mixed
*/
public function fetch($fetch_style=PDO::FETCH_ASSOC, $statement=NULL, $offset=NULL)
public function fetch($fetch_style=PDO::FETCH_ASSOC, $cursor_orientation = PDO::FETCH_ORI_NEXT, $cursor_offset=NULL)
{
if ( ! is_null($statement))
{
$this->statement = $statement;
}
// If there is no result, continue
if (empty($this->result))
{

View File

@ -94,7 +94,7 @@ class Firebird_SQL implements iDB_SQL {
public function table_list()
{
return <<<SQL
SELECT "RDB\$RELATION_NAME"
SELECT TRIM("RDB\$RELATION_NAME")
FROM "RDB\$RELATIONS"
WHERE "RDB\$SYSTEM_FLAG"=0
ORDER BY "RDB\$RELATION_NAME" ASC
@ -111,7 +111,7 @@ SQL;
public function system_table_list()
{
return <<<SQL
SELECT "RDB\$RELATION_NAME"
SELECT TRIM("RDB\$RELATION_NAME")
FROM "RDB\$RELATIONS"
WHERE "RDB\$SYSTEM_FLAG"=1
ORDER BY "RDB\$RELATION_NAME" ASC

View File

@ -39,6 +39,23 @@ class FirebirdTest extends DBTest {
// --------------------------------------------------------------------------
/**
* coverage for methods in result class that aren't implemented
*/
public function TestNullResultMethods()
{
$obj = $this->db->query('SELECT "id" FROM "create_test"');
$val = "bar";
$this->assertNull($obj->bindColumn('foo', $val));
$this->assertNull($obj->bindParam('foo', $val));
$this->assertNull($obj->bindValue('foo', $val));
}
// --------------------------------------------------------------------------
public function TestExists()
{
$this->assertTrue(function_exists('ibase_connect'));
@ -88,30 +105,34 @@ class FirebirdTest extends DBTest {
$this->assertTrue($res);
}
// --------------------------------------------------------------------------
// ! Create / Delete Tables
// --------------------------------------------------------------------------
/*public function TestCreateTable()
public function TestCreateTable()
{
//Attempt to create the table
$sql = $this->db->util->create_table('create_test', array(
$sql = $this->db->util->create_table('create_delete', array(
'id' => 'SMALLINT',
'key' => 'VARCHAR(64)',
'val' => 'BLOB SUB_TYPE TEXT'
));
$this->db->query($sql);
//This test fails for an unknown reason, when clearly the table exists
//Reset
$this->tearDown();
$this->setUp();
//Check
$this->assertTrue(in_array('create_delete', $this->db->get_tables()));
}
public function TestDeleteTable()
{
//Attempt to delete the table
$sql = $this->db->util->delete_table('create_delete');
$this->db->query($sql);
//Check
$table_exists = (bool)in_array('create_test', $this->tables);
//echo "create_test exists :".(int)$table_exists.'<br />';
$this->assertTrue($table_exists);
}*/
$table_exists = in_array('create_delete', $this->db->get_tables());
$this->assertFalse($table_exists);
}
// --------------------------------------------------------------------------
@ -177,27 +198,30 @@ SQL;
// --------------------------------------------------------------------------
public function TestPrepareQuery()
public function TestFetch()
{
$this->assertFalse($this->db->prepare_query('', array()));
$res = $this->db->query('SELECT "key","val" FROM "create_test"');
// Object
$fetchObj = $res->fetchObject();
$this->assertIsA($fetchObj, 'stdClass');
// Associative array
$fetchAssoc = $res->fetch(PDO::FETCH_ASSOC);
$this->assertTrue(array_key_exists('key', $fetchAssoc));
// Numeric array
$res2 = $this->db->query('SELECT "id","key","val" FROM "create_test"');
$fetch = $res2->fetch(PDO::FETCH_NUM);
$this->assertTrue(is_array($fetch));
}
// --------------------------------------------------------------------------
/*public function TestDeleteTable()
public function TestPrepareQuery()
{
//Attempt to delete the table
$sql = $this->db->util->delete_table('create_test');
$this->db->query($sql);
//Reset
$this->tearDown();
$this->setUp();
//Check
$table_exists = in_array('create_test', $this->tables);
$this->assertFalse($table_exists);
}*/
$this->assertFalse($this->db->prepare_query('', array()));
}
// --------------------------------------------------------------------------