-
Notifications
You must be signed in to change notification settings - Fork 107
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
Unable to read 32-bit and 64-bit integer from sqlite database #167
Comments
I guess some alloc_int needs to be replaced by alloc_best_int in sqlite.c
support
…On Wed, Jun 21, 2017 at 2:47 PM, avl93 ***@***.***> wrote:
Sqlite in neko can only read 31-bit integers from sqlite. Example:
class Main
{
public static function main(){
var connection = sys.db.Sqlite.open("test.db");
var max31bit: haxe.Int64 = 0x40000000 -1 ;
var values : Array<haxe.Int64> = [ max31bit, max31bit+1, max31bit<<33];
connection.request('create table if not exists test (column1 int)');
connection.request('delete from test');
for (currValue in values) {
connection.request('insert into test values ($currValue)');
}
var rs : sys.db.ResultSet = connection.request("select * from test");
while (rs.hasNext()){
trace(rs.next());
}
}
}
Result:
Main.hx:18: { column1 => 1073741823 }
Main.hx:18: { column1 => -1073741824 }
Main.hx:18: { column1 => 0 }
Expected:
Main.hx:18: { column1 => 1073741823 }
Main.hx:18: { column1 => 1073741824 }
Main.hx:18: { column1 => 9223372028264841216 }
Though, Neko can correctly write 32-bit and even 64-bit integers to sqlite
database, and I can read them using sqlite CLI:
>sqlite3 test.db
SQLite version 3.18.0 2017-03-28 18:48:43
Enter ".help" for usage hints.
sqlite> select * from test;
1073741823
1073741824
9223372028264841216
Tested on NekoVM 2.1.0 and Haxe Compiler 3.4.2.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#167>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-bwNEmidfAvH4ClFz7jXHrsNv-EPOCks5sGRDngaJpZM4OA6EL>
.
|
andyli
added a commit
that referenced
this issue
Dec 19, 2017
I fixed the int32 case, such that it outputs
No idea about int64. (#55?) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sqlite in neko can only read 31-bit integers from sqlite. Example:
Result:
Expected:
Though, Neko can correctly write 32-bit and even 64-bit integers to sqlite database, and I can read them using sqlite CLI:
Tested on NekoVM 2.1.0 and Haxe Compiler 3.4.2.
The text was updated successfully, but these errors were encountered: