/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "sqlite3.h"

int main()
{
    sqlite3 *con;
    sqlite3_stmt *ins, *sel;
    char *sqlstr = "SELECT f1,f2 FROM t1";
    int stat;
    printf("SQLite from C\n");
    stat = sqlite3_open("test.db", &con);
    stat = sqlite3_prepare(con, sqlstr, strlen(sqlstr), &sel, NULL);
    while(sqlite3_step(sel) == SQLITE_ROW)
    {
        printf("%d %s\n", sqlite3_column_int(sel, 0), sqlite3_column_text(sel, 1));
    }
    sqlite3_finalize(sel);
    sqlite3_close(con);
    return 0;
}
