Struct mimir::Statement [−][src]
pub struct Statement { /* fields omitted */ }
This structure represents statements of all types (queries, DML, DLL and PL/SQL) and is available by handle to a calling application or driver.
Methods
impl Statement
[src]
impl Statement
pub fn bind_by_name(&self, name: &str, var: &Var) -> Result<()>
[src]
pub fn bind_by_name(&self, name: &str, var: &Var) -> Result<()>
Binds a variable to a named placeholder in the statement. A reference to the variable is retained by the library and is released when the statement itself is released or a new variable is bound to the same name.
name
- a string in the encoding used for CHAR data giving the name of the placeholder which is to be bound.var
- a variable which is to be bound.
pub fn bind_by_pos(&self, pos: u32, var: &Var) -> Result<()>
[src]
pub fn bind_by_pos(&self, pos: u32, var: &Var) -> Result<()>
Binds a variable to a placeholder in the statement by position. A reference to the variable is retained by the library and is released when the statement itself is released or a new variable is bound to the same position.
pos
- the position which is to be bound. The position of a placeholder is determined by its location in the statement. Placeholders are numbered from left to right, starting from 1, and duplicate names do not count as additional placeholders.var
- a variable which is to be bound.
pub fn bind_value_by_name(
&self,
name: &str,
native_type: ODPINativeTypeNum,
data: &Data
) -> Result<()>
[src]
pub fn bind_value_by_name(
&self,
name: &str,
native_type: ODPINativeTypeNum,
data: &Data
) -> Result<()>
Binds a value to a named placeholder in the statement without the need to create a variable directly. One is created implicitly and released when the statement is released or a new value is bound to the same name.
name
- a string in the encoding used for CHAR data giving the name of the placeholder which is to be bound.native_type
- the type of data that is being bound. It is expected to be one of the values from the enumerationODPINativeTypeNum
.data
- the data which is to be bound, as a pointer to aODPIData
structure. A variable will be created based on the type of data being bound and a reference to this variable retained. Once the statement has been executed, this new variable will be released.
pub fn bind_value_by_pos(
&self,
pos: u32,
native_type: ODPINativeTypeNum,
data: &Data
) -> Result<()>
[src]
pub fn bind_value_by_pos(
&self,
pos: u32,
native_type: ODPINativeTypeNum,
data: &Data
) -> Result<()>
Binds a value to a placeholder in the statement without the need to create a variable directly. One is created implicitly and released when the statement is released or a new value is bound to the same position.
pos
- the position which is to be bound. The position of a placeholder is determined by its location in the statement. Placeholders are numbered from left to right, starting from 1, and duplicate names do not count as additional placeholders.native_type
- the type of data that is being bound. It is expected to be one of the values from the enumerationODPINativeTypeNum
.data
- the data which is to be bound, as a pointer to aODPIData
structure. A variable will be created based on the type of data being bound and a reference to this variable retained. Once the statement has been executed, this new variable will be released.
pub fn close(&self, tag: Option<&str>) -> Result<()>
[src]
pub fn close(&self, tag: Option<&str>) -> Result<()>
Closes the statement and makes it unusable for further work immediately, rather than when the reference count reaches zero.
tag
- a key to associate the statement with in the statement cache, in the encoding used for CHAR data. None is also acceptable in which case the statement is not tagged. This value is ignored for statements that are acquired through bind variables (REF CURSOR) or implicit results.
pub fn define_value(
&self,
pos: u32,
oracle_type: ODPIOracleTypeNum,
native_type: ODPINativeTypeNum,
size: Option<u32>,
size_is_bytes: Option<bool>
) -> Result<()>
[src]
pub fn define_value(
&self,
pos: u32,
oracle_type: ODPIOracleTypeNum,
native_type: ODPINativeTypeNum,
size: Option<u32>,
size_is_bytes: Option<bool>
) -> Result<()>
Defines the type of data that will be used to fetch rows from the statement. This is
intended for use with the function Statement::get_query_value()
, when the default
data type derived from the column metadata needs to be overridden by the application.
Internally, a variable is created with the specified data type and size.
pub fn execute(&self, mode: ODPIExecMode) -> Result<u32>
[src]
pub fn execute(&self, mode: ODPIExecMode) -> Result<u32>
Executes the statement using the bound values. For queries this makes available metadata which can be acquired using the function dpiStmt_getQueryInfo(). For non-queries, out and in-out variables are populated with their values.
mode
- one or more of the values from the enumerationODPIExecMode
, OR'ed together.
pub fn execute_many(&self, mode: ODPIExecMode, num_iters: u32) -> Result<()>
[src]
pub fn execute_many(&self, mode: ODPIExecMode, num_iters: u32) -> Result<()>
Executes the statement the specified number of times using the bound values. Each bound variable must have at least this many elements allocated or an error is returned.
mode
- one or more of the values from the enumerationODPIExecMode
, OR'ed together.num_iters
- the number of times the statement is executed. Each iteration corresponds to one of the elements of the array that was bound earlier.
pub fn fetch(&self) -> Result<(bool, u32)>
[src]
pub fn fetch(&self) -> Result<(bool, u32)>
Fetches a single row from the statement. If the statement does not refer to a query an error is returned. All columns that have not been defined prior to this call are implicitly defined using the metadata made available when the statement was executed.
Returns a tuple of (found, row_index)
pub fn fetch_rows(&self, max_rows: u32) -> Result<(u32, u32, bool)>
[src]
pub fn fetch_rows(&self, max_rows: u32) -> Result<(u32, u32, bool)>
Returns the number of rows that are available in the buffers defined for the query. If no rows are currently available in the buffers, an internal fetch takes place in order to populate them, if rows are available. If the statement does not refer to a query an error is returned. All columns that have not been defined prior to this call are implicitly defined using the metadata made available when the statement was executed.
max_rows
- the maximum number of rows to fetch. If the number of rows available exceeds this value only this number will be fetched.
Returns a tuple representing (row_index, num_rows_fetched, more_rows).
pub fn get_batch_error_count(&self) -> Result<u32>
[src]
pub fn get_batch_error_count(&self) -> Result<u32>
Returns the number of batch errors that took place during the last execution with batch mode enabled. Batch errors are only available when both the client and the server are at 12.1.
pub fn get_batch_errors(&self, num_errors: u32) -> Result<Vec<Info>>
[src]
pub fn get_batch_errors(&self, num_errors: u32) -> Result<Vec<Info>>
Returns the batch errors that took place during the last execution with batch mode enabled. Batch errors are only available when both the client and the server are at 12.1.
num_errors
- the size of the errors array in number of elements. The number of batch errors that are available can be determined usingget_batch_error_count()
.
pub fn get_bind_count(&self) -> Result<u32>
[src]
pub fn get_bind_count(&self) -> Result<u32>
Returns the number of unique bind variables in the prepared statement.
pub fn get_bind_names(&self, num_bind_names: u32) -> Result<Vec<String>>
[src]
pub fn get_bind_names(&self, num_bind_names: u32) -> Result<Vec<String>>
Returns the names of the unique bind variables in the prepared statement.
pub fn get_fetch_array_size(&self) -> Result<u32>
[src]
pub fn get_fetch_array_size(&self) -> Result<u32>
Gets the array size used for performing fetches.
pub fn get_implicit_result(&self) -> Result<()>
[src]
pub fn get_implicit_result(&self) -> Result<()>
Returns the next implicit result available from the last execution of the statement. Implicit results are only available when both the client and server are 12.1 or higher.
pub fn get_info(&self) -> Result<Info>
[src]
pub fn get_info(&self) -> Result<Info>
Returns information about the statement.
pub fn get_num_query_columns(&self) -> Result<u32>
[src]
pub fn get_num_query_columns(&self) -> Result<u32>
Returns the number of columns that are being queried.
pub fn get_query_info(&self, pos: u32) -> Result<Info>
[src]
pub fn get_query_info(&self, pos: u32) -> Result<Info>
Returns information about the column that is being queried.
pub fn get_query_value(&self, pos: u32) -> Result<(ODPINativeTypeNum, Data)>
[src]
pub fn get_query_value(&self, pos: u32) -> Result<(ODPINativeTypeNum, Data)>
Returns the value of the column at the given position for the currently fetched row, without needing to provide a variable.
pub fn get_row_count(&self) -> Result<u64>
[src]
pub fn get_row_count(&self) -> Result<u64>
Returns the number of rows affected by the last DML statement that was executed or the number of rows currently fetched from a query. In all other cases 0 is returned.
pub fn get_row_counts(&self) -> Result<Vec<u64>>
[src]
pub fn get_row_counts(&self) -> Result<Vec<u64>>
Returns an array of row counts affected by the last invocation of Statement::executeMany()
with the array DML rowcounts mode enabled. This feature is only available if both client and
server are at 12.1.
pub fn get_subscr_query_id(&self) -> Result<u64>
[src]
pub fn get_subscr_query_id(&self) -> Result<u64>
Returns the id of the query that was just registered on the subscription by calling
Statement::execute()
on a statement prepared by calling Subscription::prepare_stmt()
.
pub fn scroll(
&self,
mode: ODPIFetchMode,
offset: i32,
row_count_offset: i32
) -> Result<()>
[src]
pub fn scroll(
&self,
mode: ODPIFetchMode,
offset: i32,
row_count_offset: i32
) -> Result<()>
Scrolls the statement to the position in the cursor specified by the mode and offset.
mode
- one of the values from the enumerationODPIFetchMode
.offset
- a value which is used with the mode in order to determine the row position in the cursor.row_count_offset
- an offset to the row count used when calculating the desired row to be fetched. This is needed when a client has fetched multiple rows but has not yet consumed all of them. If this is not being done by the client, the value 0 is appropriate.
pub fn set_fetch_array_size(&self, _array_size: u32) -> Result<()>
[src]
pub fn set_fetch_array_size(&self, _array_size: u32) -> Result<()>
Sets the array size used for performing fetches. All variables defined for fetching must have this many (or more) elements allocated for them. The higher this value is the less network round trips are required to fetch rows from the database but more memory is also required. A value of zero will reset the array size to the default value of DPI_DEFAULT_FETCH_ARRAY_SIZE.