database.sql: use CURRENT_TIMESTAMP instead of NOW()

sqlite doesn't use NOW()

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
linkcache: annotate the source files for utf-8

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
database.sql: ensure queried timestamps are actually timestamps

sqlite returns some timestamps as text unless you specify the format.

Ensure they're timestamps when we generate the result.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
database.sql: always specify channel, even if it's empty

mysql defaulted to an empty string, while sqlite defaulted to NULL.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
result: encode __str__ as utf-8

Python will convert the unicode string to a byte string but will default
to ascii. Rename __str__ to __unicode__ and reimplement __str__ to encode
in utf-8.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
database.sqlite3: fix retries

The retry logic would continue after exhausting retries and never
report the exceptions encountered.  See commit ae8773933e6 for
a similar issue with mysql.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
linkcache: properly encode titles and description as unicode

We should be working with unicode strings internally. This commit
grabs the charset from the headers and uses it to encode the titles
and descriptions as unicode. If no charset is specified, we default
to utf-8.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
database.mysql: use unicode

We've already specified the charset, but we also need to tell it to use
unicode strings.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>