Made views compatible with new SQL templating approach in melamid.

Splits queries up into the query template with wildcards for literals, and query params to fill in at execution time.