Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clsql bug: number and locale #10

Open
admich opened this issue Oct 1, 2019 · 0 comments
Open

clsql bug: number and locale #10

admich opened this issue Oct 1, 2019 · 0 comments

Comments

@admich
Copy link

admich commented Oct 1, 2019

Hello,

I have a problem with clsql when I read float numbers from a database (I
use sqlite3). The following repl commands show the problem:

CLSQL-USER> (connect ":memory:" :database-type :sqlite3)
#<CLSQL-SQLITE3:SQLITE3-DATABASE :memory: OPEN {1005C67B73}>
CLSQL-USER> (enable-sql-reader-syntax)
; No value
CLSQL-USER> (create-table [tbl1] '(([numint] integer) ([numflt] float)))
; No value
CLSQL-USER> (insert-records :into [tbl1] :attributes '([numint] [numflt]) :values '(1 1.2))
; No value
CLSQL-USER> (select [*] :from [tbl1])
((1 1.0d0))
("NUMINT" "NUMFLT")
CLSQL-USER> (select [*] :from [tbl1] :result-types nil)
(("1" "1.2"))
("NUMINT" "NUMFLT")

The numbers are stored right in database as shows the last command but are read wrong.
This is due to my locale "it_IT-UTF-8". If I change locale to "en_US-UTF-8" all is right.

The problem is in function convert-raw-field in file clsql-uffi.lisp
where is used the c-function atof to convert from string to double, but
this c function depends on locale (point or comma as decimal separator).

PS: I tried to send this bug in the mailing list as written on README but the mailing list is down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant