return true;
}
- function initParams($tables=null) {
-
- if ($tables === null) $tables = $this->tables();
-
- #$_REQUEST['table'] = @$_REQUEST['table'] ? preg_replace('/^([\w\d_-]+).*$/','\1',$_REQUEST['table']) : $tables[0];
- $_REQUEST['table'] = @$_REQUEST['table'] ? $_REQUEST['table'] : ($tables === null ? '' : $tables[0]);
- if (@$_REQUEST['sql']) $_REQUEST['table'] = $_REQUEST['sql'];
-
- $_REQUEST['limit'] = @$_REQUEST['limit']
- ? preg_replace('/^(\d+)(,\d+).*$/','\1\2',$_REQUEST['limit'])
- : ( preg_match('/^(curl|lynx|lwp)/',@$_SERVER['HTTP_USER_AGENT']) ? 999999 : 50 )
- ;
-
- $_REQUEST['format'] = @$_REQUEST['format'] ? $_REQUEST['format'] : 'table';
-
- #$_REQUEST['op'] = strtoupper(@$_REQUEST['op']) == 'AND' ? 'AND' : 'OR';
- $_REQUEST['op'] = strtoupper(@$_REQUEST['op']) == 'OR' ? 'OR' : 'AND';
-
- }
-
function html_menu() {
$r = '';
;
foreach ($this->tables() as $table) {
- #$count = $table->rowCount();
$r .= '<option value="'.$table.'"';
- #$pretty = prettyText($table);
$r .= $table == $this->p('table') ? ' selected="selected"' : '';
$r .= '>'.prettyText($table).'</option>'.PHP_EOL;
}
}
+ /*
+ * Function: pset
+ * Set a value for param, deleteit if null
+ */
function pset($name,$value) {
if ($value === null) {
unset ($_REQUEST[$name]);
pg_catalog.format_type(a.atttypid, a.atttypmod) AS type,
CASE a.attnotnull WHEN 't' then 1 ELSE 0 END AS notnull,
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) AS default,
-(SELECT 1 FROM pg_index i WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) AND i.indrelid = 'tickets'::regclass AND i.indisprimary) as pk
-FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname='tickets' AND pg_catalog.pg_table_is_visible(c.oid) ) AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum";
+(SELECT 1 FROM pg_index i WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) AND i.indrelid = '$this->name'::regclass AND i.indisprimary) as pk
+FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname='$this->name' AND pg_catalog.pg_table_is_visible(c.oid) ) AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum";
} elseif ($this->db->type == 'mysql') {
$sql = "SHOW COLUMNS FROM `$this->name`";