Struct odbc_api::handles::StatementImpl [−][src]
pub struct StatementImpl<'s> { /* fields omitted */ }
Expand description
Wraps a valid (i.e. successfully allocated) ODBC statement handle.
Implementations
Trait Implementations
The raw underlying ODBC handle used to talk to the ODBC C API. The handle must be valid.
The type of the ODBC handle returned by as_handle
.
Gain access to the underlying statement handle without transferring ownership to it.
Return
Returns true
, if SQLExecuteDirect return NEED_DATA indicating the need to send data at
execution.
Executes a statement prepared by prepare
. After the application processes or discards the
results from a call to execute
, the application can call SQLExecute again with new
parameter values.
Safety
While self
as always guaranteed to be a valid allocated handle, this function may
dereference bound parameters. It is the callers responsibility to ensure these are still
valid. One strategy is to reset potentially invalid parameters right before the call using
reset_parameters
.
Return
Returns true
, if SQLExecute return NEED_DATA indicating the need to send data at
execution.
Number of columns in result set.
Can also be used to check, whether or not a result set has been created at all.
Sets the batch size for bulk cursors, if retrieving many rows at once.
Safety
It is the callers responsibility to ensure that buffers bound using bind_col
can hold the
specified amount of rows.
Specifies the number of values for each parameter. If it is greater than 1, the data and indicator buffers of the statement point to arrays. The cardinality of each array is equal to the value of this field.
Safety
The bound buffers must at least hold the number of elements specified in this call then the statement is executed.
Sets the binding type to columnar binding for batch cursors.
Any Positive number indicates a row wise binding with that row length. 0
indicates a
columnar binding.
Safety
It is the callers responsibility to ensure that the bound buffers match the memory layout specified by this function.
unsafe fn bind_input_parameter(
&mut self,
parameter_number: u16,
parameter: &impl HasDataType + CData + ?Sized
) -> Result<(), Error>
unsafe fn bind_input_parameter(
&mut self,
parameter_number: u16,
parameter: &impl HasDataType + CData + ?Sized
) -> Result<(), Error>
Binds a buffer holding an input parameter to a parameter marker in an SQL statement. This
specialized version takes a constant reference to parameter, but is therefore limited to
binding input parameters. See Statement::bind_parameter
for the version which can bind
input and output parameters.
See https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlbindparameter-function.
Safety
- It is up to the caller to ensure the lifetimes of the bound parameters.
- Calling this function may influence other statements that share the APD.
unsafe fn bind_parameter(
&mut self,
parameter_number: u16,
input_output_type: ParamType,
parameter: &mut impl CDataMut + HasDataType
) -> Result<(), Error>
unsafe fn bind_parameter(
&mut self,
parameter_number: u16,
input_output_type: ParamType,
parameter: &mut impl CDataMut + HasDataType
) -> Result<(), Error>
Binds a buffer holding a single parameter to a parameter marker in an SQL statement. To bind
input parameters using constant references see Statement::bind_input_parameter
.
See https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlbindparameter-function.
Safety
- It is up to the caller to ensure the lifetimes of the bound parameters.
- Calling this function may influence other statements that share the APD.
unsafe fn bind_delayed_input_parameter(
&mut self,
parameter_number: u16,
parameter: &mut impl DelayedInput + HasDataType
) -> Result<(), Error>
unsafe fn bind_delayed_input_parameter(
&mut self,
parameter_number: u16,
parameter: &mut impl DelayedInput + HasDataType
) -> Result<(), Error>
Binds an input stream to a parameter marker in an SQL statement. Use this to stream large
values at statement execution time. To bind preallocated constant buffers see
Statement::bind_input_parameter
.
See https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlbindparameter-function.
Safety
- It is up to the caller to ensure the lifetimes of the bound parameters.
- Calling this function may influence other statements that share the APD.
true
if a given column in a result set is unsigned or not a numeric type, false
otherwise.
column_number
: Index of the column, starting at 1.
Returns a number identifying the SQL type of the column in the result set.
column_number
: Index of the column, starting at 1.
The concise data type. For the datetime and interval data types, this field returns the
concise data type; for example, TIME
or INTERVAL_YEAR
.
column_number
: Index of the column, starting at 1.
Data type of the specified column.
column_number
: Index of the column, starting at 1.
Returns the size in bytes of the columns. For variable sized types the maximum size is returned, excluding a terminating zero.
column_number
: Index of the column, starting at 1.
Maximum number of characters required to display data from the column.
column_number
: Index of the column, starting at 1.
Precision of the column.
Denotes the applicable precision. For data types SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, and all the interval data types that represent a time interval, its value is the applicable precision of the fractional seconds component.
The applicable scale for a numeric data type. For DECIMAL and NUMERIC data types, this is the defined scale. It is undefined for all other data types.
The column alias, if it applies. If the column alias does not apply, the column name is returned. If there is no column name or a column alias, an empty string is returned.
Safety
It is the callers responsibility to ensure that attribute
refers to a numeric attribute.
Sets the SQL_DESC_COUNT field of the APD to 0, releasing all parameter buffers set for the given StatementHandle.
Describes parameter marker associated with a prepared SQL statement.
Parameters
parameter_number
: Parameter marker number ordered sequentially in increasing parameter order, starting at 1.
Use to check if which additional parameters need data. Should be called after binding
parameters with an indicator set to crate::sys::DATA_AT_EXEC
or a value created with
crate::sys::len_data_at_exec
.
Return value contains a parameter identifier passed to bind parameter as a value pointer.
Executes a columns query using this statement handle.
To put a batch of binary data into the data source at statement execution time. Returns true
if the NEED_DATA
is returned by the driver.
Panics if batch is empty.
Binds application data buffers to columns in the result set. Read more
Returns the next row set in the result set. Read more
Retrieves data for a single column in the result set or for a single parameter.
Release all column buffers bound by bind_col
. Except bookmark column.
Bind an integer to hold the number of rows retrieved with fetch in the current row set.
Passing None
for num_rows
is going to unbind the value from the statement. Read more
fn describe_col(
&self,
column_number: u16,
column_description: &mut ColumnDescription
) -> Result<(), Error>
fn describe_col(
&self,
column_number: u16,
column_description: &mut ColumnDescription
) -> Result<(), Error>
Fetch a column description using the column index. Read more
Close an open cursor.
Send an SQL statement to the data source for preparation. The application can include one or more parameter markers in the SQL statement. To include a parameter marker, the application embeds a question mark (?) into the SQL string at the appropriate position. Read more
Auto Trait Implementations
impl<'s> RefUnwindSafe for StatementImpl<'s>
impl<'s> !Send for StatementImpl<'s>
impl<'s> !Sync for StatementImpl<'s>
impl<'s> Unpin for StatementImpl<'s>
impl<'s> UnwindSafe for StatementImpl<'s>