To clarify what I meant by a low-level binding:<br><br><div class="gmail_quote">On Tue, Jul 31, 2012 at 5:25 PM, Janne Hellsten <span dir="ltr">&lt;<a href="mailto:jjhellst@gmail.com" target="_blank">jjhellst@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Put into SQLite API context, here&#39;s how a typical SELECT might work,  using some sort of pseudo-C to make it easier to read<br>

<br>
conn = sqlite3_open(&quot;...&quot;);<br>
// create a prepared statement:<br>
stmt = sqlite3_prepare(conn, &quot;SELECT * from test_table&quot;);<br>
<br>
// process all rows in the result<br>
while (sqlite3_step(stmt) != SQLITE_DONE)<br>
{<br>
    // access the current row<br>
    char* colValue = sqlite3_column_text(stmt, columnNdx);<br>
    // there are separate column accessors for different types, like<br>
sqlite_column_blob, text, etc.<br>
}<br>
sqlite3_finalize(stmt);<br>
sqlite3_close(conn);<br></blockquote></div><br><br>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.)<br><br>Best,<br>Leon<br>