sqlite.sh

sqlite - access a SQLite3 db

This library provides functions to access, manipulate and process data stored in a SQLite3 database. It also offers the functionality to utilize such a database to store and access configuration variables (key->value) in a simple manner.

Note

The documentation is currently incomplete, but usage examples with comments are given within share/example_sqlite.sh.

Dependencies

Usage

sqlite_set_db FILE
Set or restet the working SQLite3 db FILE.
sqlite_get_tables
Returns the list of tables.
sqlite_get_columns TABLE
Returns the list of columns of the TABLE.
sqlite_insert TABLE PREFIX
Insert a new dataset/row in the TABLE, by using variables named like PREFIX_COLUMN.
sqlite_update TABLE COLUMN VALUE WHERE
Update the VALUE of a given COLUMN at each row in the TABLE where the WHERE statement matches.
sqlite_func TABLE FUNC PREFIX [ORDER]
Call a function (FUNC) for each data row in the TABLE and providing the respective variables (PREFIX_COLUMN) for each call.
sqlite_func_where TABLE FUNC PREFIX WHERE [ORDER]
Call a function (FUNC) for each data row, where the WHERE statement matches, in the TABLE and providing the respective variables (PREFIX_COLUMN) for each call.
sqlite_row TABLE WHERE PREFIX
Set the variables (PREFIX_COLUMN) according to the data in row where the WHERE statement matches in the TABLE.
sqlite_cvt_create TABLE
Create a Config-Variable-Table (cvt), a table with just two columns like ‘Name’ & ‘Value’ to store variables.
sqlite_cvt_set TABLE VNAME VALUE
Set or reset variable (VNAME=VALUE) in a cvt TABLE.
sqlite_cvt_read TABLE PREFIX
Read a cvt TABLE to variables like PREFIX_VNAME.

Variables

sqlite_VERBOSE
Set this variable to 1 to get more information during function execution.
sqlite_SQLFILE
Here you can define the working SQLite3 db file.

Warning

You should leave this variable empty/untouched! Better make use of the sqlite_set_db function.

Examples

Todo

Needs to be completed!

Error Handling

Todo

Needs to be completed!