Node: Database, Next: , Previous: Invoking, Up: Top



The Database File

To be flexible, voc-get saves to vocabulary in an SQLite database file. This is a nice library that supports SQL access on a database without running a server such as with MySQL. See <http://sqlite.org/> for more information.

Unfortunaly, voc-get does not support database operations itself, so you have to generate the table and its content by hand. If you know SQL, this will not be tricky for all (if not, it will not be, either).

voc-get reads the list of tables from a file and lets you choose one. Such a table has to contain at least the following rows in an arbitrary order:

Row Type Description
flvoc varchar the vocabulary in the first, that means your native, language
slvoc varchar the vocabulary in the second lanuage, which you want to learn
flcomment varchar a comment that is displayed when you are asked for the vocabulary in the first language
flcomment varchar a comment that is displayed when you are asked for the vocabulary in the second language
flscore smallint the score you have reached being asked for the vocabulary in the first language
slscore smallint the score you have reached being asked for the vocabulary in the second language

Accordingly, the SQL command for generating the table is:

CREATE table (flvoc varchar, slvoc varchar, flcomment varchar, slcomment varchar, flscore smallint, slscore smallint);

Simply run sqlite file.voc and type in the code. Line breaks do not even matter because statements are finished by semicolon. Quit with .quit (built in SQLite command, so no semicolon here).

To insert data, run:

INSERT INTO table VALUES ('Ich bin''s!', 'It''s me!', 'German', 'English', 0, 0);

You may be surprised about the double apostrophe; it is necessary to prevent parse errors caused by the single quotation marks that frame the string. Nevertheless, using strings like these may produce errors in voc-get, which does not generate those double apostrophes yet. And please do not use these comments, you will get to know which language you should type in the translation. Only set the scores to zero, please.