Version: v0.7.0 - Beta.  We welcome contributors & feedback.

Db.useDatabase

Db.useDatabase($databaseId) -> object

Description

Get the handle for a database other than default (as configured in config/app.jcon).

Example configuration of a 'sales' database:

{
    app: {
        ...
    }

    databases: {

        default: {
            file: app.db
        }

        sales: {
            driver: mysql
            server: localhost
            database: sales
            username: dbuser
            password: maknmoney$
        }
    }
}

All Db functions can be called directly on this handle.

$dbSales = Db.useDatabase('sales')
$dbSales.insertRow('customers', { email: 'user@example.com' })