sqlite3.lsp unsigned long int bug

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

sqlite3.lsp unsigned long int bug

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

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

Post by Lutz »

Thanks for the fix Dmitry, the next sqlite3.lsp update will handle integers bigger 32-Bit.

Lutz

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

Post by Dmi »

Thanks Lutz!
WBR, Dmi

Locked