diff --git a/sys/db/db_pdo.php b/sys/db/db_pdo.php index bb4fc64..027ce04 100644 --- a/sys/db/db_pdo.php +++ b/sys/db/db_pdo.php @@ -219,6 +219,13 @@ abstract class DB_PDO extends PDO { */ abstract public function get_views(); + /** + * Return list of sequences for the current database, if they exist + * + * @return array + */ + abstract public function get_sequences(); + /** * Empty the passed table * diff --git a/sys/db/drivers/firebird.php b/sys/db/drivers/firebird.php index e1ada08..3070a1a 100644 --- a/sys/db/drivers/firebird.php +++ b/sys/db/drivers/firebird.php @@ -164,6 +164,19 @@ SQL; // -------------------------------------------------------------------------- + /** + * Get list of sequences for the current database + * + * @return array + */ + public function get_sequences() + { + // @todo Implement + return FALSE; + } + + // -------------------------------------------------------------------------- + /** * Not applicable to firebird * @@ -519,7 +532,8 @@ class Firebird_Result { */ public function rowCount($statement="") { - return fbird_affected_rows(); + $statement = $statement OR $this->statement; + return fbird_affected_rows($statement); } // -------------------------------------------------------------------------- diff --git a/sys/db/drivers/mysql.php b/sys/db/drivers/mysql.php index bead5e4..4cc5925 100644 --- a/sys/db/drivers/mysql.php +++ b/sys/db/drivers/mysql.php @@ -88,6 +88,18 @@ class MySQL extends DB_PDO { // -------------------------------------------------------------------------- + /** + * Not applicable to MySQL + * + * @return FALSE + */ + public function get_sequences() + { + return FALSE; + } + + // -------------------------------------------------------------------------- + /** * Returns system tables for the current database * diff --git a/sys/db/drivers/odbc.php b/sys/db/drivers/odbc.php index 674ac8f..a4a9087 100644 --- a/sys/db/drivers/odbc.php +++ b/sys/db/drivers/odbc.php @@ -68,6 +68,18 @@ class ODBC extends DB_PDO { // -------------------------------------------------------------------------- + /** + * Not applicable to ODBC + * + * @return FALSE + */ + public function get_sequences() + { + return FALSE; + } + + // -------------------------------------------------------------------------- + /** * List system tables for the current database/connection * diff --git a/sys/db/drivers/pgsql.php b/sys/db/drivers/pgsql.php index 52e60e9..fc0d0e7 100644 --- a/sys/db/drivers/pgsql.php +++ b/sys/db/drivers/pgsql.php @@ -152,7 +152,9 @@ SQL; { $sql = <<query($sql); @@ -163,6 +165,25 @@ SQL; // -------------------------------------------------------------------------- + /** + * Get a list of sequences for the current db + * + * @return array + */ + public function get_sequences() + { + $sql = <<query($sql); + return db_filter($res->fetchAll(PDO::FETCH_ASSOC), 'relname'); + } + + // -------------------------------------------------------------------------- + /** * Return the number of rows returned for a SELECT query * diff --git a/sys/db/drivers/sqlite.php b/sys/db/drivers/sqlite.php index 11931c1..7c6d3c4 100644 --- a/sys/db/drivers/sqlite.php +++ b/sys/db/drivers/sqlite.php @@ -107,6 +107,18 @@ SQL; // -------------------------------------------------------------------------- + /** + * Not applicable to SQlite + * + * @return FALSE + */ + public function get_sequences() + { + return FALSE; + } + + // -------------------------------------------------------------------------- + /** * List system tables for the current database *