diff options
Diffstat (limited to 'db/dict')
-rw-r--r-- | db/dict/template.sql (renamed from db/dict/template.sql.m4) | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/db/dict/template.sql.m4 b/db/dict/template.sql index 00de413..1a07252 100644 --- a/db/dict/template.sql.m4 +++ b/db/dict/template.sql @@ -14,9 +14,18 @@ create temporary table ingest( glossary_tags text null default null -- add tags to single glossary entry ); -include(`/dev/stdin')dnl --' --- the apostrophe is so my editor highlighting keeps working if I force the --- filetype to sql instead of m4 +-- #DICTIONARY_CONTENT_BEGIN +-- this template is 'rendered' by pasting a .dict.sql file in between these +-- DICTIONARY_CONTENT markers. the makefile can render these using the +-- following m4 code (called using m4 -P template.sql < any.dict.sql): +-- +-- m4_undivert(`/dev/stdin') +-- +-- this breaks when the first line of the input file is not a comment or empty +-- line, so the makefile accounts for this by concatenating an empty line with +-- the dict first. the runtime typescript dictionary importer handles this by +-- not calling m4 for this. +-- #DICTIONARY_CONTENT_END -- create dict id insert into dict (tag, language) values ('dict:' || :dict, :lang); @@ -49,8 +58,8 @@ with tag_map(term_id, temp, tag) as ( union select term_id, - `substr'(temp, instr(temp, ' ') + 1), - `substr'(temp, 0, instr(temp, ' ')) + substr(temp, instr(temp, ' ') + 1), + substr(temp, 0, instr(temp, ' ')) from tag_map where length(temp) > 1 ) @@ -71,8 +80,8 @@ with tag_map(definition_id, temp, tag) as ( union select definition_id, - `substr'(temp, instr(temp, ' ') + 1), - `substr'(temp, 0, instr(temp, ' ')) + substr(temp, instr(temp, ' ') + 1), + substr(temp, 0, instr(temp, ' ')) from tag_map where length(temp) > 1 ) |