Re: [database-devel] postgresql-simple - how hard would it be to do the same for sqlite?

To clarify what I meant by a low-level binding:
On Tue, Jul 31, 2012 at 5:25 PM, Janne Hellsten
Put into SQLite API context, here's how a typical SELECT might work, using some sort of pseudo-C to make it easier to read
conn = sqlite3_open("..."); // create a prepared statement: stmt = sqlite3_prepare(conn, "SELECT * from test_table");
// process all rows in the result while (sqlite3_step(stmt) != SQLITE_DONE) { // access the current row char* colValue = sqlite3_column_text(stmt, columnNdx); // there are separate column accessors for different types, like sqlite_column_blob, text, etc. } sqlite3_finalize(stmt); sqlite3_close(conn);
Basically, the aim of the low level binding is to create this sort of pseudo-C in Haskell, though it would be preferable to not have to explicitly finalize the statement. (Though I did end up adding unsafeFreeResult to postgresql-libpq to explicitly trigger the finalizer that calls PQclear, for better or worse. I did so at the request of Felipe Lessa for use in persistent-postgresql.) Best, Leon
participants (1)
-
Leon Smith