Expand description
tsubakuro-rust-core is the core library to access Tsurugi written in Rust.
§Overview
The procedure for executing SQL in tsubakuro-rust-core is generally as follows.
- Create a
Session
(to connect to the Tsurugi DB server).- Create a
ConnectionOption
. - Set endpoint url (e.g.
tcp://localhost:12345
), etc to ConnectionOption. - Invoke
Session::connect()
.
- Create a
- Make a
SqlClient
from Session.- Invoke
Session::make_client()
.
- Invoke
- When using prepared statement, create a
SqlPreparedStatement
from SqlClient.- Invoke
SqlClient::prepare()
.
- Invoke
- Start a transaction (create a
Transaction
from SqlClient).- Create a
TransactionOption
. - Set
TransactionType
, etc to TransactionOption. - Invoke
SqlClient::start_transaction()
.
- Create a
- Execute SQL using SqlClient, Transaction (and SqlPreparedStatement).
- Commit transaction.
- Create a
CommitOption
. - Set
CommitType
, etc to CommitOption. - Invoke
SqlClient::commit()
.
- Create a
- Close transaction.
- Invoke
Transaction::close()
.
- Invoke
- Close prepared statement if created.
- Invoke
SqlPreparedStatement::close()
.
- Invoke
- Close session.
- Invoke
Session::close()
.
- Invoke
§Examples
See https://github.com/project-tsurugi/tsubakuro-rust/tree/master/tsubakuro-rust-core#example.