pub struct StatementConnection<'env> { /* private fields */ }
Expand description
Statement handle which also takes ownership of Connection
Implementations§
Source§impl<'env> StatementConnection<'env>
impl<'env> StatementConnection<'env>
pub fn as_stmt_ref(&mut self) -> StatementRef<'_>
Trait Implementations§
Source§impl AsHandle for StatementConnection<'_>
impl AsHandle for StatementConnection<'_>
Source§fn as_handle(&self) -> Handle
fn as_handle(&self) -> Handle
Source§fn handle_type(&self) -> HandleType
fn handle_type(&self) -> HandleType
as_handle
. This is a method rather than a constant
in order to make the type object safe.Source§impl<'o> AsStatementRef for StatementConnection<'o>
impl<'o> AsStatementRef for StatementConnection<'o>
Source§fn as_stmt_ref(&mut self) -> StatementRef<'_>
fn as_stmt_ref(&mut self) -> StatementRef<'_>
Source§impl<'s> Drop for StatementConnection<'s>
impl<'s> Drop for StatementConnection<'s>
Source§impl Statement for StatementConnection<'_>
impl Statement for StatementConnection<'_>
Source§fn as_sys(&self) -> HStmt
fn as_sys(&self) -> HStmt
Source§unsafe fn bind_col(
&mut self,
column_number: u16,
target: &mut impl CDataMut,
) -> SqlResult<()>
unsafe fn bind_col( &mut self, column_number: u16, target: &mut impl CDataMut, ) -> SqlResult<()>
Source§unsafe fn fetch(&mut self) -> SqlResult<()>
unsafe fn fetch(&mut self) -> SqlResult<()>
Source§fn get_data(
&mut self,
col_or_param_num: u16,
target: &mut impl CDataMut,
) -> SqlResult<()>
fn get_data( &mut self, col_or_param_num: u16, target: &mut impl CDataMut, ) -> SqlResult<()>
Source§fn unbind_cols(&mut self) -> SqlResult<()>
fn unbind_cols(&mut self) -> SqlResult<()>
bind_col
. Except bookmark column.Source§unsafe fn set_num_rows_fetched(&mut self, num_rows: &mut usize) -> SqlResult<()>
unsafe fn set_num_rows_fetched(&mut self, num_rows: &mut usize) -> SqlResult<()>
Self::unset_num_rows_fetched
is going to unbind the value from the statement. Read moreSource§fn unset_num_rows_fetched(&mut self) -> SqlResult<()>
fn unset_num_rows_fetched(&mut self) -> SqlResult<()>
Self::set_num_rows_fetched
. Read moreSource§fn describe_col(
&self,
column_number: u16,
column_description: &mut ColumnDescription,
) -> SqlResult<()>
fn describe_col( &self, column_number: u16, column_description: &mut ColumnDescription, ) -> SqlResult<()>
Source§unsafe fn exec_direct(&mut self, statement: &SqlText<'_>) -> SqlResult<()>
unsafe fn exec_direct(&mut self, statement: &SqlText<'_>) -> SqlResult<()>
Source§fn close_cursor(&mut self) -> SqlResult<()>
fn close_cursor(&mut self) -> SqlResult<()>
Source§fn prepare(&mut self, statement: &SqlText<'_>) -> SqlResult<()>
fn prepare(&mut self, statement: &SqlText<'_>) -> SqlResult<()>
Source§unsafe fn execute(&mut self) -> SqlResult<()>
unsafe fn execute(&mut self) -> SqlResult<()>
prepare
. After the application processes or discards the
results from a call to execute
, the application can call SQLExecute again with new
parameter values. Read moreSource§fn num_params(&self) -> SqlResult<u16>
fn num_params(&self) -> SqlResult<u16>
Source§unsafe fn set_row_array_size(&mut self, size: usize) -> SqlResult<()>
unsafe fn set_row_array_size(&mut self, size: usize) -> SqlResult<()>
Source§unsafe fn set_paramset_size(&mut self, size: usize) -> SqlResult<()>
unsafe fn set_paramset_size(&mut self, size: usize) -> SqlResult<()>
Source§unsafe fn set_row_bind_type(&mut self, row_size: usize) -> SqlResult<()>
unsafe fn set_row_bind_type(&mut self, row_size: usize) -> SqlResult<()>
fn set_metadata_id(&mut self, metadata_id: bool) -> SqlResult<()>
Source§fn set_async_enable(&mut self, on: bool) -> SqlResult<()>
fn set_async_enable(&mut self, on: bool) -> SqlResult<()>
Source§unsafe fn bind_input_parameter(
&mut self,
parameter_number: u16,
parameter: &(impl HasDataType + CData + ?Sized),
) -> SqlResult<()>
unsafe fn bind_input_parameter( &mut self, parameter_number: u16, parameter: &(impl HasDataType + CData + ?Sized), ) -> SqlResult<()>
Statement::bind_parameter
for the version which can bind
input and output parameters. Read moreSource§unsafe fn bind_parameter(
&mut self,
parameter_number: u16,
input_output_type: ParamType,
parameter: &mut (impl CDataMut + HasDataType),
) -> SqlResult<()>
unsafe fn bind_parameter( &mut self, parameter_number: u16, input_output_type: ParamType, parameter: &mut (impl CDataMut + HasDataType), ) -> SqlResult<()>
Statement::bind_input_parameter
. Read moreSource§unsafe fn bind_delayed_input_parameter(
&mut self,
parameter_number: u16,
parameter: &mut (impl DelayedInput + HasDataType),
) -> SqlResult<()>
unsafe fn bind_delayed_input_parameter( &mut self, parameter_number: u16, parameter: &mut (impl DelayedInput + HasDataType), ) -> SqlResult<()>
Statement::bind_input_parameter
. Read moreSource§fn is_unsigned_column(&self, column_number: u16) -> SqlResult<bool>
fn is_unsigned_column(&self, column_number: u16) -> SqlResult<bool>
true
if a given column in a result set is unsigned or not a numeric type, false
otherwise. Read moreSource§fn col_type(&self, column_number: u16) -> SqlResult<SqlDataType>
fn col_type(&self, column_number: u16) -> SqlResult<SqlDataType>
Source§fn col_concise_type(&self, column_number: u16) -> SqlResult<SqlDataType>
fn col_concise_type(&self, column_number: u16) -> SqlResult<SqlDataType>
TIME
or INTERVAL_YEAR
. Read moreSource§fn col_octet_length(&self, column_number: u16) -> SqlResult<isize>
fn col_octet_length(&self, column_number: u16) -> SqlResult<isize>
Source§fn col_display_size(&self, column_number: u16) -> SqlResult<isize>
fn col_display_size(&self, column_number: u16) -> SqlResult<isize>
Source§fn col_precision(&self, column_number: u16) -> SqlResult<isize>
fn col_precision(&self, column_number: u16) -> SqlResult<isize>
Source§fn col_scale(&self, column_number: u16) -> SqlResult<Len>
fn col_scale(&self, column_number: u16) -> SqlResult<Len>
Source§fn col_name(
&self,
column_number: u16,
buffer: &mut Vec<SqlChar>,
) -> SqlResult<()>
fn col_name( &self, column_number: u16, buffer: &mut Vec<SqlChar>, ) -> SqlResult<()>
Source§unsafe fn numeric_col_attribute(
&self,
attribute: Desc,
column_number: u16,
) -> SqlResult<Len>
unsafe fn numeric_col_attribute( &self, attribute: Desc, column_number: u16, ) -> SqlResult<Len>
Source§fn reset_parameters(&mut self) -> SqlResult<()>
fn reset_parameters(&mut self) -> SqlResult<()>
Source§fn describe_param(
&self,
parameter_number: u16,
) -> SqlResult<ParameterDescription>
fn describe_param( &self, parameter_number: u16, ) -> SqlResult<ParameterDescription>
Source§fn param_data(&mut self) -> SqlResult<Option<Pointer>>
fn param_data(&mut self) -> SqlResult<Option<Pointer>>
crate::sys::DATA_AT_EXEC
or a value created with
crate::sys::len_data_at_exec
. Read moreSource§fn columns(
&mut self,
catalog_name: &SqlText<'_>,
schema_name: &SqlText<'_>,
table_name: &SqlText<'_>,
column_name: &SqlText<'_>,
) -> SqlResult<()>
fn columns( &mut self, catalog_name: &SqlText<'_>, schema_name: &SqlText<'_>, table_name: &SqlText<'_>, column_name: &SqlText<'_>, ) -> SqlResult<()>
Source§fn tables(
&mut self,
catalog_name: &SqlText<'_>,
schema_name: &SqlText<'_>,
table_name: &SqlText<'_>,
table_type: &SqlText<'_>,
) -> SqlResult<()>
fn tables( &mut self, catalog_name: &SqlText<'_>, schema_name: &SqlText<'_>, table_name: &SqlText<'_>, table_type: &SqlText<'_>, ) -> SqlResult<()>
Source§fn foreign_keys(
&mut self,
pk_catalog_name: &SqlText<'_>,
pk_schema_name: &SqlText<'_>,
pk_table_name: &SqlText<'_>,
fk_catalog_name: &SqlText<'_>,
fk_schema_name: &SqlText<'_>,
fk_table_name: &SqlText<'_>,
) -> SqlResult<()>
fn foreign_keys( &mut self, pk_catalog_name: &SqlText<'_>, pk_schema_name: &SqlText<'_>, pk_table_name: &SqlText<'_>, fk_catalog_name: &SqlText<'_>, fk_schema_name: &SqlText<'_>, fk_table_name: &SqlText<'_>, ) -> SqlResult<()>
Source§fn put_binary_batch(&mut self, batch: &[u8]) -> SqlResult<()>
fn put_binary_batch(&mut self, batch: &[u8]) -> SqlResult<()>
SqlResult::NeedData
Read moreSource§fn complete_async(
&mut self,
function_name: &'static str,
) -> SqlResult<SqlResult<()>>
fn complete_async( &mut self, function_name: &'static str, ) -> SqlResult<SqlResult<()>>
SqlResult::NoData
if no asynchronous operation is in progress, or (specific
to notification mode) the driver manager has not notified the application. Read moreSource§unsafe fn more_results(&mut self) -> SqlResult<()>
unsafe fn more_results(&mut self) -> SqlResult<()>
SqlResult::NoData
is returned to indicate that there are no more result sets. Read moreSource§fn application_row_descriptor(&mut self) -> SqlResult<Descriptor<'_>>
fn application_row_descriptor(&mut self) -> SqlResult<Descriptor<'_>>
impl<'c> Send for StatementConnection<'c>
According to the ODBC documentation this is safe. See: https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/multithreading
Operations to a statement imply that interior state of the connection might be mutated,
depending on the implementation detail of the ODBC driver. According to the ODBC documentation
this could always be considered save, since Connection handles are basically described as
Sync
. Yet making connections Send
could very well lead to different statements on different
threads actually changing the connection at the same time and truly relying on the thread safety
of the ODBC driver. I am sceptical. Especially if on Linux unixODBC would not be configured to
protect connections.
Note to users of unixodbc
: You may configure the threading level to make unixodbc
synchronize access to the driver (and thereby making them thread safe if they are not thread
safe by themself. This may however hurt your performance if the driver would actually be able to
perform operations in parallel.
See: https://stackoverflow.com/questions/4207458/using-unixodbc-in-a-multithreaded-concurrent-setting
StatementConnection
however also owns the connection exclusively. Since connections are Send
it is reasonable to assume this would work even if implementers of the ODBC driver do not care
in particular about thread safety.
Auto Trait Implementations§
impl<'env> Freeze for StatementConnection<'env>
impl<'env> RefUnwindSafe for StatementConnection<'env>
impl<'env> !Sync for StatementConnection<'env>
impl<'env> Unpin for StatementConnection<'env>
impl<'env> UnwindSafe for StatementConnection<'env>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Diagnostics for T
impl<T> Diagnostics for T
Source§fn diagnostic_record(
&self,
rec_number: i16,
message_text: &mut [u16],
) -> Option<DiagnosticResult>
fn diagnostic_record( &self, rec_number: i16, message_text: &mut [u16], ) -> Option<DiagnosticResult>
Source§fn diagnostic_record_vec(
&self,
rec_number: i16,
message_text: &mut Vec<SqlChar>,
) -> Option<DiagnosticResult>
fn diagnostic_record_vec( &self, rec_number: i16, message_text: &mut Vec<SqlChar>, ) -> Option<DiagnosticResult>
Self::diagnostic_record
, if the message does not fit in the
buffer, it will grow the message buffer and extract it again. Read more