Table of Contents
-
sqlite.class.sh
- sqlite.columnlist()
- sqlite.columns()
- sqlite.create()
- sqlite.debugOff()
- sqlite.debugOn()
- sqlite.delete()
- sqlite.deleteById()
- sqlite.getid()
- sqlite.ini()
- sqlite.init()
- sqlite.newvar()
- sqlite.query()
- sqlite.queryRO()
- sqlite.read()
- sqlite.rowcount()
- sqlite.rows()
- sqlite.save()
- sqlite.setfile()
- sqlite.settable()
- sqlite.tableexists()
- sqlite.tables()
- sqlite.update()
sqlite.class.sh
List of all functions in alphabetic order
sqlite.columnlist()
Show columns of a table each in a single line
🌐 global string $BSQLITE_FILE file to execute the query on
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) sqlite file
🔹 param string optional: (can be skipped) table name
sqlite.columns()
Show columns of a table seperated with comma
🌐 global string $BSQLITE_FILE file to execute the query on
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) sqlite file
🔹 param string optional: (can be skipped) table name
sqlite.create()
Create a database record.
👉🏼 see also sqlite.save and sqlite.update
🌐 global string $BSQLITE_ID constant for the key with the id
🌐 global string $BSQLITE_TABLE current table name
🌐 global string $BSQLITE_TABLENAME constant for the key with the table name
🟩 param string variable name of a hash with row data to insert
sqlite.debugOff()
Disable debugging: turn off additional output
👉🏼 see also: sqlite.debugOn()
sqlite.debugOn()
Enable debugging: show more output on STDERR
👉🏼 see also: sqlite.debugOff()
sqlite.delete()
Delete a record in a table by a given hash that must contain a field "id"
🌐 global string $BSQLITE_ID constant for the key with the id
🌐 global string $BSQLITE_TABLE current table name
🌐 global string $BSQLITE_TABLENAME constant for the key with the table name
🟩 param string variable name of a hash with row data to fetch the field "id"
sqlite.deleteById()
Delete a single record in a table by a given id
🌐 global string $BSQLITE_ID constant for the key with the id
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) table name
🟩 param integer id to delete
sqlite.getid()
Get an id of a database record. It returns bash code
EXAMPLE
id="$( sqlite.getid users "username='axel'" )"
🌐 global string $BSQLITE_TABLE current table name
🟩 param string table to search
🟩 param string WHERE statement to add to the select statement
sqlite.ini()
Read the given ini file and create the tables if file does not exist yet
It calls sqlite.setfile <FILE> to set a default sqlite file
🟩 param string filename of ini file
sqlite.init()
Set the sqlite file and current table name
You can set its parameters individually too:
👉🏼 see also: sqlite.setfile
👉🏼 see also: sqlite.settable
🟩 param string filename
🟩 param string table name
sqlite.newvar()
Get bash code to create a hash with keys of a given table
USAGE:
eval $( sqlite.newvar "users" "oUser")
... creates variable "oUser"
🌐 global string $BSQLITE_TABLE current table name
🌐 global string $BSQLITE_TABLENAME constant for the key with the table name
🔹 param string optional: (can be skipped) table name
🔹 param string optional: variable name (default: table name)
sqlite.query()
Execute a given sql query on the given file
👉🏼 see also: sqlite.queryRO()
🌐 global string $BSQLITE_FILE file to execute the query on
🔹 param string optional: (can be skipped) file
🟩 param string query
sqlite.queryRO()
Readonly query: it sets a readonly flag for the sqlite binary to execute the
given query with readonly access
👉🏼 see also: sqlite.query()
🌐 global string $BSQLITE_FILE file to execute the query on
🔹 param string optional: (can be skipped) file
🟩 param string query
sqlite.read()
Get bash code to create a hash with keys of a given table.
USAGE:
<code>
eval $( sqlite.read users 1 "oUser" )
... creates variable "oUser" with users data of id=1
</code>
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) table name
🟩 param string value of id column
🔹 param string optional: variable name (default: table name)
sqlite.rowcount()
Show rowcount of a table
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) table name
sqlite.rows()
Show rowcount of a table
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: (can be skipped) table name
🟩 param string code to execute after the query: WHERE, ORDER, LIMIT etc.
sqlite.save()
Store a given variable of a hash in the database.
The save function detects the given id to switch between the
create or update mode.
🟩 param string vaiable name of a hash
sqlite.setfile()
Set sqlite file for current session
🟩 param string sqlite file
sqlite.settable()
set tablename for current session. The table must exist to set it.
🟩 param string table name
sqlite.tableexists()
Check if table exists; check its exitcode or use an if then
🟩 param string table name
sqlite.tables()
Show tables of current sqlite file each in a single line
🌐 global string $BSQLITE_TABLE current table name
🔹 param string optional: sqlite file
sqlite.update()
Update a record in a table
👉🏼 see also sqlite.save and sqlite.create
🌐 global string $BSQLITE_TABLE current table name
🌐 global string $BSQLITE_TABLENAME constant for the key with the table name
🟩 param string variable name of a hash with row data to update
Generated with Bashdoc v0.7