Example:
Sqlite.open("../demo/mydb.sqlite", xReadWrite) ?
_.query("
SELECT "id", "name", "avatar"
FROM "table"
LIMIT 0, 20
", xSimpleQuery)
.execute() row {
id = row.intAt(0);
name = row.stringAt(1);
ava = row.stringAt(2);
log(`${id} ${name} ${ava}`);
"))
This prints, depending on the actual database content:
1 Andy 0x4563 2 Paula 0x2321
The SQLiteFfi
argentum module has multiple feature not shown in the example:
- Connection can be stored and reused for multiple queries.
- Queries can have parameters of int, string, blob types.
- Queries can be stored and executed multiple times, possibly with different parameters.
- Queries and connections can be created on different threads and result->object mapping can be performed on one thread with passing the resulting objects to the business logic threads.
- The
sqliteFfi
is a low level API, you can build any query execution strategies atop of it.
Currently sqliteFfi
links the full database engine inside the application that uses it, but this can be easily switched to DLL/so if needed.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.