diff --git a/classes/db_pdo.php b/classes/db_pdo.php index 3c4f240..6e58163 100644 --- a/classes/db_pdo.php +++ b/classes/db_pdo.php @@ -171,9 +171,9 @@ abstract class DB_PDO extends PDO { */ public function get_last_error() { - $info = $this->errorInfo(); + list($i1, $i2, $i3) = $this->errorInfo(); - echo "Error:
{$info[0]}:{$info[1]}\n{$info[2]}
"; + echo "Error:
{$i1}:{$i2}\n{$i3}
"; } // -------------------------------------------------------------------------- diff --git a/classes/db_util.php b/classes/db_util.php index d6503a4..34993ef 100644 --- a/classes/db_util.php +++ b/classes/db_util.php @@ -27,6 +27,24 @@ abstract class DB_Util { $this->conn =& $conn; } + // -------------------------------------------------------------------------- + + /** + * Enable calling driver methods + * + * @param string $method + * @param array $args + */ + public function __call($method, $args) + { + if (method_exists($this->conn, $method)) + { + return call_user_func_array(array($this->conn, $method), $args); + } + + return NULL; + } + // -------------------------------------------------------------------------- // ! Abstract Methods // -------------------------------------------------------------------------- diff --git a/drivers/firebird/firebird_util.php b/drivers/firebird/firebird_util.php index 804e749..a0dc334 100644 --- a/drivers/firebird/firebird_util.php +++ b/drivers/firebird/firebird_util.php @@ -140,9 +140,12 @@ class Firebird_Util extends DB_Util { { $sql = 'SELECT * FROM "'.trim($t).'"'; $res = $this->query($sql); - $obj_res = $this->fetchAll(PDO::FETCH_ASSOC); - - unset($res); + $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 $columns = @array_keys($obj_res[0]); @@ -163,12 +166,12 @@ class Firebird_Util extends DB_Util { $row_string = 'INSERT INTO "'.trim($t).'" ("'.implode('","', $columns).'") VALUES ('.implode(',', $row).');'; - unset($row); + $row = NULL; $insert_rows[] = $row_string; } - unset($obj_res); + $obj_res = NULL; $output_sql .= "\n\nSET TRANSACTION;\n".implode("\n", $insert_rows)."\nCOMMIT;"; } diff --git a/drivers/mysql/mysql_util.php b/drivers/mysql/mysql_util.php index 283ae8c..4c197b1 100644 --- a/drivers/mysql/mysql_util.php +++ b/drivers/mysql/mysql_util.php @@ -121,10 +121,13 @@ class MySQL_Util extends DB_Util { /** * Create an SQL backup file for the current database's data * + * @param array $exclude * @return string */ - public function backup_data() + public function backup_data($exclude=array()) { + $tables = $this->get_tables(); + // @todo Implement Backup function return ''; } diff --git a/tests/core/db_test.php b/tests/core/db_test.php index 3e698c2..22b0587 100644 --- a/tests/core/db_test.php +++ b/tests/core/db_test.php @@ -48,5 +48,10 @@ abstract class DBTest extends UnitTestCase { $res = $this->db->beginTransaction(); $this->assertTrue($res); } + + function TestBackupData() + { + $this->assertTrue(is_string($this->db->util->backup_data())); + } } // End of db_test.php \ No newline at end of file diff --git a/tests/databases/firebird/firebird.php b/tests/databases/firebird/firebird.php index abb48f6..9252908 100644 --- a/tests/databases/firebird/firebird.php +++ b/tests/databases/firebird/firebird.php @@ -187,5 +187,4 @@ SQL; { $this->assertTrue(is_array($this->db->get_triggers())); } - } \ No newline at end of file diff --git a/tests/db_files/FB_TEST_DB.FDB b/tests/db_files/FB_TEST_DB.FDB index a7da6af..83122ed 100644 Binary files a/tests/db_files/FB_TEST_DB.FDB and b/tests/db_files/FB_TEST_DB.FDB differ