Class: Session

Session(propertiesopt)

new Session(propertiesopt)

Constructor for a X plugin Session
Parameters:
Name Type Attributes Description
properties URI <optional>
Source:

Methods

commit() → {Promise.<boolean>}

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

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

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

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

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

executeSql(sql, …argsopt) → {module:SqlExecute}

Execute a raw SQL statement.
Parameters:
Name Type Attributes Description
sql string SQL statement
args * <optional>
<repeatable>
query placeholder values
Deprecated:
  • since version 8.0.12. Will be removed in future versions. Use Session.sql() instead.
Source:
Returns:
Type
module:SqlExecute

getDefaultSchema() → {module:Schema}

Get the default schema instance.
Source:
Returns:
The default schema bound to the current session.
Type
module:Schema

getSchema(name) → {module: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
module:Schema

getSchemas() → {Array.<module:Schema>}

Get schemas
Source:
Returns:
Promise resolving to a list of Schema instances.
Type
Array.<module:Schema>

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.<boolean>}

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

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(sql) → {module:SqlExecute}

Execute a raw SQL statement.
Parameters:
Name Type Description
sql string SQL statement
Source:
Returns:
Type
module:SqlExecute

startTransaction() → {Promise.<boolean>}

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