Normalize database table listing
This commit is contained in:
parent
59e167c064
commit
fdc37f8819
@ -82,8 +82,8 @@ SQL;
|
|||||||
{
|
{
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT "tablename" FROM "pg_tables"
|
SELECT "tablename" FROM "pg_tables"
|
||||||
WHERE "tablename" NOT LIKE 'pg\_%'
|
WHERE "tablename" NOT LIKE 'pg_%'
|
||||||
AND "tablename" NOT LIKE 'sql\%'
|
AND "tablename" NOT LIKE 'sql_%'
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$res = $this->query($sql);
|
$res = $this->query($sql);
|
||||||
|
@ -74,7 +74,7 @@ SQL;
|
|||||||
|
|
||||||
foreach($result as $r)
|
foreach($result as $r)
|
||||||
{
|
{
|
||||||
$tables[$r['name']] = $r['sql'];
|
$tables[] = $r['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tables;
|
return $tables;
|
||||||
|
@ -80,7 +80,7 @@ class Query_Builder {
|
|||||||
switch($dbtype)
|
switch($dbtype)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
$dsn = "host={$params->host};dbname={$params->database}";
|
$dsn = "host={$params->host};dbname={$params->conn_db}";
|
||||||
|
|
||||||
if ( ! empty($params->port))
|
if ( ! empty($params->port))
|
||||||
{
|
{
|
||||||
|
@ -116,6 +116,10 @@ class Connection_Sidebar extends GtkVBox {
|
|||||||
// Label column
|
// Label column
|
||||||
$cell_renderer = new GtkCellRendererText();
|
$cell_renderer = new GtkCellRendererText();
|
||||||
$this->treeview->insert_column_with_data_func(1, 'Connection name', $cell_renderer, array($this, 'set_label'));
|
$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
|
* Returns window for creating a new database connection
|
||||||
*
|
*
|
||||||
|
@ -89,7 +89,8 @@ class SQLiteTest extends UnitTestCase {
|
|||||||
|
|
||||||
//Check
|
//Check
|
||||||
$dbs = $this->db->get_tables();
|
$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()
|
function TestTruncate()
|
||||||
|
Loading…
Reference in New Issue
Block a user