mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Initial pass on SQLite C ABI
This adds initial SQLite C ABI compatibility to Limbo to make sure we drive the Rust API in the right way that allows us to implement SQLite semantics.
This commit is contained in:
parent
3420556018
commit
f5cc3a08f0
14 changed files with 465 additions and 9 deletions
30
sqlite3/examples/example.c
Normal file
30
sqlite3/examples/example.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "sqlite3.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open("local.db", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
rc = sqlite3_prepare_v2(db, "SELECT 'hello, world' AS message", -1, &stmt, NULL);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
rc = sqlite3_step(stmt);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
const unsigned char *result = sqlite3_column_text(stmt, 0);
|
||||
|
||||
printf("result = %s\n", result);
|
||||
|
||||
sqlite3_close(db);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue