Improve 'type_list' methods

This commit is contained in:
Timothy Warren 2012-05-08 15:37:36 -04:00
parent db1490c016
commit eb5d30ab21
5 changed files with 17 additions and 3 deletions

View File

@ -116,7 +116,7 @@ class Query_Builder {
* *
* @var DB_PDO * @var DB_PDO
*/ */
private $sql; public $sql;
/** /**
* Query component order mapping * Query component order mapping

View File

@ -248,7 +248,9 @@ SQL;
public function type_list() public function type_list()
{ {
return <<<SQL return <<<SQL
SELECT "RDB\$FIELD_TYPE" FROM "RDB\$FIELDS" SELECT "RDB\$TYPE_NAME", "RDB\$FIELD_NAME" FROM "RDB\$TYPES"
WHERE "RDB\$FIELD_NAME" IN ('RDB\$FIELD_TYPE', 'RDB\$FIELD_SUB_TYPE')
ORDER BY "RDB\$FIELD_NAME" DESC, "RDB\$TYPE_NAME" ASC
SQL; SQL;
} }

View File

@ -222,7 +222,7 @@ SQL;
return <<<SQL return <<<SQL
SELECT "typname" FROM "pg_catalog"."pg_type" SELECT "typname" FROM "pg_catalog"."pg_type"
WHERE "typname" !~ '^pg_|_' WHERE "typname" !~ '^pg_|_'
AND "typtype" != 'c' AND "typtype" = 'b'
ORDER BY "typname" ORDER BY "typname"
SQL; SQL;
} }

View File

@ -35,4 +35,16 @@ class FirebirdQBTest extends QBTest {
// echo '<hr /> Firebird Queries <hr />'; // echo '<hr /> Firebird Queries <hr />';
} }
public function TestTypeList()
{
$sql = $this->db->sql->type_list();
$query = $this->db->query($sql);
$this->assertIsA($query, 'PDOStatement');
$res = $query->fetchAll(PDO::FETCH_ASSOC);
$this->assertTrue(is_array($res));
}
} }

Binary file not shown.