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: 179

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: 204

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: 348

sqlite.debugOff()

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

line: 45

sqlite.debugOn()

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

line: 51

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: 484

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: 512

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: 385

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: 115

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: 161

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: 305

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: 68

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: 101

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: 412

sqlite.rowcount()

Show rowcount of a table

🌐 global  string  $BSQLITE_TABLE  current table name

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

line: 224

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: 237

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: 325

sqlite.setfile()

Set sqlite file for current session
🟩 param  string  sqlite file

line: 271

sqlite.settable()

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

line: 281

sqlite.tableexists()

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

line: 254

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: 213

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: 444


Generated with Bashdoc v0.7