if {(($fldtype=="varchar")||($fldtype=="char"))&&($fldsize=="")}{
if {($ntw(fldtype)=="varchar")&&($ntw(fldsize)=="")}{
focus .nt.e3
show_error "You must specify field size!"
return
}
if {$fldsize==""} then {set sup ""} else {set sup "($fldsize)"}
if {[regexp $fldtype "varchar2char4char8char16textdatetime"]}{set supc "'"} else {set supc ""}
if {$defaultval==""} then {set sup2 ""} else {set sup2 " DEFAULT $supc$defaultval$supc"}
if {$ntw(fldsize)==""} then {set sup ""} else {set sup "($ntw(fldsize))"}
if {[regexp $ntw(fldtype)"varchartextdatetime"]}{set supc "'"} else {set supc ""}
if {$ntw(defaultval)==""} then {set sup2 ""} else {set sup2 " DEFAULT $supc$ntw(defaultval)$supc"}
# Checking for field name collision
set inspos end
for {set i 0}{$i<[.nt.lb size]}{incr i}{
set linie [.nt.lb get $i]
if {$fldname==[lindex [split $linie] 0]}{
if {[tk_messageBox -title Warning -message "There is another field with the same name!\n\nReplace it ?" -type yesno -default yes]=="no"} return
if {$ntw(fldname)==[string trim [string range $linie 2 33]]}{
if {[tk_messageBox -title Warning -message "There is another field with the same name: \"$ntw(fldname)\"!\n\nReplace it ?" -type yesno -default yes]=="no"} return
global dbc seq_name seq_inc seq_start seq_minval seq_maxval
Window show .sqf
set flag 1
pg_select $dbc "select * from $objname" rec {
wpg_select $dbc "select * from $objname" rec {
set flag 0
set seq_name $objname
set seq_inc $rec(increment_by)
...
...
@@ -1687,11 +1748,11 @@ global qlvar dbc
if {$qlvar(newtablename)==""} return
set fldlist {}
cursor_watch .ql
pg_select $dbc "select attnum,attname from pg_class,pg_attribute where (pg_class.relname='$qlvar(newtablename)') and (pg_class.oid=pg_attribute.attrelid) and (attnum>0) order by attnum" rec {
cursor_clock
wpg_select $dbc "select attnum,attname from pg_class,pg_attribute where (pg_class.relname='$qlvar(newtablename)') and (pg_class.oid=pg_attribute.attrelid) and (attnum>0) order by attnum" rec {
lappend fldlist $rec(attname)
}
cursor_arrow .ql
cursor_normal
if {$fldlist==""}{
show_error "Table $qlvar(newtablename) not found!"
pg_select $dbc "select attnum,attname from pg_class,pg_attribute where (pg_class.relname='$rbvar(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (attnum>0) order by attnum" rec {
#cursor_clock
wpg_select $dbc "select attnum,attname from pg_class,pg_attribute where (pg_class.relname='$rbvar(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (attnum>0) order by attnum" rec {
.rb.lb insert end $rec(attname)
}
#cursor_arrow .ql
#cursor_normal
}
proc {rb_has_tag}{id tg}{
...
...
@@ -2365,7 +2426,7 @@ rb_draw_regions
proc {rb_load_report}{}{
global rbvar dbc
.rb.c delete all
pg_select $dbc "select * from pga_reports where reportname='$rbvar(reportname)'" rcd {
wpg_select $dbc "select * from pga_reports where reportname='$rbvar(reportname)'" rcd {
set y_lo $rbvar(y_[lindex $rbvar(regions)[expr $di-1]])
pg_select $dbc "select * from \"$rbvar(tablename)\"" rec {
wpg_select $dbc "select * from \"$rbvar(tablename)\"" rec {
foreach {field x y objid objtype} $fields {
if {($y>=$y_lo) && ($y<=$y_hi)} then {
if {$objtype=="t_f"}{
...
...
@@ -2461,7 +2521,7 @@ Window show .tiw
set tiw(isunique){}
set tiw(isclustered){}
set tiw(indexfields){}
pg_select $dbc "select attnum,attname,typname,attlen,atttypmod,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 {
wpg_select $dbc "select attnum,attname,typname,attlen,atttypmod,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 {
.nt.ddf.lb insert end char char2 char4 char8 char16 varchar text int2 int4 float4 float8 date datetime
.nt.ddf.lb insert end char varchar text int2 int4 serial float4 float8 money abstime date datetime interval reltime time timespan timestamp boolean box circle line lseg path point polygon