MySQL Shell API 8.0.40
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 | start_transaction () override |
Starts a transaction context on the server. More... | |
void | commit () override |
Commits all the operations executed after a call to start_transaction(). More... | |
void | rollback () override |
Discards all the operations executed after a call to start_transaction(). More... | |
str | get_uri () |
Retrieves the URI for the current session. More... | |
str | get_ssh_uri () |
Retrieves the SSH URI for the current session. More... | |
ClassicResult | run_sql (str query, list args=[]) |
Executes a query and returns the corresponding ClassicResult object. More... | |
ClassicResult | query (str query, list args=[]) |
Executes a query and returns the corresponding ClassicResult object. More... | |
bool | is_open () |
Returns true if session is known to be open. More... | |
Properties | |
str | uri |
Same as get_uri() | |
str | ssh_uri |
Same as get_ssh_uri() | |
Enables interaction with a MySQL Server using the MySQL Protocol.
Provides facilities to execute queries.
|
override |
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 start_transaction().
|
override |
Commits all the operations executed after a call to start_transaction().
All the operations executed after calling start_transaction() will take place when this function is called.
The server autocommit mode will return back to it's state before calling start_transaction().
|
override |
Discards all the operations executed after a call to start_transaction().
All the operations executed after calling start_transaction() will be discarded when this function is called.
The server autocommit mode will return back to it's state before calling start_transaction().
str get_uri | ( | ) |
Retrieves the URI for the current session.
str get_ssh_uri | ( | ) |
Retrieves the SSH URI for the current session.
ClassicResult run_sql | ( | str | query, |
list | 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. |
ClassicResult query | ( | str | query, |
list | args = [] |
||
) |
Executes a query and returns the corresponding ClassicResult object.
query | the SQL query string to execute, with optional ? placeholders. |
args | Optional list of literals to use when replacing ? placeholders in the query string. |
An | exception is thrown if an error occurs on the SQL execution. |
bool is_open | ( | ) |
Returns true if session is known to be open.
Returns true if the session is still open and false otherwise.