The namespace that holds functions and other objects for working with a database.
Platform Support
| Jaxer Server Framework | Jaxer Client Framework | 1.0 | no |
|---|
Classes
Jaxer.DB.MySQL |
Jaxer.DB.MySQL.Connection |
Jaxer.DB.ResultSet |
Jaxer.DB.SQLite |
Jaxer.DB.SQLite.Connection |
Properties
![]() | |||
| Property | Action | Jaxer Server Framework | Jaxer Client Framework |
|---|---|---|---|
Holds a reference to the constructor of the current default database connection used for database interactions, e.g. by Jaxer.DB.execute. This is determined by the settings in configApps.js and in config.js. It can be different for different requests. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. (Advanced) | No Details | 1.0 | no |
| |||
A hashmap that holds references to the currently-recognized default database connections, according to configApps.js, config.js, and the page requests encountered so far. It's keyed off the (resolved) name of the current app. (Advanced) | No Details | 1.0 | no |
| |||
Holds a reference to the constructor of the current default connection used for the Jaxer framework's internal database interactions, e.g. by Jaxer.DB.frameworkExecute. This is determined by the settings in config.js. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. (Advanced) | No Details | 1.0 | no |
| |||
When you INSERT a row that has an AUTO_INCREMENT-type column in the default framework database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column. (Advanced) | No Details | 1.0 | no |
| |||
When you INSERT a row that has an AUTO_INCREMENT-type column in the default framework database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertRowId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertRowId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column. (Advanced) | No Details | 1.0 | no |
| |||
static connection
: Object Holds a reference to the current default connection that will be used for database interactions, e.g. by Jaxer.DB.execute. This is determined by the settings in configApps.js and in config.js. It can be different for different requests. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. | Show Details | 1.0 | no |
| |||
static frameworkConnection
: Object Holds a reference to the current default connection that will be used for the Jaxer framework's internal database interactions, e.g. by Jaxer.DB.frameworkExecute. This is determined by the settings in config.js. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. | Show Details | 1.0 | no |
| |||
When you INSERT a row that has an AUTO_INCREMENT-type column in the default developer database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column. | No Details | 1.0 | no |
When you INSERT a row that has an AUTO_INCREMENT-type column in the default developer database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertRowId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertRowId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column. | No Details | 1.0 | no |
Functions
![]() | ||||||||||||||
| Method | Action | Jaxer Server Framework | Jaxer Client Framework | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
static closeAllConnections(Boolean onlyIfCloseAfterRequest) :
void
Closes all the default DB connections that are open. This is called by the framework when there is a fatal or response error, or after every request if CLOSE_AFTER_REQUEST is set to true in the connection's configuration parameters (Advanced) | Show Details | 1.0 | no | |||||||||||
Parameters
| ||||||||||||||
static frameworkExecute(String sql) : Jaxer.DB.ResultSet Executes the given SQL query string on the default framework database (as defined in Jaxer.Config.DB_FRAMEWORK). If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array. (Advanced) | Show Details | 1.0 | no | |||||||||||
Parameters
Returns
| ||||||||||||||
static initDefault(String name, Object params) :
void
Initializes a default database connection, which entails creating it (not necessarily opening it) and adding it to the Jaxer.DB.defaultConnections hashmap (Advanced) | Show Details | 1.0 | no | |||||||||||
Parameters
| ||||||||||||||
static setDefault(String name, [Object params]) :
void
Sets the given named connection as the default one from now on (though this is by default set anew for each request). If the given name is not already a recognized (i.e. initialized) connection, it will first be initialized. (Advanced) | Show Details | 1.0 | no | |||||||||||
Parameters
| ||||||||||||||
static sqlToString(Object sql, [Jaxer.Log.ModuleLogger log]) : String Attempts to convert the given sql to a string, if needed, and then trim it. If the conversion fails or the string is empty, throws a Jaxer.Exception. (Advanced) | Show Details | 1.0 | no | |||||||||||
Parameters
Returns
| ||||||||||||||
static execute(String sql) : Jaxer.DB.ResultSet|Number|Object[] Executes the given SQL query string on the current default database (as defined in configApps.js). If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array. If the last argument is a (non-Array) object, it is used to pass in options. Currently two options are supported: dateHandler and useLocalTimezone. If dateHandler is given, it should be a function that takes the raw MySQL date/time/datetime string representation of a returned cell value, and a string describing the declared type, and returns the desired JavaScript representation. If dateHandler is not given, set useLocalTimezone to true to store date/time values using the local timezone. Otherwise, by default they are stored as UTC. | Show Details | 1.0 | no | |||||||||||
Parameters
Returns
| ||||||||||||||
static mapExecute(String sql, Array arrayOfParameters, [Object options]) :
void
Prepares the given SQL query string on the current default database (as defined in configApps.js) and then iteratively executes it over the given array of parameters. | Show Details | 1.0 | no | |||||||||||
Parameters
| ||||||||||||||
static mapFrameworkExecute(String sql, Array arrayOfParameters, [Object options]) : Object Prepares the given SQL query string on the default framework database (as defined in Jaxer.Config.DB_FRAMEWORK) and then iteratively executes it over the given array of parameters. | Show Details | 1.0 | no | |||||||||||
Parameters
Returns
| ||||||||||||||

