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 { 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 * 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.'"'; return 'DROP TABLE "'.$name.'"';
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -156,7 +143,7 @@ class Firebird_Util extends DB_Util {
$sql = 'SELECT * FROM "'.trim($t).'"'; $sql = 'SELECT * FROM "'.trim($t).'"';
$res = $this->query($sql); $res = $this->query($sql);
$obj_res = $res->fetchAll(PDO::FETCH_ASSOC); $obj_res = $res->fetchAll(PDO::FETCH_ASSOC);
// Don't add to the file if the table is empty // Don't add to the file if the table is empty
if (count($obj_res) < 1) continue; if (count($obj_res) < 1) continue;

View File

@ -27,19 +27,6 @@
*/ */
class MySQL_Util extends DB_Util { 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 * Convienience public function for creating a new MySQL table
* *
@ -120,7 +107,7 @@ class MySQL_Util extends DB_Util {
{ {
return "DROP TABLE `{$name}`"; return "DROP TABLE `{$name}`";
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -131,10 +118,10 @@ class MySQL_Util extends DB_Util {
public function backup_structure() public function backup_structure()
{ {
$string = array(); $string = array();
// Get databases // Get databases
$dbs = $this->get_dbs(); $dbs = $this->get_dbs();
foreach($dbs as &$d) foreach($dbs as &$d)
{ {
// Skip built-in dbs // Skip built-in dbs
@ -142,17 +129,17 @@ class MySQL_Util extends DB_Util {
{ {
continue; continue;
} }
// Get the list of tables // Get the list of tables
$tables = $this->driver_query("SHOW TABLES FROM `{$d}`", TRUE); $tables = $this->driver_query("SHOW TABLES FROM `{$d}`", TRUE);
foreach($tables as &$table) foreach($tables as &$table)
{ {
$array = $this->driver_query("SHOW CREATE TABLE `{$d}`.`{$table}`", FALSE); $array = $this->driver_query("SHOW CREATE TABLE `{$d}`.`{$table}`", FALSE);
$string[] = $array[0]['Create Table']; $string[] = $array[0]['Create Table'];
} }
} }
return implode("\n\n", $string); return implode("\n\n", $string);
} }
@ -167,35 +154,35 @@ class MySQL_Util extends DB_Util {
public function backup_data($exclude=array()) public function backup_data($exclude=array())
{ {
$tables = $this->get_tables(); $tables = $this->get_tables();
// Filter out the tables you don't want // Filter out the tables you don't want
if( ! empty($exclude)) if( ! empty($exclude))
{ {
$tables = array_diff($tables, $exclude); $tables = array_diff($tables, $exclude);
} }
$output_sql = ''; $output_sql = '';
// Select the rows from each Table // Select the rows from each Table
foreach($tables as $t) foreach($tables as $t)
{ {
$sql = "SELECT * FROM `{$t}`"; $sql = "SELECT * FROM `{$t}`";
$res = $this->query($sql); $res = $this->query($sql);
$rows = $res->fetchAll(PDO::FETCH_ASSOC); $rows = $res->fetchAll(PDO::FETCH_ASSOC);
// Skip empty tables // Skip empty tables
if (count($rows) < 1) continue; if (count($rows) < 1) continue;
// Nab the column names by getting the keys of the first row // Nab the column names by getting the keys of the first row
$columns = @array_keys($rows[0]); $columns = @array_keys($rows[0]);
$insert_rows = array(); $insert_rows = array();
// Create the insert statements // Create the insert statements
foreach($rows as $row) foreach($rows as $row)
{ {
$row = array_values($row); $row = array_values($row);
// Workaround for Quercus // Workaround for Quercus
foreach($row as &$r) foreach($row as &$r)
{ {
@ -212,7 +199,7 @@ class MySQL_Util extends DB_Util {
$output_sql .= "\n\n".implode("\n", $insert_rows)."\n"; $output_sql .= "\n\n".implode("\n", $insert_rows)."\n";
} }
return $output_sql; return $output_sql;
} }
} }

View File

@ -23,17 +23,6 @@
*/ */
class PgSQL_Util extends DB_Util { 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 * Database-specific method to create a new table
* *
@ -128,7 +117,7 @@ class PgSQL_Util extends DB_Util {
public function backup_data($exclude=array()) public function backup_data($exclude=array())
{ {
$tables = $this->get_tables(); $tables = $this->get_tables();
// Filter out the tables you don't want // Filter out the tables you don't want
if( ! empty($exclude)) if( ! empty($exclude))
{ {
@ -143,10 +132,10 @@ class PgSQL_Util extends DB_Util {
$sql = 'SELECT * FROM "'.trim($t).'"'; $sql = 'SELECT * FROM "'.trim($t).'"';
$res = $this->query($sql); $res = $this->query($sql);
$obj_res = $res->fetchAll(PDO::FETCH_ASSOC); $obj_res = $res->fetchAll(PDO::FETCH_ASSOC);
// Don't add to the file if the table is empty // Don't add to the file if the table is empty
if (count($obj_res) < 1) continue; if (count($obj_res) < 1) continue;
$res = NULL; $res = NULL;
// Nab the column names by getting the keys of the first row // Nab the column names by getting the keys of the first row

View File

@ -23,19 +23,6 @@
*/ */
class SQLite_Util extends DB_Util { 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 * Convenience public function to create a new table
* *
@ -105,7 +92,7 @@ class SQLite_Util extends DB_Util {
{ {
return 'DROP TABLE IF EXISTS "'.$name.'"'; return 'DROP TABLE IF EXISTS "'.$name.'"';
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -139,7 +126,7 @@ class SQLite_Util extends DB_Util {
$obj_res = $res->fetchAll(PDO::FETCH_ASSOC); $obj_res = $res->fetchAll(PDO::FETCH_ASSOC);
unset($res); unset($res);
// If the row is empty, continue; // If the row is empty, continue;
if (empty($obj_res)) continue; if (empty($obj_res)) continue;