add support for blobs, treat text as blobs

Add a wrapper for the blob type using sqlite3_column_blob. Unlike
text columns, blobs allow '\0' and other control characters.

Change the query interface to use sqlite3_column_blob instead of
sqlite3_column_text for both text and blob columns. As such,
SqlText("foo") is now just shorthand for SqlBlob("foo".getBytes).

Both types have a toString function, so they're largely
interchangeable on the query side.

Reviewed-by: sean.c.rhea@gmail.com
change query interface, add prepared statements

This commit makes three related changes.

1. The old interface for the query function relied on the user to
iterate completely through the result, or else the underlying statement
on the C heap would not be deallocated the garbage collector called the
result iterator's finalize function.

In the new interface, instead of returning an iterator, query takes
function from Iterator => R, so that query itself deallocates the
statement object when the iterator is no longer in scope.

Before, the following code might have left a statement allocated for an
arbitrary period:

  val row = db.query(sql).next

The new version will deallocate the statement immediately. It looks
like this:

  val row = db.query(sql)(_.next)

2. In client code using the old version, one often wrote code like this:

  for (row <- db.query(sql)) {
    foobar(row)
  }

To ease porting to this new version without reindenting much code,
we provide the foreachRow convenience function:

  db.foreachRow(sql) {
    foobar(row)
  }

3. The new prepare function can be used to bind different values to the
same statement, resulting in significant performance improvements when
executing many similar queries. (In practice, prepared statements are
also less susceptible to sql injections.) It is used like this:

  val sql = "select * from users where id = ?"
  db.prepare(sql) { stmt =>
    val user1 = stmt.query(SqlInt(1))(_.next)
    val user2 = stmt.query(SqlInt(2))(_.next)
    // ...
  }

Reviewed-by: sean.c.rhea@gmail.com
bump version number after interface changes
add test that prepared statements correctly reset

It is currently possible to get a prepared statement into a weird
state because it is not always reset. This commit adds a failing
test for two separate queries against a single prepared statement.
The prepared statement interface will be changed in the next commit
to prevent this bug. There will also be a revised version of this
test for the new interface.
make prepared statements safer

We change the interface to prepared statement queries so that
they are wrapped in a call to reset. This ensures that we won't
end up with a prepared statement that is in an unexpected
state because reset wasn't called.

This change also requires a slight modification to the one-off
query code, though not to the interface itself.

The test is updated for the new prepared statement interface
query and now passes.
add foreachRow to prepared statements

Along with the previous commit, this makes prepared statements have
the same interface as one-off queries. It also slightly simplifies
the one-off query code.
SqlBlob: add toBlob

There was no way to recover the underlying byte array, only the
UTF8 string that could be generated by calling toString on the SqlBlob.