sqlite3.lsp column type bug
Posted: Fri Mar 02, 2007 1:24 pm
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:
then the result of a (sql3:sql "select * from ... order by val1")
will be
This is caused by the optimization trick that fetches the column's values only from the first row of an sql result:
should be
to fetch actual column types from each row.
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
will be
Code: Select all
((1 nil)
(2 nil)
(3 nil))
Code: Select all
(if (empty? col-types) (set 'col-types (get-types pstm num-cols)))
Code: Select all
(set 'col-types (get-types pstm num-cols))