index
Classes
Functions
- sqlSafeName(prefix, metaName, [frags]) ⇒
SqlSafe Creates a logical key for human readable indentification for SQL calls and a SQL safe hashed name
Typedefs
- MDBConnectionDriverOptions :
Object The
mariadb(w/MySQL support) module specific options. Bothconnectionandpoolwill be merged when generating the connection pool.- MDBConnectionOptions :
typedefs.SQLERConnectionOptions MariaDB + MySQL specific extension of the SQLERConnectionOptions from the
sqlermodule.- MDBExecDriverOptions :
Object MariaDB + MySQL specific extension of the SQLERExecOptions from the
sqlermodule. When a property ofbindscontains an object it will be interpolated for property values on themariadbmodule. For example,binds.name = '${SOME_MARIADB_CONSTANT}'will be interpolated asbinds.name = mariadb.SOME_MARIADB_CONSTANT.- MDBExecOptions :
typedefs.SQLERExecOptions MariaDB + MySQL specific extension of the SQLERExecOptions from the
sqlermodule. When a property ofbindscontains an object it will be interpolated for property values on themariadbmodule. For example,binds.name = '${SOME_MARIADB_CONSTANT}'will be interpolated asbinds.name = mariadb.SOME_MARIADB_CONSTANT.
MDBDialect
MariaDB + MySQL Dialect implementation for sqler
Kind: global class
- MDBDialect
- new MDBDialect(priv, connConf, track, [errorLogger], [logger], [debug])
- .state ⇒
typedefs.SQLERState - .driver ⇒
DBDriver - .init(opts) ⇒
Promise.<Object> - .beginTransaction(txId, opts) ⇒
Promise.<typedefs.SQLERTransaction> - .exec(sql, opts, frags, meta, [errorOpts]) ⇒
Promise.<typedefs.SQLERExecResults> - .close() ⇒
Integer
new MDBDialect(priv, connConf, track, [errorLogger], [logger], [debug])
Constructor
| Param | Type | Description |
|---|---|---|
| priv | typedefs.SQLERPrivateOptions | The private configuration options |
| connConf | MDBConnectionOptions | The individual SQL connection configuration for the given dialect that was passed into the originating Manager |
| track | typedefs.SQLERTrack | Container for sharing data between Dialect instances. |
| [errorLogger] | function | A function that takes one or more arguments and logs the results as an error (similar to console.error) |
| [logger] | function | A function that takes one or more arguments and logs the results (similar to console.log) |
| [debug] | Boolean | A flag that indicates the dialect should be run in debug mode (if supported) |
mdbDialect.state ⇒ typedefs.SQLERState
Kind: instance property of MDBDialect
Returns: typedefs.SQLERState - The state
mdbDialect.driver ⇒ DBDriver
Kind: instance property of MDBDialect
Returns: DBDriver - The MariaDB/MySQL driver module
Access: protected
mdbDialect.init(opts) ⇒ Promise.<Object>
Initializes MDBDialect by creating the connection pool
Kind: instance method of MDBDialect
Returns: Promise.<Object> - The MariaDB/MySQL connection pool
| Param | Type | Description |
|---|---|---|
| opts | typedefs.SQLERInitOptions | The options described by the sqler module |
mdbDialect.beginTransaction(txId, opts) ⇒ Promise.<typedefs.SQLERTransaction>
Begins a transaction by opening a connection from the pool
Kind: instance method of MDBDialect
Returns: Promise.<typedefs.SQLERTransaction> - The transaction that was started
| Param | Type | Description |
|---|---|---|
| txId | String | The internally generated transaction identifier |
| opts | typedefs.SQLERTransactionOptions | The transaction options passed in via the public API |
mdbDialect.exec(sql, opts, frags, meta, [errorOpts]) ⇒ Promise.<typedefs.SQLERExecResults>
Executes a SQL statement
Kind: instance method of MDBDialect
Returns: Promise.<typedefs.SQLERExecResults> - The execution results
| Param | Type | Description |
|---|---|---|
| sql | String | the SQL to execute |
| opts | MDBExecOptions | The execution options |
| frags | Array.<String> | the frament keys within the SQL that will be retained |
| meta | typedefs.SQLERExecMeta | The SQL execution metadata |
| [errorOpts] | typedefs.SQLERExecErrorOptions | Boolean | The error options to use |
mdbDialect.close() ⇒ Integer
Closes the MariaDB/MySQL connection pool
Kind: instance method of MDBDialect
Returns: Integer - The number of connections closed
sqlSafeName(prefix, metaName, [frags]) ⇒ SqlSafe
Creates a logical key for human readable indentification for SQL calls and a SQL safe hashed name
Kind: global function
Returns: SqlSafe - SQL safe names
| Param | Type | Description |
|---|---|---|
| prefix | String | Prefix to use in the SQL name |
| metaName | String | Prepared statement meta name |
| [frags] | Array.<String> | null | SQL fragment substitutions being used |
MDBConnectionDriverOptions : Object
The mariadb (w/MySQL support) module specific options. Both connection and pool will be merged when generating the connection pool.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| [connection] | Object | An object that will contain properties/values that will be used to construct the MariaDB + MySQL connection (e.g. { database: 'mydb', timezone: '-0700' }). See the mariadb module documentation for a full listing of available connection options. When a property value is a string surrounded by ${}, it will be assumed to be a property that resides on either the SQLERPrivateOptions passed into the Manager constructor or a property on the MDBConnectionOptions itself (in that order of precedence). For example, connOpts.host = '127.0.0.1' and driverOptions.connection.host = '${host}' would be interpolated into driverOptions.connection.host = '127.0.0.1'. In contrast to privOpts.username = 'someUsername' and driverOptions.connection.user = '${username}'would be interpolated intodriverOptions.connection.user = 'someUsername'. Interpoaltions can also contain more than one reference. For example, driverOptions.connection.someProp = '${protocol}😒{host}'for privOpts = { protocol: 'TCP', host: 'example.com' }would becomesomeProp='TCP:example.com'`. |
| [pool] | Object | The pool conf options that will be passed into mariadb.createPool(conf). See the mariadb module for a full listing of avialable connection pooling options. Using any of the generic pool.someOption will override the conf options set on driverOptions.pool (e.g. pool.max = 10 would override driverOptions.pool.connectionLimit = 20). When a value is a string surrounded by ${}, it will be assumed to be a constant property that resides on the mariadb module and will be interpolated accordingly. For example driverOptions.pool.someProp = '${SOME_MARIADB_CONSTANT}' will be interpolated as pool.someProp = mariadb.SOME_MARIADB_CONSTANT. |
MDBConnectionOptions : typedefs.SQLERConnectionOptions
MariaDB + MySQL specific extension of the SQLERConnectionOptions from the sqler module.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| driverOptions | MDBConnectionDriverOptions | The mariadb (w/MySQL support) module specific options. Both connection and pool will be merged when generating the connection pool. |
MDBExecDriverOptions : Object
MariaDB + MySQL specific extension of the SQLERExecOptions from the sqler module. When a property of binds contains an object it will be interpolated for property values on the mariadb module. For example, binds.name = '${SOME_MARIADB_CONSTANT}' will be interpolated as binds.name = mariadb.SOME_MARIADB_CONSTANT.
Kind: global typedef
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [preparedStatementDatabase] | String | The database name to use when generating prepared statements for the given execution. Since prepared statements are scoped only for a given connection and a temporary stored procedure is used to execute prepared statements, preparedStatementDatabase is required when execOpts.prepareStatement = true. | |
| [exec] | Object | The options passed into execution/query functions provided by the mariadb module performed during Manager.exec. When a value is a string surrounded by ${}, it will be assumed to be a constant property that resides on the mariadb module and will be interpolated accordingly. For example driverOptions.exec.someDriverProp = '${SOME_MARIADB_CONSTANT}' will be interpolated as driverOptions.exec.someDriverProp = mariadb.SOME_MARIADB_CONSTANT. | |
| [exec.namedPlaceholders] | Boolean | true | Truthy to use named parameters in MariaDB/MySQL or falsy to convert the named parameters into a positional array of bind values. |
MDBExecOptions : typedefs.SQLERExecOptions
MariaDB + MySQL specific extension of the SQLERExecOptions from the sqler module. When a property of binds contains an object it will be interpolated for property values on the mariadb module. For example, binds.name = '${SOME_MARIADB_CONSTANT}' will be interpolated as binds.name = mariadb.SOME_MARIADB_CONSTANT.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| [driverOptions] | MDBExecDriverOptions | The mariadb module specific options. |