new DBConnection(index: number, cfg: DBConnectionConfig)#

Class for database access. Databases are defined in config file


inTransactioninstance #

Is database in transaction



Commit transaction. If transaction is not started return false

exec(sql: string, params: Array)→booleaninstance#

Execute sql

execParsed(sqlStatement: string, params: Array)→booleaninstance#

Execute parsed (without inline parameters) sql statement

genID(entity: string)→numberinstance#

Generate ID for entity


Rollback transaction. If transaction is not started return false

run(sql: string, params: Object)→stringinstance#

Run select sql and return result

savepointWrap(func: function)→*instance#

For Postgres wrap a func call into temporary savepoint. In case func throws savepoint is rollback'ed and error is re-trowed, otherwise checkpoint is released. For other RDBMS execute func as is.

Return a func result.


Start transaction. If transaction is already started return false