fts: Strengthen against sqlite failures in FTS functions

function_weights() and function_property_names() (used respectively by
SPARQL fts:rank and fts:offsets functions), initialize all data at first
from the database, so it's available in memory for posterior runs,
although currently those are being quite optimistic about the database
return values in several ways, so:

- Ensure no infinite loops happen on sqlite3_step() if the stmt trips
  into some unexpected state. SQLITE_BUSY still does keep looping though.

- As initialization here is a failable task, stop using g_once_init_*
  and use an static GMutex so initialization can be tried later again
  if it failed previously.

- For the cases where initialization failed, propagate the error code
  on the sqlite3_context.

Based on work by Tim Waugh and Michael Catanzaro.
https://bugzilla.redhat.com/show_bug.cgi?id=1026283