Use prepared statements instead of SQL

For most operations, use statements that are prepared at initialization time of
the mapper, instead of handing raw SQL to the db query methods.