Normalize database table listing
This commit is contained in:
parent
59e167c064
commit
fdc37f8819
@ -82,8 +82,8 @@ SQL;
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT "tablename" FROM "pg_tables"
|
||||
WHERE "tablename" NOT LIKE 'pg\_%'
|
||||
AND "tablename" NOT LIKE 'sql\%'
|
||||
WHERE "tablename" NOT LIKE 'pg_%'
|
||||
AND "tablename" NOT LIKE 'sql_%'
|
||||
SQL;
|
||||
|
||||
$res = $this->query($sql);
|
||||
|
@ -74,7 +74,7 @@ SQL;
|
||||
|
||||
foreach($result as $r)
|
||||
{
|
||||
$tables[$r['name']] = $r['sql'];
|
||||
$tables[] = $r['name'];
|
||||
}
|
||||
|
||||
return $tables;
|
||||
|
@ -80,7 +80,7 @@ class Query_Builder {
|
||||
switch($dbtype)
|
||||
{
|
||||
default:
|
||||
$dsn = "host={$params->host};dbname={$params->database}";
|
||||
$dsn = "host={$params->host};dbname={$params->conn_db}";
|
||||
|
||||
if ( ! empty($params->port))
|
||||
{
|
||||
|
@ -116,6 +116,10 @@ class Connection_Sidebar extends GtkVBox {
|
||||
// Label column
|
||||
$cell_renderer = new GtkCellRendererText();
|
||||
$this->treeview->insert_column_with_data_func(1, 'Connection name', $cell_renderer, array($this, 'set_label'));
|
||||
|
||||
// Status column
|
||||
$cell_renderer = new GtkCellRendererPixbuf();
|
||||
$this->treeview->insert_column_with_data_func(2, 'Status', $cell_renderer, array($this, 'set_status_icon'));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -166,6 +170,21 @@ class Connection_Sidebar extends GtkVBox {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets the status icon of the current db connection
|
||||
*
|
||||
* @param GtkTreeViewColumn $col
|
||||
* @param GtkCellRenderer $cell
|
||||
* @param GtkTreeModel $model
|
||||
* @param GtkTreeIter $iter
|
||||
*/
|
||||
public function set_status_icon($col, $cell, $model, $iter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns window for creating a new database connection
|
||||
*
|
||||
|
@ -89,7 +89,8 @@ class SQLiteTest extends UnitTestCase {
|
||||
|
||||
//Check
|
||||
$dbs = $this->db->get_tables();
|
||||
$this->assertEqual($dbs['create_test'], 'CREATE TABLE "create_test" (id INTEGER PRIMARY KEY, key TEXT , val TEXT )');
|
||||
|
||||
$this->assertTrue(in_array('create_test', $dbs));
|
||||
}
|
||||
|
||||
function TestTruncate()
|
||||
|
Reference in New Issue
Block a user