# $Header: /home/cvsroot/tcldb/wisql/Tlib/PGshowFields,v 1.3 1998/02/16 04:40:43 de Exp ${DB}showFields,v 1.1.1.1 1996/10/12 02:26:27 de Exp $
# tcl procs saved on Tue Sep 05 09:33:15 PDT 1995

proc PGshowFields {} {


  global dbpipe1 DB
  global sybmsg
  global server
  global table base
  upvar #0 EZEcolatts colatts
  upvar #0 EZEcols cols
  global MsgW

#  puts stderr "PGshowFields called with base $base table $table"

#	hack, used to be single arg called tab
	lassign [split $table .] usr tab

	if {$tab == ""} {
		puts stderr "Table var table not set..."
		setMsg $MsgW "You must select a table before showing its fields."
		return
	}

  set plist ""

	set ct [llength $cols]
	foreach c $cols {
		set n [keylget colatts($c) name]
		set t [keylget colatts($c) type]
    		lappend plist [format "%-20.20s %-12.12s" $n $t]
	}


  if {[llength $plist] == 0} {
    setMsg $MsgW "No fields in table $tab?  Something must be wrong."
    return
  }
  set tlabel "${usr}_$tab"
  pickList .$base:$tlabel Fields 200x300 $plist ""

}

