Version: v0.6.0 - Beta.  We welcome contributors & feedback.  THanks!

Db.use

Db.use($databaseId)

Description

Get the handle for a database other than default (as configured in settings/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.use('sales');

$query = sql'SELECT SUM(price) as total FROM monthlySales';
$totalMonthlySales = dbSales.selectRow($query);