HaxeFoundation / HaxeFoundation/neko

Unable to read 32-bit and 64-bit integer from sqlite database

Open
#167 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
587
Forks
110
PR merge metrics
No merged PRs in 30d

Description

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 = [ 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.