Hi all,I suppose you set the value of row in a for loop and that you actually have some results from your query. If that is the case then [pg_result $query -getTuple $row] will return a list and you could access the individual fields with lindex. It should look something like this...How can i access to a field of a record that i have extract from a
database with the above sequence of instruction:set query [pg_exec $db_elenco "Select nome_cognome,prefisso,telefono
from campione_out where ultimo_accesso=null"];
set res [pg_result $query -getTuple $row];
# make the query
set query [pg_exec $db_elenco "Select nome_cognome,prefisso,telefono
from campione_out where ultimo_accesso=null"]
# now get the results...
for {set row 0} {$row<[pg_result $query -numTuples]} {incr
row} {
# get next record
set res [pg_result $query -getTuple $row]
# the result is in the list so get the fileds
set ilnome [lindex $res 0]
set ilprefisso [lindex $res 1]
set iltelefono [lindex $res 2]
# do something with the data
...
}
You can also assign the result to an array and access the data like
this:
pg_result $query -assign $acc
# this will list all the telephones
for {set i 0} {$i<[pg_result $query -numTuples]} {incr i} {
puts "telefono $i -> $acc($i,telefono)"
}
Hope it helps!
Cristian.
