Miscellaneous cleanup

This commit is contained in:
Timothy Warren 2012-02-23 08:59:27 -05:00
parent 4cb4f8d741
commit 060ebf6876
2 changed files with 17 additions and 23 deletions

View File

@ -19,6 +19,8 @@
*/ */
class SQLite extends DB_PDO { class SQLite extends DB_PDO {
protected $statement;
/** /**
* Open SQLite Database * Open SQLite Database
* *
@ -42,11 +44,11 @@ class SQLite extends DB_PDO {
{ {
// SQLite has a TRUNCATE optimization, // SQLite has a TRUNCATE optimization,
// but no support for the actual command. // but no support for the actual command.
$sql = <<<SQL $sql = 'DELETE FROM :table';
DELETE FROM "{$table}"
SQL;
$this->query($sql); $this->prepare_query($sql, array(
':table' => $table
));
} }
/** /**
@ -58,7 +60,9 @@ SQL;
{ {
$tables = array(); $tables = array();
$sql = <<<SQL $sql = <<<SQL
SELECT "name", "sql" FROM "sqlite_master" WHERE "type"='table' SELECT "name", "sql"
FROM "sqlite_master"
WHERE "type"='table'
SQL; SQL;
$res = $this->query($sql); $res = $this->query($sql);
@ -92,9 +96,7 @@ SQL;
*/ */
public function load_database($db, $name) public function load_database($db, $name)
{ {
$sql = <<<SQL $sql = "ATTACH DATABASE '{$db}' AS \"{$name}\"";
ATTACH DATABASE '{$db}' AS "{$name}"
SQL;
$this->query($sql); $this->query($sql);
} }
@ -105,10 +107,11 @@ SQL;
*/ */
public function unload_database($name) public function unload_database($name)
{ {
$sql = <<<SQL $sql = 'DETACH DATABASE ":name"';
DETACH DATABASE "{$name}"
SQL; $this->prepare_query($sql, array(
$this->query($sql); ':name' => $name,
));
} }
/** /**
@ -118,7 +121,7 @@ SQL;
*/ */
public function num_rows() public function num_rows()
{ {
return (isset($this->statement)) ? $this->statment->rowCount : FALSE; return (isset($this->statement)) ? $this->statement->rowCount : FALSE;
} }
} }
//End of sqlite.php //End of sqlite.php

View File

@ -260,6 +260,7 @@ class Main extends GtkWindow {
} }
else else
{ {
// Load an empty image if the db image doesn't exist
$img = new GtkImage(); $img = new GtkImage();
$cell->set_property('pixbuf', $img->get_pixbuf()); $cell->set_property('pixbuf', $img->get_pixbuf());
} }
@ -280,16 +281,6 @@ class Main extends GtkWindow {
$cell->set_property('text', $info->name); $cell->set_property('text', $info->name);
} }
/**
* Redraws the data area based on the which connection is selected
*
* @param $selection
*/
private function _render_selected($selection)
{
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**