Remove pointless constructor over-riding

This commit is contained in:
Timothy Warren 2014-03-20 11:20:30 -04:00
parent 7a78dc8b79
commit af73f80558
4 changed files with 21 additions and 71 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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

View File

@ -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;