The Session object is always available as the
session property of the global object.
Session has the methods listed here:
getOption(String: Gets the value of statement optionname)name. Returns a string or a true-false value depending on the option type.prepare(String: Enables the execution of a prepared statements; takes an SQL statement and returns asql, {passResultToClient: Bool,charsetName: String})PreparedStatementobject.Calling this method is equivalent to executing a
PREPAREstatement in the mysql client.runSql(String: Executes a query, with any options specified, and using an optional list of statement parameters; it returns anquery[[, ArraystatementParameters], Optionsoptions])SqlResult.setOptions(Object: Sets statement option defaults. Options not specified assume their default values.options)sql(String: Executes a simple SQL statement. Can also be used to provide attributes overriding thesql, {passResultToClient: Bool,charsetName: String,integerType: IntegerType})passResultlToClientandcharsetNamevalues set in the session. Returns anSqlExecuteobject.IntegerTypeconsists of a JSON key-value pair whose key isIntegerType, and whose possible values and their effects are listed here:mysql.IntegerType.BIGINT: Convert all MySQL integer values to JavaScriptBigInt.mysql.IntegerType.STRING: Convert all MySQL integer values to JavaScriptStringmysql.IntegerType.UNSAFE_BIGINT: If the MySQL value is safe, convert it to JavaScriptNumber; otherwise convert it to JavaScriptBigInt. If the value is safe, convert to JavaScriptNumber; otherwise convert to JavaScriptString. This is the default behavior if no rule is specified.mysql.IntegerType.UNSAFE_STRING: If the MySQL value is safe, convert it to JavaScriptNumber; otherwise convert it to JavaScriptString. This is the default behavior if no rule is specified.
The rule set by this value determines how MySQL integer values are converted to JavaScript by this SQL statement. Their names (less object references) correspond to those for the used with the
integer_typekey used withmle_set_session_state(). The default behavior is equivalent to having setmysql.IntegerType.UNSAFE_STRING, or calledmle_set_session_state('{"integer_type":"STRING"}').This option can also be set for a given statement using
runSQL()orprepare().