Page 1 of 1

sqlite3.lsp unsigned long int bug

Posted: Fri May 11, 2007 8:52 am
by Dmi
sqlite3.lsp incorrectly handle the numbers greater than 2**32:

Newlisp:
Integers are 64-bit numbers (including the sign bit, 32-bit before version 8.9.7). Valid integers are numbers between -9,223,372,036,854,775,808 and +9,223,372,036,854,775,807.
SQLite:
INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
sqlite.lsp

Code: Select all

SQLITE_INTEGER
      (push (sqlite3_column_int pstm i) row -1))
From SQLite API:

Code: Select all

* int* sqlite3_column_int(sqlite3_stmt*, int iCol)
The Fix:

Code: Select all

 (SQLITE_INTEGER
      (set 'pstr (sqlite3_column_text pstm i))
      (if (= pstr 0)
         (push nil row -1)
         (push (int (get-string pstr)) row -1)))

Posted: Fri May 11, 2007 9:31 am
by Lutz
Thanks for the fix Dmitry, the next sqlite3.lsp update will handle integers bigger 32-Bit.

Lutz

Posted: Fri May 11, 2007 8:09 pm
by Dmi
Thanks Lutz!