sqlite3.lsp column type bug

Notices and updates
Locked
Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

sqlite3.lsp column type bug

Post 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.
WBR, Dmi

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »


Locked