dbconnection: add dateToQuery() static
database: escape query string