Class: Session

(abstract) Session(properties)

(abstract) new Session(properties)

Constructor for a X plugin Session
Parameters:
Name Type Description
properties URI
Source:

Methods

close()

Close the connection
Source:

commit() → {Promise.<bool>}

Commit a transaction This will commit a transaction on the server. On success the returned Promise will resolve to true, else the Promise will be rejected with an Error.
Source:
Returns:
Type
Promise.<bool>

connect() → {Promise.<Session>}

Connect to the database
Source:
Returns:
Promise resolving to myself
Type
Promise.<Session>

createSchema(schema) → {Promise.<Schema>}

Create a Schema in the database
Parameters:
Name Type Description
schema string Name of the Schema
Source:
Returns:
Type
Promise.<Schema>

dropSchema(name) → {Promise.<boolean>}

Drop a schema (without failing even if the view does not exist)..
Parameters:
Name Type Description
name string schema name
Source:
Returns:
- Promise resolving to true on success
Type
Promise.<boolean>

executeSql(sql) → {SQLExecutor}

Execute SQL query Note: This doesn't follow the DevAPI but adds an extra execute() function to define callbacks for rows and meta data before each result set the meta cb is called, then for each row the rowcb. One can either provide callbacks or an object containing a row and meta method
session.executeSql("SELECT * FROM t")
    .execute(function (row) { process single row  })
    .then( function (notices) { process notices });
or
session.executeSql("SELECT * FROM t")
    .execute({
        row: function (row) { process single row },
        meta: function (meta) { process meta data }
     })
    .then( function (notices) { process notices });
Parameters:
Name Type Description
sql string SQL string
Source:
Returns:
Type
SQLExecutor

getSchema(name) → {Schema}

Get instance of Schema object for a specific database schema This will always succeed, even if the schema doesn't exist. Use Schema#existsInDatabase on the returned object to verify the schema exists.
Parameters:
Name Type Description
name string Name of the schema (database)
Source:
Returns:
Type
Schema

getSchemas() → {Promise.<SchemaList>}

Get schemas
Source:
Returns:
Promise resolving to an object of Schema name <-> Schema object pairs
Type
Promise.<SchemaList>

releaseSavepoint(nameopt) → {Promise}

Release a transaction savepoint with the given name.
Parameters:
Name Type Attributes Description
name string <optional>
savepoint name
Source:
Returns:
Type
Promise

rollback() → {Promise.<bool>}

Rollback a transaction This will rollback the current transaction. On success the returned Promise will resolve to true, else the Promise will be rejected with an Error. Create a Schema in the database
Source:
Returns:
Type
Promise.<bool>

rollbackTo(nameopt) → {Promise}

Rollback to a transaction savepoint with the given name.
Parameters:
Name Type Attributes Description
name string <optional>
savepoint name
Source:
Returns:
Type
Promise

setSavepoint(nameopt) → {Promise.<string>}

Create a new transaction savepoint. If a name is not provided, one will be generated using the connector-nodejs- format.
Parameters:
Name Type Attributes Description
name string <optional>
savepoint name
Source:
Returns:
Promise that resolves to the name of the savepoint.
Type
Promise.<string>

sql()

Alias for Session#executeSql.
Source:
See:

startTransaction() → {Promise.<bool>}

Start a transaction This will start a transaction on the server. On success the returned Promise will resolve to true, else the Promise will be rejected with an Error.
Source:
Returns:
Type
Promise.<bool>