From 3bb8be3dbae9dcddd9acd6cd2cce26a81252a1f1 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 6 Feb 2012 17:29:13 -0500 Subject: [PATCH] Removed duplicate db_pdo class --- src/common/db_pdo.php | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/common/db_pdo.php b/src/common/db_pdo.php index 484ae49..816f1f7 100644 --- a/src/common/db_pdo.php +++ b/src/common/db_pdo.php @@ -17,7 +17,7 @@ * * Extends PDO to simplify cross-database issues */ -class DB_PDO extends PDO { +abstract class DB_PDO extends PDO { protected $statement; @@ -97,7 +97,7 @@ class DB_PDO extends PDO { * @param PDOStatement $statement * @return int */ - function get_rows_changed($statement) + function affected_rows($statement) { // Execute the query $statement->execute(); @@ -106,6 +106,41 @@ class DB_PDO extends PDO { return $statement->rowCount(); } -} + // ------------------------------------------------------------------------- + /** + * Abstract functions to override in child classes + */ + + /** + * Return list of tables for the current database + * + * @return array + */ + abstract function get_tables(); + + /** + * Empty the passed table + * + * @param string $table + * + * @return void + */ + abstract function truncate($table); + + /** + * Return the number of rows for the last SELECT query + * + * @return int + */ + abstract function num_rows(); + + /** + * Return the number of rows affected by the last query + * + * @return int + */ + abstract function affected_rows(); + +} // End of db_pdo.php \ No newline at end of file