Closed bkmgit closed 4 months ago
I appreciate that this is a bit odd but SQLite uses weak typing: https://www.sqlite.org/datatype3.html, so this is permissible and validates. I also added a unittest in 9f61acc. If you like an example see this:
(define filename "test.sqlite")
(define res '(("hello!" 10) ("goodbye" 20) ("one more" 2.3)))
(define db (sqlite-open filename))
(sqlite-query db "CREATE TABLE tbl1(one VARCHAR(10), two INTEGER)")
(sqlite-query db "INSERT INTO tbl1 VALUES('hello!',10)")
(sqlite-query db "INSERT INTO tbl1 VALUES('goodbye', 20)")
(sqlite-query db "INSERT INTO tbl1 VALUES('one more', 2.3)")
(for-each display (list res "\n"
(sqlite-query db "SELECT * FROM tbl1") "\n"
(equal? res (sqlite-query db "SELECT * FROM tbl1"))))
(sqlite-query db " SELECT typeof(one), typeof(two) FROM tbl1;")
(sqlite-close db)
(delete-file filename)
which results in
((hello! 10) (goodbye 20) (one more 2.3))
((hello! 10) (goodbye 20) (one more 2.3))
#t
(("text" "integer") ("text" "integer") ("text" "real"))
Ok, thanks.
A float is used in https://github.com/part-cw/lambdanative/blob/master/modules/sqlite/sqlite.scm#L184 but the field type is integer.