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

line: 177

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

line: 202

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

line: 346

sqlite.debugOff()

Disable debugging: turn off additional output
👉🏼 see also: sqlite.debugOn()

line: 44

sqlite.debugOn()

Enable debugging: show more output on STDERR
👉🏼 see also: sqlite.debugOff()

line: 50

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"

line: 482

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

line: 510

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

line: 383

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

line: 114

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

line: 159

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)

line: 303

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

line: 67

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

line: 100

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)

line: 410

sqlite.rowcount()

Show rowcount of a table

🌐 global  string  $BSQLITE_TABLE  current table name

🔹 param   string  optional: (can be skipped) table name

line: 222

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.

line: 235

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

line: 323

sqlite.setfile()

Set sqlite file for current session
🟩 param  string  sqlite file

line: 269

sqlite.settable()

set tablename for current session. The table must exist to set it.
🟩 param  string  table name

line: 279

sqlite.tableexists()

Check if table exists; check its exitcode or use an if then
🟩 param  string  table name

line: 252

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

line: 211

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

line: 442