diff --git a/drivers/firebird/firebird_util.php b/drivers/firebird/firebird_util.php index f41d5ce..27d967c 100644 --- a/drivers/firebird/firebird_util.php +++ b/drivers/firebird/firebird_util.php @@ -24,19 +24,6 @@ */ class Firebird_Util extends DB_Util { - /** - * Save a reference to the current connection object - * - * @param object $conn - * @return void - */ - public function __construct(&$conn) - { - parent::__construct($conn); - } - - // -------------------------------------------------------------------------- - /** * Convienience public function to generate sql for creating a db table * @@ -107,7 +94,7 @@ class Firebird_Util extends DB_Util { { return 'DROP TABLE "'.$name.'"'; } - + // -------------------------------------------------------------------------- /** @@ -156,7 +143,7 @@ class Firebird_Util extends DB_Util { $sql = 'SELECT * FROM "'.trim($t).'"'; $res = $this->query($sql); $obj_res = $res->fetchAll(PDO::FETCH_ASSOC); - + // Don't add to the file if the table is empty if (count($obj_res) < 1) continue; diff --git a/drivers/mysql/mysql_util.php b/drivers/mysql/mysql_util.php index dfe2d2b..5108a17 100644 --- a/drivers/mysql/mysql_util.php +++ b/drivers/mysql/mysql_util.php @@ -27,19 +27,6 @@ */ class MySQL_Util extends DB_Util { - /** - * Save a reference to the current connection object - * - * @param object $conn - * @return void - */ - public function __construct(&$conn) - { - parent::__construct($conn); - } - - // -------------------------------------------------------------------------- - /** * Convienience public function for creating a new MySQL table * @@ -120,7 +107,7 @@ class MySQL_Util extends DB_Util { { return "DROP TABLE `{$name}`"; } - + // -------------------------------------------------------------------------- /** @@ -131,10 +118,10 @@ class MySQL_Util extends DB_Util { public function backup_structure() { $string = array(); - + // Get databases $dbs = $this->get_dbs(); - + foreach($dbs as &$d) { // Skip built-in dbs @@ -142,17 +129,17 @@ class MySQL_Util extends DB_Util { { continue; } - + // Get the list of tables $tables = $this->driver_query("SHOW TABLES FROM `{$d}`", TRUE); - + foreach($tables as &$table) { $array = $this->driver_query("SHOW CREATE TABLE `{$d}`.`{$table}`", FALSE); $string[] = $array[0]['Create Table']; } } - + return implode("\n\n", $string); } @@ -167,35 +154,35 @@ class MySQL_Util extends DB_Util { public function backup_data($exclude=array()) { $tables = $this->get_tables(); - + // Filter out the tables you don't want if( ! empty($exclude)) { $tables = array_diff($tables, $exclude); } - + $output_sql = ''; - + // Select the rows from each Table foreach($tables as $t) { $sql = "SELECT * FROM `{$t}`"; $res = $this->query($sql); $rows = $res->fetchAll(PDO::FETCH_ASSOC); - + // Skip empty tables if (count($rows) < 1) continue; - + // Nab the column names by getting the keys of the first row $columns = @array_keys($rows[0]); $insert_rows = array(); - + // Create the insert statements foreach($rows as $row) { $row = array_values($row); - + // Workaround for Quercus foreach($row as &$r) { @@ -212,7 +199,7 @@ class MySQL_Util extends DB_Util { $output_sql .= "\n\n".implode("\n", $insert_rows)."\n"; } - + return $output_sql; } } diff --git a/drivers/pgsql/pgsql_util.php b/drivers/pgsql/pgsql_util.php index a2ebfdc..10b9aaa 100644 --- a/drivers/pgsql/pgsql_util.php +++ b/drivers/pgsql/pgsql_util.php @@ -23,17 +23,6 @@ */ class PgSQL_Util extends DB_Util { - /** - * Save a reference to the current connection object - * - * @param object $conn - * @return void - */ - public function __construct(&$conn) - { - parent::__construct($conn); - } - /** * Database-specific method to create a new table * @@ -128,7 +117,7 @@ class PgSQL_Util extends DB_Util { public function backup_data($exclude=array()) { $tables = $this->get_tables(); - + // Filter out the tables you don't want if( ! empty($exclude)) { @@ -143,10 +132,10 @@ class PgSQL_Util extends DB_Util { $sql = 'SELECT * FROM "'.trim($t).'"'; $res = $this->query($sql); $obj_res = $res->fetchAll(PDO::FETCH_ASSOC); - + // Don't add to the file if the table is empty if (count($obj_res) < 1) continue; - + $res = NULL; // Nab the column names by getting the keys of the first row diff --git a/drivers/sqlite/sqlite_util.php b/drivers/sqlite/sqlite_util.php index 067416f..9b9cf6e 100644 --- a/drivers/sqlite/sqlite_util.php +++ b/drivers/sqlite/sqlite_util.php @@ -23,19 +23,6 @@ */ class SQLite_Util extends DB_Util { - /** - * Save a reference to the current connection object - * - * @param object $conn - * @return void - */ - public function __construct(&$conn) - { - parent::__construct($conn); - } - - // -------------------------------------------------------------------------- - /** * Convenience public function to create a new table * @@ -105,7 +92,7 @@ class SQLite_Util extends DB_Util { { return 'DROP TABLE IF EXISTS "'.$name.'"'; } - + // -------------------------------------------------------------------------- /** @@ -139,7 +126,7 @@ class SQLite_Util extends DB_Util { $obj_res = $res->fetchAll(PDO::FETCH_ASSOC); unset($res); - + // If the row is empty, continue; if (empty($obj_res)) continue;