Db driver improvements

This commit is contained in:
Timothy Warren 2012-02-13 10:53:12 -05:00
parent 103d665e57
commit 3d8382149e
2 changed files with 11 additions and 7 deletions

View File

@ -84,11 +84,13 @@ abstract class DB_PDO extends PDO {
*/
function get_query_data($statement)
{
$this->statement = $statement;
// Execute the query
$statement->execute();
$this->statement->execute();
// Return the data array fetched
return $statement->fetchAll(PDO::FETCH_ASSOC);
return $this->statement->fetchAll(PDO::FETCH_ASSOC);
}
// -------------------------------------------------------------------------
@ -101,11 +103,13 @@ abstract class DB_PDO extends PDO {
*/
function affected_rows($statement)
{
$this->statement = $statement;
// Execute the query
$statement->execute();
$this->statement->execute();
// Return number of rows affected
return $statement->rowCount();
return $this->statement->rowCount;
}
// -------------------------------------------------------------------------

View File

@ -114,8 +114,8 @@ class pgSQL extends DB_PDO {
WHERE "schemaname" NOT LIKE \'pg\_%\'';
}
$sql = 'SELECT DISTINCT "schemaname" FROM pg_tables
WHERE "schemaname" NOT LIKE \'pg\_%\'';
$sql = 'SELECT "nspname" FROM pg_namespace
WHERE "nspname" NOT LIKE \'pg\_%\'';
$res = $this->query($sql);
$schemas = $res->fetchAll(PDO::FETCH_ASSOC);
@ -147,7 +147,7 @@ class pgSQL extends DB_PDO {
*/
function num_rows()
{
// TODO: Implement
return (isset($this->statement)) ? $this->statement->rowCount : FALSE;
}
}
//End of pgsql.php