Firefox 3

Data file format

pjjTextBase uses text files ("flat files"), that are basically identical to CSV files (=Comma Separated Values), ie. have the following structure: first line contains field names, separated with separator, while records are placed in consecutive lines, eg.:

  id|author|title
  1|Agatha Christie|Evil Under The Sun
  2|Arthur Conan Doyle|A Study in Scarlet
  3|Raymond Chandler|Farewell My Lovely

Althought generally speaking pjjTextBase smoothly reads CSV files, there are some limitations and enhancements you should be aware of:

Limitations

  1. Separator used by pjjTextBase is pipe: |. As such pipe is better than comma (for obvious reason); it is also better than semi-colon, as one can use entities in field values (so perhaps I should refer to PSV files: Pipe Separated Values :-)
  2. Quotation marks, surrounding field's value, are not recognized as such: in other words, they are treated as a part of this value.
  3. Each record must be put on its own line, so it mustn't contain linebreaks.
  4. Fieldname mustn't be a number.
  5. Fieldnames id and those starting with @ or % have special meaning.

Enhacements

  1. Data files may contain security line
  2. Data files may containt comments: each line starting with # is treated as a comment.
  3. Data files may containt empty lines (for increased readability).

Please notice that funtions that write down data (ptb_update, ptb_delete, ptb_write, ptb_addField, ptb_delField and ptb_changeFieldname) strip comments and empty lines due to the fact that they simply write down array from the memory; the only exception is ptb_add, which appends data to a file.

If you want to learn more about CSV file format, I recommend reading Dominic John Repici's article The Comma Separated Value (CSV) File Format.