ilusm.dev

db

Database drivers (PostgreSQL, MySQL, MongoDB, SQLite).

Load with: use db

Quick example

use db

result = dbnw("value", "value")
prn(result)

Functions

Connection

dbnw(drv, cs)

Performs the operation. Takes drv, cs.

dbcon(db)

Performs the operation. Takes db.

dbcls(db)

Lists items. Takes db.

Pool

dbpoo(driver, conn_str, max_connections)

Performs the operation. Takes driver, conn_str, max_connections.

dbpoo(pool)

Performs the operation. Takes pool.

dbpoo(pool_conn)

Performs the operation. Takes pool_conn.

Query

dbqry(db, sql, ps)

Performs the operation. Takes db, sql, ps.

dbexe(db, sql, ps)

Performs the operation. Takes db, sql, ps.

dbone(db, sql, params)

Creates a new instance. Takes db, sql, params.

dbcnt(db, tbl, wh)

Performs the operation. Takes db, tbl, wh.

PostgreSQL specific

dbpgn(hos, por, db, usr, pwd)

Performs the operation. Takes hos, por, db, usr, pwd.

dbpgl(db, ch, cb)

Performs the operation. Takes db, ch, cb.

dbpgn(db, ch, pl)

Performs the operation. Takes db, ch, pl.

MySQL specific

dbmys(hos, por, db, usr, pwd)

Performs the operation. Takes hos, por, db, usr, pwd.

MongoDB

dbmon(cs)

Performs the operation. Takes cs.

dbmoc(db, nm)

Performs the operation. Takes db, nm.

dbmof(col, flt, opts)

Performs the operation. Takes col, flt, opts.

dbmoi(col, doc)

Performs the operation. Takes col, doc.

dbmou(col, flt, upd, opts)

Performs the operation. Takes col, flt, upd, opts.

dbmod(col, flt)

Performs the operation. Takes col, flt.

dbmoa(col, pipe)

Performs the operation. Takes col, pipe.

SQLite

dbsql(path)

Performs the operation. Takes path.

dbsql(db)

Performs the operation. Takes db.

dbsql(db, tbl)

Performs the operation. Takes db, tbl.

Transactions

dbbeg(db)

Performs the operation. Takes db.

dbcom(db)

Performs the operation. Takes db.

dbrol(db)

Performs the operation. Takes db.

dbtx(db, fn)

Performs the operation. Takes db, fn.

Prepared statements

dbpre(db, sql)

Performs the operation. Takes db, sql.

dbexe(stmt, params)

Performs the operation. Takes stmt, params.

Batching

dbbat(db, statements)

Performs the operation. Takes db, statements.

Migrations

dbmig(db, migrations)

Performs the operation. Takes db, migrations.

Query builder

dbq(table)

Performs the operation. Takes table.

dbqse(q, fs)

Sets a value. Takes q, fs.

dbqwh(q, cond, ps)

Performs the operation. Takes q, cond, ps.

dbqjn(q, tbl, on, jt)

Performs the operation. Takes q, tbl, on, jt.

dbqor(q, f, d)

Performs the operation. Takes q, f, d.

dbqli(q, n)

Performs the operation. Takes q, n.

dbqof(q, n)

Performs the operation. Takes q, n.

dbqbu(q)

Performs the operation. Takes q.

dbqru(q, db)

Runs. Takes q, db.

dbqon(q, db)

Performs the operation. Takes q, db.

Row helpers

dbins(db, tbl, d)

Performs the operation. Takes db, tbl, d.

dbupd(db, tbl, d, wh, whps)

Performs the operation. Takes db, tbl, d, wh, whps.

dbdel(db, tbl, wh, whps)

Performs the operation. Takes db, tbl, wh, whps.

Connection health

dbpin(db)

Initialises. Takes db.

dbsta(db)

Performs the operation. Takes db.

Notes

  • Generic database interface - connect, query, transaction.