pub struct SqlClient { /* private fields */ }Expand description
A SQL service client.
§Examples
use std::sync::Arc;
use tsubakuro_rust_core::prelude::*;
async fn example(session: &Arc<Session>) -> Result<(), TgError> {
let client: SqlClient = session.make_client();
// In Tsurugi, DDL is also executed in a transaction.
// (DDL and DML must not be executed in the same transaction)
let transaction = client.start_transaction(&TransactionOption::default()).await?;
let result = {
let sql = "
create table customer (
c_id bigint primary key,
c_name varchar(30) not null,
c_age int
)
";
let result = client.execute(&transaction, sql).await;
match result {
Ok(_) => client.commit(&transaction, &CommitOption::default()).await,
Err(e) => Err(e)
}
};
transaction.close().await?;
result?;
let table_list = client.list_tables().await?;
let table_metadata = client.get_table_metadata("customer").await?;
Ok(())
}Implementations§
Source§impl SqlClient
impl SqlClient
Sourcepub fn service_message_version() -> String
pub fn service_message_version() -> String
Get service message version.
Sourcepub fn set_default_timeout(&mut self, timeout: Duration)
pub fn set_default_timeout(&mut self, timeout: Duration)
Set default timeout.
Sourcepub fn default_timeout(&self) -> Duration
pub fn default_timeout(&self) -> Duration
Get default timeout.
Source§impl SqlClient
impl SqlClient
Sourcepub async fn list_tables(&self) -> Result<TableList, TgError>
pub async fn list_tables(&self) -> Result<TableList, TgError>
Returns the list of available table names in the database, except system tables.
The table names are each fully qualified (maybe with a schema name). To retrieve more details for the individual tables, you can use Self::get_table_metadata.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient) -> Result<(), TgError> {
let table_list = client.list_tables().await?;
let table_names = table_list.table_names();
for table_name in table_names {
println!("{}", table_name);
}
Ok(())
}Sourcepub async fn list_tables_for(
&self,
timeout: Duration,
) -> Result<TableList, TgError>
pub async fn list_tables_for( &self, timeout: Duration, ) -> Result<TableList, TgError>
Returns the list of available table names in the database, except system tables.
The table names are each fully qualified (maybe with a schema name). To retrieve more details for the individual tables, you can use Self::get_table_metadata_for.
Sourcepub async fn list_tables_async(&self) -> Result<Job<TableList>, TgError>
pub async fn list_tables_async(&self) -> Result<Job<TableList>, TgError>
Returns the list of available table names in the database, except system tables.
The table names are each fully qualified (maybe with a schema name). To retrieve more details for the individual tables, you can use Self::get_table_metadata_async.
Sourcepub async fn get_table_metadata(
&self,
table_name: &str,
) -> Result<TableMetadata, TgError>
pub async fn get_table_metadata( &self, table_name: &str, ) -> Result<TableMetadata, TgError>
Retrieves metadata for a table.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient) -> Result<(), TgError> {
let table_metadata = client.get_table_metadata("customer").await?;
println!("table name={}", table_metadata.table_name());
let columns = table_metadata.columns();
for column in columns {
println!("column name={}", column.name());
}
Ok(())
}Sourcepub async fn get_table_metadata_for(
&self,
table_name: &str,
timeout: Duration,
) -> Result<TableMetadata, TgError>
pub async fn get_table_metadata_for( &self, table_name: &str, timeout: Duration, ) -> Result<TableMetadata, TgError>
Retrieves metadata for a table.
Sourcepub async fn get_table_metadata_async(
&self,
table_name: &str,
) -> Result<Job<TableMetadata>, TgError>
pub async fn get_table_metadata_async( &self, table_name: &str, ) -> Result<Job<TableMetadata>, TgError>
Retrieves metadata for a table.
Sourcepub async fn prepare(
&self,
sql: &str,
placeholders: Vec<SqlPlaceholder>,
) -> Result<SqlPreparedStatement, TgError>
pub async fn prepare( &self, sql: &str, placeholders: Vec<SqlPlaceholder>, ) -> Result<SqlPreparedStatement, TgError>
Prepares a SQL statement.
Note: Should invoke SqlPreparedStatement::close before SqlPreparedStatement::drop to dispose the prepared statement.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient) -> Result<(), TgError> {
let sql = "insert into customer values(:id, :name, :age)";
let placeholders = vec![
SqlPlaceholder::of::<i64>("id"),
SqlPlaceholder::of::<String>("name"),
SqlPlaceholder::of::<i32>("age"),
];
let prepared_statement = client.prepare(sql, placeholders).await?;
prepared_statement.close().await?;
Ok(())
}Sourcepub async fn prepare_for(
&self,
sql: &str,
placeholders: Vec<SqlPlaceholder>,
timeout: Duration,
) -> Result<SqlPreparedStatement, TgError>
pub async fn prepare_for( &self, sql: &str, placeholders: Vec<SqlPlaceholder>, timeout: Duration, ) -> Result<SqlPreparedStatement, TgError>
Prepares a SQL statement.
Note: Should invoke SqlPreparedStatement::close before SqlPreparedStatement::drop to dispose the prepared statement.
Sourcepub async fn prepare_async(
&self,
sql: &str,
placeholders: Vec<SqlPlaceholder>,
) -> Result<Job<SqlPreparedStatement>, TgError>
pub async fn prepare_async( &self, sql: &str, placeholders: Vec<SqlPlaceholder>, ) -> Result<Job<SqlPreparedStatement>, TgError>
Prepares a SQL statement.
Note: Should invoke SqlPreparedStatement::close before SqlPreparedStatement::drop to dispose the prepared statement.
Sourcepub async fn explain(&self, sql: &str) -> Result<SqlExplainResult, TgError>
pub async fn explain(&self, sql: &str) -> Result<SqlExplainResult, TgError>
Retrieves execution plan of the statement.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient) -> Result<(), TgError> {
let sql = "select * from customer oder by c_id";
let explain_result = client.explain(sql).await?;
println!("json={}", explain_result.contents());
Ok(())
}Sourcepub async fn explain_for(
&self,
sql: &str,
timeout: Duration,
) -> Result<SqlExplainResult, TgError>
pub async fn explain_for( &self, sql: &str, timeout: Duration, ) -> Result<SqlExplainResult, TgError>
Retrieves execution plan of the statement.
Sourcepub async fn explain_async(
&self,
sql: &str,
) -> Result<Job<SqlExplainResult>, TgError>
pub async fn explain_async( &self, sql: &str, ) -> Result<Job<SqlExplainResult>, TgError>
Retrieves execution plan of the statement.
Sourcepub async fn prepared_explain(
&self,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<SqlExplainResult, TgError>
pub async fn prepared_explain( &self, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<SqlExplainResult, TgError>
Retrieves execution plan of the statement.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, prepared_statement: &SqlPreparedStatement) -> Result<(), TgError> {
// prepared_statement: "select * from customer where c_id = :id"
let parameters = vec![SqlParameter::of("id", 3_i64)];
let explain_result = client.prepared_explain(prepared_statement, parameters).await?;
println!("json={}", explain_result.contents());
Ok(())
}Sourcepub async fn prepared_explain_for(
&self,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
timeout: Duration,
) -> Result<SqlExplainResult, TgError>
pub async fn prepared_explain_for( &self, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, timeout: Duration, ) -> Result<SqlExplainResult, TgError>
Retrieves execution plan of the statement.
Sourcepub async fn prepared_explain_async(
&self,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<Job<SqlExplainResult>, TgError>
pub async fn prepared_explain_async( &self, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<Job<SqlExplainResult>, TgError>
Retrieves execution plan of the statement.
Sourcepub async fn start_transaction(
&self,
transaction_option: &TransactionOption,
) -> Result<Transaction, TgError>
pub async fn start_transaction( &self, transaction_option: &TransactionOption, ) -> Result<Transaction, TgError>
Starts a new transaction.
Note: Should invoke Transaction::close before Transaction::drop to dispose the transaction.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction_option: &TransactionOption) -> Result<(), TgError> {
let transaction = client.start_transaction(transaction_option).await?;
let result = client.commit(&transaction, &CommitOption::default()).await;
transaction.close().await?;
result
}Sourcepub async fn start_transaction_for(
&self,
transaction_option: &TransactionOption,
timeout: Duration,
) -> Result<Transaction, TgError>
pub async fn start_transaction_for( &self, transaction_option: &TransactionOption, timeout: Duration, ) -> Result<Transaction, TgError>
Starts a new transaction.
Note: Should invoke Transaction::close before Transaction::drop to dispose the transaction.
Sourcepub async fn start_transaction_async(
&self,
transaction_option: &TransactionOption,
) -> Result<Job<Transaction>, TgError>
pub async fn start_transaction_async( &self, transaction_option: &TransactionOption, ) -> Result<Job<Transaction>, TgError>
Starts a new transaction.
Note: Should invoke Transaction::close before Transaction::drop to dispose the transaction.
Sourcepub async fn get_transaction_error_info(
&self,
transaction: &Transaction,
) -> Result<TransactionErrorInfo, TgError>
pub async fn get_transaction_error_info( &self, transaction: &Transaction, ) -> Result<TransactionErrorInfo, TgError>
Returns occurred error in the target transaction.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
let status = client.get_transaction_error_info(transaction).await?;
println!("is_error={}", status.is_error());
if let Some(code) = status.diagnostic_code() {
println!("diagnostic_code={}", code);
}
Ok(())
}since 0.2.0
Sourcepub async fn get_transaction_error_info_for(
&self,
transaction: &Transaction,
timeout: Duration,
) -> Result<TransactionErrorInfo, TgError>
pub async fn get_transaction_error_info_for( &self, transaction: &Transaction, timeout: Duration, ) -> Result<TransactionErrorInfo, TgError>
Returns occurred error in the target transaction.
since 0.2.0
Sourcepub async fn get_transaction_error_info_async(
&self,
transaction: &Transaction,
) -> Result<Job<TransactionErrorInfo>, TgError>
pub async fn get_transaction_error_info_async( &self, transaction: &Transaction, ) -> Result<Job<TransactionErrorInfo>, TgError>
Returns occurred error in the target transaction.
since 0.2.0
Sourcepub async fn get_transaction_status(
&self,
transaction: &Transaction,
) -> Result<TransactionStatusWithMessage, TgError>
pub async fn get_transaction_status( &self, transaction: &Transaction, ) -> Result<TransactionStatusWithMessage, TgError>
Get the transaction status on the server.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
let status = client.get_transaction_status(transaction).await?;
println!("status={:?}", status.status());
println!("message={}", status.message());
Ok(())
}since 0.2.0
Sourcepub async fn get_transaction_status_for(
&self,
transaction: &Transaction,
timeout: Duration,
) -> Result<TransactionStatusWithMessage, TgError>
pub async fn get_transaction_status_for( &self, transaction: &Transaction, timeout: Duration, ) -> Result<TransactionStatusWithMessage, TgError>
Get the transaction status on the server.
since 0.2.0
Sourcepub async fn get_transaction_status_async(
&self,
transaction: &Transaction,
) -> Result<Job<TransactionStatusWithMessage>, TgError>
pub async fn get_transaction_status_async( &self, transaction: &Transaction, ) -> Result<Job<TransactionStatusWithMessage>, TgError>
Get the transaction status on the server.
since 0.2.0
Sourcepub async fn execute(
&self,
transaction: &Transaction,
sql: &str,
) -> Result<SqlExecuteResult, TgError>
pub async fn execute( &self, transaction: &Transaction, sql: &str, ) -> Result<SqlExecuteResult, TgError>
Executes a SQL statement.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
let sql = "insert into customer values(4, 'example', 20)";
let execute_result = client.execute(&transaction, sql).await?;
println!("inserted rows={}", execute_result.inserted_rows());
Ok(())
}Sourcepub async fn execute_for(
&self,
transaction: &Transaction,
sql: &str,
timeout: Duration,
) -> Result<SqlExecuteResult, TgError>
pub async fn execute_for( &self, transaction: &Transaction, sql: &str, timeout: Duration, ) -> Result<SqlExecuteResult, TgError>
Executes a SQL statement.
Sourcepub async fn execute_async(
&self,
transaction: &Transaction,
sql: &str,
) -> Result<Job<SqlExecuteResult>, TgError>
pub async fn execute_async( &self, transaction: &Transaction, sql: &str, ) -> Result<Job<SqlExecuteResult>, TgError>
Executes a SQL statement.
Sourcepub async fn prepared_execute(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<SqlExecuteResult, TgError>
pub async fn prepared_execute( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<SqlExecuteResult, TgError>
Executes a SQL statement.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, prepared_statement: &SqlPreparedStatement) -> Result<(), TgError> {
// prepared_statement: "insert into customer values(:id, :name, :age)"
let parameters = vec![
SqlParameter::of("id", 4_i64),
SqlParameter::of("name", "example"),
SqlParameter::of("age", 20),
];
let execute_result = client.prepared_execute(&transaction, prepared_statement, parameters).await?;
println!("inserted rows={}", execute_result.inserted_rows());
Ok(())
}Sourcepub async fn prepared_execute_for(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
timeout: Duration,
) -> Result<SqlExecuteResult, TgError>
pub async fn prepared_execute_for( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, timeout: Duration, ) -> Result<SqlExecuteResult, TgError>
Executes a SQL statement.
Sourcepub async fn prepared_execute_async(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<Job<SqlExecuteResult>, TgError>
pub async fn prepared_execute_async( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<Job<SqlExecuteResult>, TgError>
Executes a SQL statement.
Sourcepub async fn query(
&self,
transaction: &Transaction,
sql: &str,
) -> Result<SqlQueryResult, TgError>
pub async fn query( &self, transaction: &Transaction, sql: &str, ) -> Result<SqlQueryResult, TgError>
Executes a SQL statement and retrieve its result.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
let sql = "select c_id, c_name, c_age from customer order by c_id";
let mut query_result = client.query(&transaction, sql).await?;
while query_result.next_row().await? {
if query_result.next_column().await? {
let id: i64 = query_result.fetch().await?;
}
if query_result.next_column().await? {
let name: Option<String> = query_result.fetch().await?;
}
if query_result.next_column().await? {
let age: Option<i32> = query_result.fetch().await?;
}
}
query_result.close().await?;
Ok(())
}Sourcepub async fn query_for(
&self,
transaction: &Transaction,
sql: &str,
timeout: Duration,
) -> Result<SqlQueryResult, TgError>
pub async fn query_for( &self, transaction: &Transaction, sql: &str, timeout: Duration, ) -> Result<SqlQueryResult, TgError>
Executes a SQL statement and retrieve its result.
Sourcepub async fn query_async(
&self,
transaction: &Transaction,
sql: &str,
) -> Result<Job<SqlQueryResult>, TgError>
pub async fn query_async( &self, transaction: &Transaction, sql: &str, ) -> Result<Job<SqlQueryResult>, TgError>
Executes a SQL statement and retrieve its result.
Sourcepub async fn prepared_query(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<SqlQueryResult, TgError>
pub async fn prepared_query( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<SqlQueryResult, TgError>
Executes a SQL statement and retrieve its result.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, prepared_statement: &SqlPreparedStatement) -> Result<(), TgError> {
// prepared_statement: "select c_id, c_name, c_age from customer where c_id = :id"
let parameters = vec![SqlParameter::of("id", 3_i64)];
let mut query_result = client.prepared_query(&transaction, prepared_statement, parameters).await?;
while query_result.next_row().await? {
if query_result.next_column().await? {
let id: i64 = query_result.fetch().await?;
}
if query_result.next_column().await? {
let name: Option<String> = query_result.fetch().await?;
}
if query_result.next_column().await? {
let age: Option<i32> = query_result.fetch().await?;
}
}
query_result.close().await?;
Ok(())
}Sourcepub async fn prepared_query_for(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
timeout: Duration,
) -> Result<SqlQueryResult, TgError>
pub async fn prepared_query_for( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, timeout: Duration, ) -> Result<SqlQueryResult, TgError>
Executes a SQL statement and retrieve its result.
Sourcepub async fn prepared_query_async(
&self,
transaction: &Transaction,
prepared_statement: &SqlPreparedStatement,
parameters: Vec<SqlParameter>,
) -> Result<Job<SqlQueryResult>, TgError>
pub async fn prepared_query_async( &self, transaction: &Transaction, prepared_statement: &SqlPreparedStatement, parameters: Vec<SqlParameter>, ) -> Result<Job<SqlQueryResult>, TgError>
Executes a SQL statement and retrieve its result.
Sourcepub async fn open_blob(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<File, TgError>
pub async fn open_blob( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<File, TgError>
Open BLOB file.
§Examples
use std::io::Read;
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<Vec<u8>, TgError> {
let blob: TgBlobReference = query_result.fetch().await?;
let mut file = client.open_blob(transaction, &blob).await?;
let mut buffer = Vec::new();
file.read_to_end(&mut buffer).unwrap();
Ok(buffer)
}Sourcepub async fn open_blob_for(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
timeout: Duration,
) -> Result<File, TgError>
pub async fn open_blob_for( &self, transaction: &Transaction, blob: &TgBlobReference, timeout: Duration, ) -> Result<File, TgError>
Open BLOB file.
Sourcepub async fn open_blob_async(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<Job<File>, TgError>
pub async fn open_blob_async( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<Job<File>, TgError>
Open BLOB file.
Sourcepub async fn open_clob(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<File, TgError>
pub async fn open_clob( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<File, TgError>
Open CLOB file.
§Examples
use std::io::Read;
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<String, TgError> {
let clob: TgClobReference = query_result.fetch().await?;
let mut file = client.open_clob(transaction, &clob).await?;
let mut buffer = String::new();
file.read_to_string(&mut buffer).unwrap();
Ok(buffer)
}Sourcepub async fn open_clob_for(
&self,
transaction: &Transaction,
clob: &TgClobReference,
timeout: Duration,
) -> Result<File, TgError>
pub async fn open_clob_for( &self, transaction: &Transaction, clob: &TgClobReference, timeout: Duration, ) -> Result<File, TgError>
Open CLOB file.
Sourcepub async fn open_clob_async(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<Job<File>, TgError>
pub async fn open_clob_async( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<Job<File>, TgError>
Open CLOB file.
Sourcepub async fn get_blob_cache(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<TgLargeObjectCache, TgError>
pub async fn get_blob_cache( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<TgLargeObjectCache, TgError>
Get BLOB cache.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<(), TgError> {
let blob: TgBlobReference = query_result.fetch().await?;
let cache = client.get_blob_cache(transaction, &blob).await?;
println!("BLOB.path={:?}", cache.path());
Ok(())
}since 0.5.0
Sourcepub async fn get_blob_cache_for(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
timeout: Duration,
) -> Result<TgLargeObjectCache, TgError>
pub async fn get_blob_cache_for( &self, transaction: &Transaction, blob: &TgBlobReference, timeout: Duration, ) -> Result<TgLargeObjectCache, TgError>
Get BLOB cache.
since 0.5.0
Sourcepub async fn get_blob_cache_async(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<Job<TgLargeObjectCache>, TgError>
pub async fn get_blob_cache_async( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<Job<TgLargeObjectCache>, TgError>
Get BLOB cache.
since 0.5.0
Sourcepub async fn get_clob_cache(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<TgLargeObjectCache, TgError>
pub async fn get_clob_cache( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<TgLargeObjectCache, TgError>
Get CLOB cache.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<(), TgError> {
let clob: TgClobReference = query_result.fetch().await?;
let cache = client.get_clob_cache(transaction, &clob).await?;
println!("CLOB.path={:?}", cache.path());
Ok(())
}since 0.5.0
Sourcepub async fn get_clob_cache_for(
&self,
transaction: &Transaction,
clob: &TgClobReference,
timeout: Duration,
) -> Result<TgLargeObjectCache, TgError>
pub async fn get_clob_cache_for( &self, transaction: &Transaction, clob: &TgClobReference, timeout: Duration, ) -> Result<TgLargeObjectCache, TgError>
Get CLOB cache.
since 0.5.0
Sourcepub async fn get_clob_cache_async(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<Job<TgLargeObjectCache>, TgError>
pub async fn get_clob_cache_async( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<Job<TgLargeObjectCache>, TgError>
Get CLOB cache.
since 0.5.0
Sourcepub async fn read_blob(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<Vec<u8>, TgError>
pub async fn read_blob( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<Vec<u8>, TgError>
Read BLOB.
§Examples
use std::io::Read;
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<Vec<u8>, TgError> {
let blob: TgBlobReference = query_result.fetch().await?;
let bytes = client.read_blob(transaction, &blob).await?;
Ok(bytes)
}since 0.2.0
Sourcepub async fn read_blob_for(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
timeout: Duration,
) -> Result<Vec<u8>, TgError>
pub async fn read_blob_for( &self, transaction: &Transaction, blob: &TgBlobReference, timeout: Duration, ) -> Result<Vec<u8>, TgError>
Read BLOB.
since 0.2.0
Sourcepub async fn read_blob_async(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
) -> Result<Job<Vec<u8>>, TgError>
pub async fn read_blob_async( &self, transaction: &Transaction, blob: &TgBlobReference, ) -> Result<Job<Vec<u8>>, TgError>
Read BLOB.
since 0.2.0
Sourcepub async fn read_clob(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<String, TgError>
pub async fn read_clob( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<String, TgError>
Read CLOB.
§Examples
use std::io::Read;
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<String, TgError> {
let clob: TgClobReference = query_result.fetch().await?;
let text = client.read_clob(transaction, &clob).await?;
Ok(text)
}since 0.2.0
Sourcepub async fn read_clob_for(
&self,
transaction: &Transaction,
clob: &TgClobReference,
timeout: Duration,
) -> Result<String, TgError>
pub async fn read_clob_for( &self, transaction: &Transaction, clob: &TgClobReference, timeout: Duration, ) -> Result<String, TgError>
Read CLOB.
since 0.2.0
Sourcepub async fn read_clob_async(
&self,
transaction: &Transaction,
clob: &TgClobReference,
) -> Result<Job<String>, TgError>
pub async fn read_clob_async( &self, transaction: &Transaction, clob: &TgClobReference, ) -> Result<Job<String>, TgError>
Read CLOB.
since 0.2.0
Sourcepub async fn copy_blob_to<T: AsRef<Path>>(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
destination: T,
) -> Result<(), TgError>
pub async fn copy_blob_to<T: AsRef<Path>>( &self, transaction: &Transaction, blob: &TgBlobReference, destination: T, ) -> Result<(), TgError>
Copy BLOB to local file.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<(), TgError> {
let blob: TgBlobReference = query_result.fetch().await?;
client.copy_blob_to(transaction, &blob, "/path/to/blob.bin").await?;
Ok(())
}Sourcepub async fn copy_blob_to_for<T: AsRef<Path>>(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
destination: T,
timeout: Duration,
) -> Result<(), TgError>
pub async fn copy_blob_to_for<T: AsRef<Path>>( &self, transaction: &Transaction, blob: &TgBlobReference, destination: T, timeout: Duration, ) -> Result<(), TgError>
Copy BLOB to local file.
Sourcepub async fn copy_blob_to_async<T: AsRef<Path> + Send + Clone + 'static>(
&self,
transaction: &Transaction,
blob: &TgBlobReference,
destination: T,
) -> Result<Job<()>, TgError>
pub async fn copy_blob_to_async<T: AsRef<Path> + Send + Clone + 'static>( &self, transaction: &Transaction, blob: &TgBlobReference, destination: T, ) -> Result<Job<()>, TgError>
Copy BLOB to local file.
Sourcepub async fn copy_clob_to<T: AsRef<Path>>(
&self,
transaction: &Transaction,
clob: &TgClobReference,
destination: T,
) -> Result<(), TgError>
pub async fn copy_clob_to<T: AsRef<Path>>( &self, transaction: &Transaction, clob: &TgClobReference, destination: T, ) -> Result<(), TgError>
Copy CLOB to local file.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction, query_result: &mut SqlQueryResult) -> Result<(), TgError> {
let clob: TgClobReference = query_result.fetch().await?;
client.copy_clob_to(transaction, &clob, "/path/to/clob.txt").await?;
Ok(())
}Sourcepub async fn copy_clob_to_for<T: AsRef<Path>>(
&self,
transaction: &Transaction,
clob: &TgClobReference,
destination: T,
timeout: Duration,
) -> Result<(), TgError>
pub async fn copy_clob_to_for<T: AsRef<Path>>( &self, transaction: &Transaction, clob: &TgClobReference, destination: T, timeout: Duration, ) -> Result<(), TgError>
Copy CLOB to local file.
Sourcepub async fn copy_clob_to_async<T: AsRef<Path> + Send + Clone + 'static>(
&self,
transaction: &Transaction,
clob: &TgClobReference,
destination: T,
) -> Result<Job<()>, TgError>
pub async fn copy_clob_to_async<T: AsRef<Path> + Send + Clone + 'static>( &self, transaction: &Transaction, clob: &TgClobReference, destination: T, ) -> Result<Job<()>, TgError>
Copy CLOB to local file.
Sourcepub async fn commit(
&self,
transaction: &Transaction,
commit_option: &CommitOption,
) -> Result<(), TgError>
pub async fn commit( &self, transaction: &Transaction, commit_option: &CommitOption, ) -> Result<(), TgError>
Request commit to the SQL service.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
let commit_option = CommitOption::default();
client.commit(transaction, &commit_option).await?;
Ok(())
}Sourcepub async fn commit_for(
&self,
transaction: &Transaction,
commit_option: &CommitOption,
timeout: Duration,
) -> Result<(), TgError>
pub async fn commit_for( &self, transaction: &Transaction, commit_option: &CommitOption, timeout: Duration, ) -> Result<(), TgError>
Request commit to the SQL service.
Sourcepub async fn commit_async(
&self,
transaction: &Transaction,
commit_option: &CommitOption,
) -> Result<Job<()>, TgError>
pub async fn commit_async( &self, transaction: &Transaction, commit_option: &CommitOption, ) -> Result<Job<()>, TgError>
Request commit to the SQL service.
Sourcepub async fn rollback(&self, transaction: &Transaction) -> Result<(), TgError>
pub async fn rollback(&self, transaction: &Transaction) -> Result<(), TgError>
Request rollback to the SQL service.
§Examples
use tsubakuro_rust_core::prelude::*;
async fn example(client: &SqlClient, transaction: &Transaction) -> Result<(), TgError> {
client.rollback(transaction).await?;
Ok(())
}Sourcepub async fn rollback_for(
&self,
transaction: &Transaction,
timeout: Duration,
) -> Result<(), TgError>
pub async fn rollback_for( &self, transaction: &Transaction, timeout: Duration, ) -> Result<(), TgError>
Request rollback to the SQL service.
Sourcepub async fn rollback_async(
&self,
transaction: &Transaction,
) -> Result<Job<()>, TgError>
pub async fn rollback_async( &self, transaction: &Transaction, ) -> Result<Job<()>, TgError>
Request rollback to the SQL service.