proc pgGetI {pghand i} {
# $Header: /home/cvsroot/tcldb/ucodb/Tlib/pgGetI,v 1.1 1996/12/10 06:07:31 de Exp $

	global curs.$pghand pgmsg server

	set lim [expr [pg_result $pghand -numTuples] + 1]
	if {$i > $lim} {
		return ""
	}
	set curs.$pghand $i
	set geterr [catch {set value [pg_result $pghand -getTuple $i] } msg]

  	if {$geterr == 1} {
    		set value "ERROR : $msg"
		echo $value
  	} 
	incr curs.$pghand

	return $value

}
