5.3.6 Session

A session is the main user access path to the database. The Session class models such a session.

Press CTRL+C to copy
Session extends Context
Press CTRL+C to copy
getMapping(Object parameter, Function(Object err, Object mapping) callback);

Get the mappings for a table or class.

The parameter may be a table name, a mapped constructor function, or a domain object. This function returns a fully resolved TableMapping object.

Press CTRL+C to copy
Batch createBatch()

Creates a new, empty batch for collecting multiple operations to be executed together. In an application, you can invoke this function similarly to what is shown here:

Press CTRL+C to copy
var nosql = require("mysql-js"); var myBatch = nosql.createBatch();
Press CTRL+C to copy
Array listBatches():

Return an array whose elements consist of all current batches belonging to this session.

Press CTRL+C to copy
Transaction currentTransaction();

Get the current Transaction.

Press CTRL+C to copy
void close(Function(Object error) callback);

Close this session. Must be called when the session is no longer needed.

Press CTRL+C to copy
boolean isClosed();

Returns true if this session is closed.

Press CTRL+C to copy
void setLockMode(String lockMode);

Set the lock mode for read operations. This takes effect immediately and remains in effect until the session is closed or this method is called again. lockMode must be one of 'EXCLUSIVE', 'SHARED', OR 'NONE'.

Press CTRL+C to copy
Array listTables(databaseName, callback);

List all tables in database databaseName.

Press CTRL+C to copy
TableMetadata getTableMetadata(String databaseName, String tableName, callback);

Fetch metadata for table tableName in database databaseName.