proc pgGet pghand {
# $Header: /home/cvsroot/tcldb/ucodb/Tlib/pgGet,v 1.3 1996/10/17 05:42:29 de Exp $

#	You can use this if you have not too many records, and
#	get a list of keyed lists.  otherwise use pgNext

	global pgmsg server curs.$pghand

	set geterr [catch {set value [pg_result $pghand -assign res] } msg]
  	if {$geterr == 1} {
    		set value "ERROR : $msg"
		puts stderr $value
		return $value
  	} 

	set ct [pg_result $pghand -numTuples]
	set cols [pg_result $pghand -attributes]

	loop i 0 $ct {
		foreach c $cols {
		keylset l $c "$res($i,$c)"
		}
		lappend out "$l"
	}

	set curs.$pghand 0

	return "$out"
}
