Is there a way to access a remote sql database from the command line for export?
The ultimate goal is to automate the process of retrieving those entries which are used in a latex document. A jabref -na solution would be just the right thing, but it seems it is impossible to run queries against a remote database. The only workaround I see is to have a separate script which would connect to the database independently.
Since there currently seems to be no good alternative, I’ve implemented the export using a quick and dirty direct query:
SELECT '@' || "TYPE" || '{' || "VALUE" || ',' || chr(10) ||
array_to_string(array(
SELECT CONCAT(' ', "NAME", ' = {', "VALUE", '},') FROM "FIELD" AS "FIELD2"
WHERE "FIELD2"."NAME" NOT IN ('bibtexkey','abstract','keywords','file')
AND SUBSTR("FIELD2"."NAME", 1, 2) != '__'
AND "FIELD2"."ENTRY_SHARED_ID" = "ENTRY"."SHARED_ID"
), chr(10)) || chr(10) || '}' || chr(10)
FROM "ENTRY"
LEFT OUTER JOIN "FIELD" ON "ENTRY_SHARED_ID" = "SHARED_ID" AND "NAME" = 'bibtexkey'
WHERE "NAME" IS NOT NULL