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

impl<'s> StatementImpl<'s>[src]

pub unsafe fn new(handle: HStmt) -> Self[src]

Safety

handle must be a valid (successfully allocated) statement handle.

pub fn into_sys(self) -> HStmt[src]

Transfer ownership of this statement to a raw system handle. It is the users responsibility to call crate::sys::SQLFreeHandle.

pub fn as_sys(&self) -> HStmt[src]

Gain access to the underlying statement handle without transfering owenership to it.

Trait Implementations

impl<'c> AsHandle for StatementImpl<'c>[src]

fn as_handle(&self) -> Handle[src]

The raw underlying ODBC handle used to talk to the ODBC C API. The handle must be valid.

fn handle_type(&self) -> HandleType[src]

The type of the ODBC handle returned by as_handle.

impl<'s> Drop for StatementImpl<'s>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'o> Statement for StatementImpl<'o>[src]

unsafe fn execute(&mut self) -> Result<bool, Error>[src]

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

If an update, insert, or delete statement did not affect any rows at the data source false is returned.

fn num_result_cols(&self) -> Result<i16, Error>[src]

Number of columns in result set.

Can also be used to check, whether or not a result set has been created at all.

unsafe fn set_row_array_size(&mut self, size: u32) -> Result<(), Error>[src]

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.

unsafe fn set_paramset_size(&mut self, size: u32) -> Result<(), Error>[src]

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.

unsafe fn set_row_bind_type(&mut self, row_size: u32) -> Result<(), Error>[src]

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 + ?Sized
) -> Result<(), Error>
[src]

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>
[src]

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.

fn is_unsigned_column(&self, column_number: u16) -> Result<bool, Error>[src]

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.

fn col_type(&self, column_number: u16) -> Result<SqlDataType, Error>[src]

Returns a number identifying the SQL type of the column in the result set.

column_number: Index of the column, starting at 1.

fn col_concise_type(&self, column_number: u16) -> Result<SqlDataType, Error>[src]

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.

fn col_data_type(&self, column_number: u16) -> Result<DataType, Error>[src]

Data type of the specified column.

column_number: Index of the column, starting at 1.

fn col_octet_length(&self, column_number: u16) -> Result<Len, Error>[src]

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.

fn col_display_size(&self, column_number: u16) -> Result<Len, Error>[src]

Maximum number of characters required to display data from the column.

column_number: Index of the column, starting at 1.

fn col_precision(&self, column_number: u16) -> Result<Len, Error>[src]

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.

fn col_scale(&self, column_number: u16) -> Result<Len, Error>[src]

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.

fn col_name(&self, column_number: u16, buf: &mut Vec<u16>) -> Result<(), Error>[src]

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.

unsafe fn numeric_col_attribute(
    &self,
    attribute: Desc,
    column_number: u16
) -> Result<Len, Error>
[src]

Safety

It is the callers responsibility to ensure that attribute refers to a numeric attribute.

fn reset_parameters(&mut self) -> Result<(), Error>[src]

Sets the SQL_DESC_COUNT field of the APD to 0, releasing all parameter buffers set for the given StatementHandle.

fn describe_param(
    &self,
    parameter_number: u16
) -> Result<ParameterDescription, Error>
[src]

Describes parameter marker associated with a prepared SQL statement.

Parameters

  • parameter_number: Parameter marker number ordered sequentially in increasing parameter order, starting at 1.

fn param_data(&mut self) -> Result<Option<Pointer>, Error>[src]

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.

unsafe fn bind_col(
    &mut self,
    column_number: u16,
    target: &mut impl CDataMut
) -> Result<(), Error>
[src]

Binds application data buffers to columns in the result set. Read more

unsafe fn fetch(&mut self) -> Result<bool, Error>[src]

Returns the next row set in the result set. Read more

fn get_data(
    &mut self,
    col_or_param_num: u16,
    target: &mut impl CDataMut
) -> Result<(), Error>
[src]

Retrieves data for a single column in the result set or for a single parameter.

fn unbind_cols(&mut self) -> Result<(), Error>[src]

Release all column buffers bound by bind_col. Except bookmark column.

unsafe fn set_num_rows_fetched(
    &mut self,
    num_rows: Option<&mut ULen>
) -> Result<(), Error>
[src]

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>
[src]

Fetch a column description using the column index. Read more

unsafe fn exec_direct(&mut self, statement_text: &U16Str) -> Result<bool, Error>[src]

Executes a statement, using the current values of the parameter marker variables if any parameters exist in the statement. SQLExecDirect is the fastest way to submit an SQL statement for one-time execution. Read more

fn close_cursor(&mut self) -> Result<(), Error>[src]

Close an open cursor.

fn prepare(&mut self, statement_text: &U16Str) -> Result<(), Error>[src]

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>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.