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

integer overflow #37

Closed
narychen opened this issue Mar 24, 2016 · 18 comments
Closed

integer overflow #37

narychen opened this issue Mar 24, 2016 · 18 comments
Assignees
Labels

Comments

@narychen
Copy link

The sqlite integer value should stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
But on android, I tried two of my android phones
create table bbb (b integer)
insert into bbb(b) values (1458743338878) // time millisecond
select * from bbb

It turns out b = -1545541762
I change the type integer to int int8 bigint and it is always the same result. unless I use real.
I'm not sure the problem related to this driver. But on ios it has no problem.

@narychen
Copy link
Author

I check my sqlite version with 'select sqlite_version()'
It's 3.7.11

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

Did you try to debug the Android module and see what comes out of the db call?

@narychen
Copy link
Author

I'm sorry but I dont know which android method to start debug with.
Could you tell me the code related to this function so I could use android studio to see the values come out.

@narychen
Copy link
Author

I think it could be the problem as the result comes out as a java int type. It's only 4 bytes.

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

You can start here:
public void executeSqlBatch(ReadableMap args, Callback success, Callback error)

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

Did you try both pure java and native Android implementations ?

@narychen
Copy link
Author

Yes, both android and android-native implementation I tried have this problem

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

Android impl always fetches values for colums of INT type as long....

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

i found something...maybe it will fix the issue...i should be able to commit it soon..

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

Can you check the pure Java implementation? I adjusted some conversions...pull latest from this repo.

@narychen
Copy link
Author

I've tried it. It fixed the problem. Really Awesome!

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

Great. I also updated native impl now.

@andpor andpor closed this as completed Mar 24, 2016
@narychen
Copy link
Author

Just one more question, should I use native impl in production environment or both impl will be ok?

@andpor
Copy link
Owner

andpor commented Mar 24, 2016

both fully working. Your choice.

@andpor andpor added the bug label Mar 26, 2016
@andpor andpor self-assigned this Mar 26, 2016
@andpor
Copy link
Owner

andpor commented Mar 26, 2016

Fixed in 2.1.5

@kestasb
Copy link

kestasb commented Jun 4, 2018

Problem reappeared on Android devices in v3.3.5, though v3.3.4 is working fine.

@andpor
Copy link
Owner

andpor commented Jun 5, 2018

yes, i spotted the issue. I will fix it and release 3.3.6 tomorrow - thanks for reporting..

@andpor
Copy link
Owner

andpor commented Jun 6, 2018

fixed and released - please check it.

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

No branches or pull requests

3 participants