5.3.6 Session

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

Session extends Context
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.

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:

var nosql = require("mysql-js");

var myBatch = nosql.createBatch();
Array listBatches():

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

Transaction currentTransaction();

Get the current Transaction.

void close(Function(Object error) callback);

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

boolean isClosed();

Returns true if this session is closed.

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'.

Array listTables(databaseName, callback);

List all tables in database databaseName.

TableMetadata getTableMetadata(String databaseName, String tableName, callback);

Fetch metadata for table tableName in database databaseName.

Download this Manual
PDF (US Ltr) - 4.8Mb
PDF (A4) - 4.8Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.8Mb
HTML Download (Zip) - 1.9Mb
User Comments
Sign Up Login You must be logged in to post a comment.