summaryrefslogtreecommitdiff
path: root/anim/tools/sqlite.c
blob: 5d018c670c95c47e5a7af3e5d6a82723c1a1601e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Three rows into a table of a file database, in one transaction: SQLite's
// amalgamation (not ours: build.zig takes it from -Dsqlite) as a library.
#include "sqlite3.h"

int main(void) {
    sqlite3 *db;
    if (sqlite3_open("t.db", &db) != SQLITE_OK) return 1;
    int rc = sqlite3_exec(db,
        "CREATE TABLE t(word TEXT);"
        "BEGIN;"
        "INSERT INTO t VALUES ('alpha');"
        "INSERT INTO t VALUES ('beta');"
        "INSERT INTO t VALUES ('gamma');"
        "COMMIT;",
        0, 0, 0);
    sqlite3_close(db);
    return rc;
}