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 * @param mixed $offset
* @return mixed * @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 there is no result, continue
if (empty($this->result)) if (empty($this->result))
{ {
@ -287,4 +282,4 @@ class Firebird_Result extends PDOStatement {
return array(0, $code, $msg); return array(0, $code, $msg);
} }
} }
// End of firebird_result.php // End of firebird_result.php

View File

@ -94,7 +94,7 @@ class Firebird_SQL implements iDB_SQL {
public function table_list() public function table_list()
{ {
return <<<SQL return <<<SQL
SELECT "RDB\$RELATION_NAME" SELECT TRIM("RDB\$RELATION_NAME")
FROM "RDB\$RELATIONS" FROM "RDB\$RELATIONS"
WHERE "RDB\$SYSTEM_FLAG"=0 WHERE "RDB\$SYSTEM_FLAG"=0
ORDER BY "RDB\$RELATION_NAME" ASC ORDER BY "RDB\$RELATION_NAME" ASC
@ -111,7 +111,7 @@ SQL;
public function system_table_list() public function system_table_list()
{ {
return <<<SQL return <<<SQL
SELECT "RDB\$RELATION_NAME" SELECT TRIM("RDB\$RELATION_NAME")
FROM "RDB\$RELATIONS" FROM "RDB\$RELATIONS"
WHERE "RDB\$SYSTEM_FLAG"=1 WHERE "RDB\$SYSTEM_FLAG"=1
ORDER BY "RDB\$RELATION_NAME" ASC 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() public function TestExists()
{ {
$this->assertTrue(function_exists('ibase_connect')); $this->assertTrue(function_exists('ibase_connect'));
@ -88,30 +105,34 @@ class FirebirdTest extends DBTest {
$this->assertTrue($res); $this->assertTrue($res);
} }
// --------------------------------------------------------------------------
// ! Create / Delete Tables
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*public function TestCreateTable() public function TestCreateTable()
{ {
//Attempt to create the table //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', 'id' => 'SMALLINT',
'key' => 'VARCHAR(64)', 'key' => 'VARCHAR(64)',
'val' => 'BLOB SUB_TYPE TEXT' 'val' => 'BLOB SUB_TYPE TEXT'
)); ));
$this->db->query($sql); $this->db->query($sql);
//This test fails for an unknown reason, when clearly the table exists //Check
//Reset $this->assertTrue(in_array('create_delete', $this->db->get_tables()));
$this->tearDown(); }
$this->setUp();
public function TestDeleteTable()
{
//Attempt to delete the table
$sql = $this->db->util->delete_table('create_delete');
$this->db->query($sql);
//Check //Check
$table_exists = (bool)in_array('create_test', $this->tables); $table_exists = in_array('create_delete', $this->db->get_tables());
$this->assertFalse($table_exists);
//echo "create_test exists :".(int)$table_exists.'<br />'; }
$this->assertTrue($table_exists);
}*/
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -177,28 +198,31 @@ SQL;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
public function TestFetch()
{
$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 TestPrepareQuery() public function TestPrepareQuery()
{ {
$this->assertFalse($this->db->prepare_query('', array())); $this->assertFalse($this->db->prepare_query('', array()));
} }
// --------------------------------------------------------------------------
/*public function TestDeleteTable()
{
//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);
}*/
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
public function TestGetSequences() public function TestGetSequences()