I find that proc database_to_tcl_string expects the SQL to be a select statement that returns exactly one row and returns that row as an ns_set.
if
{
set selection [ns_db 1row $db $sql]
}
else
{
set selection [ns_db 1row $db [db_sql_prep $sql]]
}
there is why when PG return 0 row, the proc can't handle it.
If I am wrong, please correct me.
I change proc database_to_tcl_string into this format:
if
{
set selection [ns_db 0or1row $db $sql]
}
else
{
set selection [ns_db 0or1row $db [db_sql_prep $sql]]
}
However, it comes out with another error:
Error: invalid set id: ""
invalid set id: ""
while executing
"ns_set value $selection 0"
invoked from within
"return [ns_set value $selection 0]..."
Can I know what is the problem