-
-
Save psarna/d546e327d1c431d3b5e035858441af5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "sqlite3.h" | |
int main(void) { | |
sqlite3 *db; | |
sqlite3_stmt *stmt; | |
sqlite3_open("/tmp/test.db", &db); | |
// This query assumes that a table was already created manually: CREATE TABLE t(id int) | |
sqlite3_prepare_v2(db, "insert into t(id) values (42)", -1, &stmt, NULL); | |
int rc = SQLITE_OK; | |
while ((rc = sqlite3_step(stmt)) != SQLITE_DONE) { | |
fprintf(stderr, "Got %s\n", sqlite3_errstr(rc)); | |
} | |
fprintf(stderr, "Final: %s\n", sqlite3_errstr(rc)); | |
sqlite3_finalize(stmt); | |
sqlite3_close(db); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment