NAME
ubbase64 – store and retrieve a blob in a table using base64 encoding
SYNOPSIS
ubbase64 --function get|put --attribute <attribute> --key <key> --match <match> {--format csv|json|html|list|textarea|ubxml2pdf} <table>
DESCRIPTION
ubbase64 is used to store and retrieve BLOBs (binary large objects) in a Unibase table.
Typically this is used to store random text and images, but can be used for anything.
For storage, Unibase requires a table with a specific format. This format must include two attributes: an index attribute and a 60-character attribute that stores the base64 encoded BLOB.
e.g.
: note
noteNumber, 6
note, 60
>
noteNumber
>
>
>
Typically, a separate table stores meta information about the note..
Unibase guarantees the order of data stored so there is no need to be more specific about the indexes.
o store a BLOB, use the ‘put’ function and specify the attribute for the BLOB, the table key, the match value, and the table name. The original format is irrelevant because Unibase simply stores the data.
When storing data ubbase64 reads stdin for data.
To retrieve a blob use the function get along with the other attributes.
The retrieved BLOB is output on stdout.
ubbase64 can also format a text BLOB so that it is suitable for display in html (–format html) or for use in a textarea input (–format textarea).
Other formats are
- csv – character substitutions make the text suitable for use in a csv file
- html – line feeds (\n) are changed into <br>
- json – line feeds changed to \n, ” is escaped (\”), / is escaped (\/), \ is escaped (\\)
- list – lines are output as Tcl list items. ie {<line>}
- p – data is output without newline. Suitable for inserting in other tags.
- textarea – output is suitable for editing in html textarea input type
- textxml – output data between <text></text> tags for ubxml2pdf. \n is replaced with ‘</text></line><line><text>’
- ubxml2pdf – each line is surrounded by <line><text> … </text></line> making it suitable for use in xml format for ubxml2pdf. Also <, >, and ‘ are replaced by xml safe & sequences (<, >, ").
–format raw or not using the –format flag will return the raw base64 text as the original binary data. eg use this to extract images, spreadsheets, etc.
You can specify multiple output formats using ++...
. Each format transforms the output from the preceding one. Order is important.
ARGUMENTS
–attribute | attribute used to save BLOB |
---|---|
–function | get (retrieve) or put (save) |
–format | csv, json, html, list, textarea, ubxml2pdf, or raw These formats are used for retrieved data. The data can be presented comptaible with the format specified. That includes appropriate character escaping, substituting, etc. |
–key | name of key to match |
–match | value to match |