Renamed query -> statement
Added missing include directive
Updated joins and updated columns to work with sqlite3

The new behaviour is closer to the standard, I think
Small fix in result row
Fixed serialization of multi-row inserts
Fixed bug in text results

text results never had a reasonable length
Removed unnecessary header