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

DECIMAL(X,Y) not working correctly in SQLite #4

Open
hostilefork opened this issue Oct 17, 2019 · 1 comment
Open

DECIMAL(X,Y) not working correctly in SQLite #4

hostilefork opened this issue Oct 17, 2019 · 1 comment
Labels
bug Something isn't working low priority

Comments

@hostilefork
Copy link
Member

In MySQL the DECIMAL test seems to work:

Inserting as DECIMAL(3,2)
[-3.4 -1.2 0.0 5.6 7.8]
=> [-3.4 -1.2 0.0 5.6 7.8]
QUERY MATCHED ORIGINAL DATA

But it gives back strange output in SQLite...seemingly strings:

Inserting as DECIMAL(3,2)
[-3.4 -1.2 0.0 5.6 7.8]
=> ["-3.^@" "-1.^@" "0" "5.6" "7.8"]
QUERY DID NOT MATCH ORIGINAL DATA
@hostilefork hostilefork added the bug Something isn't working label Oct 17, 2019
@hostilefork
Copy link
Member Author

hostilefork commented Oct 18, 2019

This is a by-product of a general problem with SQLite's handling of SQLDescribeCol, where SQL_VARCHAR is coming back as the column type so they were making strings:

https://stackoverflow.com/q/58438456/211160

So now there's a workaround committed. But what it does is ask for the values in Rebol's floating point repesentation (a C double).

Inserting as DECIMAL(3,2)
[-3.4 -1.2 0.0 5.6 7.8]
=> [-3.4 -1.2 0.0 5.6 7.8]  ; a Rebol DECIMAL! (e.g. floating point)
QUERY MATCHED ORIGINAL DATA

This kind of undermines the use of a DECIMAL representation, so strings might be better in a sense...but not like this, as these strings appear to be buggy. Probably the minus sign is counting as one of the decimal digits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority
Projects
None yet
Development

No branches or pull requests

1 participant