MySQL Shell API 9.1.0
Unified development interface for MySQL Products
|
Enables interaction with a MySQL Server using the MySQL Protocol. More...
Methods | |
void | close () override |
Closes the internal connection to the MySQL Server held on this session object. | |
void | commit () override |
Commits all the operations executed after a call to startTransaction(). More... | |
void | rollback () override |
Discards all the operations executed after a call to startTransaction(). More... | |
String | getUri () |
Retrieves the URI for the current session. More... | |
String | getSshUri () |
Retrieves the SSH URI for the current session. More... | |
Integer | getConnectionId () |
Retrieves the connection id for the current session. More... | |
ClassicResult | runSql (String query, Array args=[]) |
Executes a query and returns the corresponding ClassicResult object. More... | |
ClassicResult | startTransaction () |
Starts a transaction context on the server. More... | |
Bool | isOpen () |
Returns true if session is known to be open. More... | |
Undefined | setQueryAttributes (Dictionary attributes) |
Defines query attributes that apply to the next statement sent to the server for execution. More... | |
Properties | |
String | uri |
Retrieves the URI for the current session. | |
String | sshUri |
Retrieves the SSH URI for the current session. | |
Integer | connectionId |
Retrieves the connection id for the current session. | |
Enables interaction with a MySQL Server using the MySQL Protocol.
Provides facilities to execute queries.
|
override |
Commits all the operations executed after a call to startTransaction().
All the operations executed after calling startTransaction() will take place when this function is called.
The server autocommit mode will return back to it's state before calling startTransaction().
|
override |
Discards all the operations executed after a call to startTransaction().
All the operations executed after calling startTransaction() will be discarded when this function is called.
The server autocommit mode will return back to it's state before calling startTransaction().
String getUri | ( | ) |
Retrieves the URI for the current session.
String getSshUri | ( | ) |
Retrieves the SSH URI for the current session.
Integer getConnectionId | ( | ) |
Retrieves the connection id for the current session.
ClassicResult runSql | ( | String | query, |
Array | args = [] |
||
) |
Executes a query and returns the corresponding ClassicResult object.
query | the SQL query to execute against the database. |
args | Optional list of literals to use when replacing ? placeholders in the query string. |
LogicError | if there's no open session. |
ArgumentError | if the parameters are invalid. |
Undefined startTransaction | ( | ) |
Starts a transaction context on the server.
Calling this function will turn off the autocommit mode on the server.
All the operations executed after calling this function will take place only when commit() is called.
All the operations executed after calling this function, will be discarded if rollback() is called.
When commit() or rollback() are called, the server autocommit mode will return back to it's state before calling startTransaction().
Bool isOpen | ( | ) |
Returns true if session is known to be open.
Returns true if the session is still open and false otherwise.
Undefined setQueryAttributes | ( | Dictionary | attributes | ) |
Defines query attributes that apply to the next statement sent to the server for execution.
It is possible to define up to 32 pairs of attribute and values for the next executed SQL statement.
To access query attributes within SQL statements for which attributes have been defined, the query_attributes component must be installed, this component implements a mysql_query_attribute_string() loadable function that takes an attribute name argument and returns the attribute value as a string, or NULL if the attribute does not exist.
To install the query_attributes component execute the following statement: