Page 1 of 1

sqlite3.lsp column type bug

Posted: Fri Mar 02, 2007 1:24 pm
by Dmi
We just found a small bug in sqlite3.lsp :

When some column in the multirow result of a select has a NULL value in the first row and non-null values in the subsequent rows, then all values of this column in the result of (sql3:sql ...) function will be nil.
I.e.:
if the result of a select is:

Code: Select all

val1|val2
1|null
2|4
3|5
then the result of a (sql3:sql "select * from ... order by val1")
will be

Code: Select all

((1 nil)
 (2 nil)
 (3 nil))
This is caused by the optimization trick that fetches the column's values only from the first row of an sql result:

Code: Select all

(if (empty? col-types) (set 'col-types (get-types pstm num-cols)))
should be

Code: Select all

(set 'col-types (get-types pstm num-cols))
to fetch actual column types from each row.

Posted: Fri Mar 02, 2007 2:02 pm
by Lutz