diff --git a/sys/db/drivers/firebird.php b/sys/db/drivers/firebird.php index 56ad995..285c1cc 100644 --- a/sys/db/drivers/firebird.php +++ b/sys/db/drivers/firebird.php @@ -609,4 +609,4 @@ class Firebird_Result { return array(0, $code, $msg); } } -// End of firebird-ibase.php \ No newline at end of file +// End of firebird.php \ No newline at end of file diff --git a/sys/db/drivers/pgsql.php b/sys/db/drivers/pgsql.php index 011d6ca..681732f 100644 --- a/sys/db/drivers/pgsql.php +++ b/sys/db/drivers/pgsql.php @@ -205,6 +205,8 @@ SQL; ('pg_catalog', 'information_schema') AND "type_udt_name" != 'trigger'; SQL; + + $res = $this->query($sql); return db_filter($res->fetchAll(PDO::FETCH_ASSOC), 'routine_name'); } @@ -219,7 +221,7 @@ SQL; public function get_triggers() { $sql = <<add_tab($tab_name, $tab); } + + return; + } + + // -------------------------------------------------------------------------- + + /** + * Add a multidimensional array to a tab + * + * @param object $conn + * @param string $tab_name + * @param string $method + * @return void + */ + private static function _add_row_tab(&$conn, $tab_name, $method) + { + $tab_data = call_user_func_array(array($conn, $method), array()); + + if ( ! empty($tab_data)) + { + $tab_model = new StdClass(); + + $cols = array_keys($tab_data[0]); + + // Add columns to model + $model_args = array_fill(0, count($cols), Gobject::TYPE_PHP_VALUE); + $eval_string = '$tab_model = new GTKTreeStore('.implode(',', $model_args).');'; + + // Shame, shame, but how else? + eval($eval_string); + $tab= new Data_Grid($tab_model); + + // Set the data in the model + for($i=0, $c = count($tab_data); $i < $c; $i++) + { + // Add a row + $row = $tab_model->insert($i); + + $j = -1; + $vals = array($row); + foreach($tab_data[$i] as $v) + { + $vals[] = ++$j; + $vals[] = $v; + } + + call_user_func_array(array($tab_model, 'set'), $vals); + } + + // Add columns to view + foreach($cols as $i => $c) + { + $renderer = new GtkCellRendererText(); + $tab->insert_column_with_data_func($i, $c, $renderer, array(self::$instance, 'add_data_col'), $i); + } + + self::$instance->add_tab($tab_name, $tab); + } + + return; } } // End of db_tabs.php