Store dates in ISO format for easier ordering.
Selecting entries supports custom ordering and filtering. Quotify utility function added.
Escape single quotes for SQLite queries, and percentage signs and underscores for LIKE pattern matching.