set tablist [list Tables Queries Views Sequences Functions Reports Scripts]
set tablist [list Tables Queries Views Sequences Functions Reports Scripts]
set activetab {}
set activetab {}
set dirty false
set mw(dirtyrec) 0
set fldval ""
set mw(id_edited){}
trace variable fldval w mark_dirty
catch {unset qlvar}
catch {unset qlvar}
set qlvar(yoffs) 360
set qlvar(yoffs) 360
set qlvar(xoffs) 50
set qlvar(xoffs) 50
...
@@ -180,24 +181,40 @@ if {$activetab=="Tables"} {
...
@@ -180,24 +181,40 @@ if {$activetab=="Tables"} {
}
}
proc cmd_Information {}{
proc cmd_Information {}{
global dbc tiw activetab
global dbc tiw activetab indexlist
if {$dbc==""} return;
if {$dbc==""} return;
if {$activetab!="Tables"} return;
if {$activetab!="Tables"} return;
set tiw(tablename)[get_dwlb_Selection]
set tiw(tablename)[get_dwlb_Selection]
if {$tiw(tablename)==""} return;
if {$tiw(tablename)==""} return;
Window show .tiw
Window show .tiw
.tiw.lb delete 0 end
.tiw.lb delete 0 end
pg_select $dbc "select attnum,attname,typname,attlen,usename from pg_class,pg_user,pg_attribute,pg_type where (pg_class.relname='$tiw(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (pg_class.relowner=pg_user.usesysid) and (pg_attribute.atttypid=pg_type.oid) and (attnum>0) order by attnum" rec {
.tiw.ilb delete 0 end
set tiw(isunique){}
set tiw(isclustered){}
set tiw(indexfields){}
pg_select $dbc "select attnum,attname,typname,attlen,usename,pg_class.oid from pg_class,pg_user,pg_attribute,pg_type where (pg_class.relname='$tiw(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (pg_class.relowner=pg_user.usesysid) and (pg_attribute.atttypid=pg_type.oid) order by attnum" rec {
set fsize $rec(attlen)
set fsize $rec(attlen)
set ftype $rec(typname)
set ftype $rec(typname)
if {$ftype=="varchar"}{
if {$ftype=="varchar"}{
incr fsize -4
incr fsize -4
}
}
if {$ftype=="bpchar"}{
incr fsize -4
}
if {$ftype=="text"}{
if {$ftype=="text"}{
set fsize ""
set fsize ""
}
}
.tiw.lb insert end [format "%-32s %-14s %-4s" $rec(attname) $ftype $fsize]
if {$rec(attnum)>0}{.tiw.lb insert end [format "%-32s %-14s %-4s" $rec(attname) $ftype $fsize]}
set tiw(owner) $rec(usename)
set tiw(owner) $rec(usename)
set tiw(tableoid) $rec(oid)
set tiw(f$rec(attnum)) $rec(attname)
}
set tiw(indexlist){}
pg_select $dbc "select oid,indexrelid from pg_index where (pg_class.relname='$tiw(tablename)') and (pg_class.oid=pg_index.indrelid)" rec {
lappend tiw(indexlist) $rec(oid)
pg_select $dbc "select relname from pg_class where oid=$rec(indexrelid)" rec1 {
checkbutton $base.alcb -borderwidth 1 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -text {Auto-load the last opened database at startup} -variable pref(autoload)
checkbutton $base.alcb -borderwidth 1 -text {Auto-load the last opened database at startup} -variable pref(autoload)