Skip to content

Examples

Thiago Delgado Pinto edited this page Feb 23, 2018 · 6 revisions

This page contains links to various examples for users of the database-js module(s).

Connections

Prepared Statements

Prepared statements are the preferred way to construct SQL statements with parameters. They are used to reduce the risk of SQL injection attacks

Transactions

Transactions, on supported databases, allow a series of statements to be executed and then either committed or rolled back as a batch. This allows more complex logic to be performed on the database back-end.

Transaction Example

Pools

Pools allow a number of database connections to be shared. This is useful in configuration where creating new connections is expensive in time, memory or processing power.

Pool Examples