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]

Adds a reference to the statement. This is intended for situations where a reference to the statement needs to be maintained independently of the reference returned when the statement was created.

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.

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.

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 enumeration ODPINativeTypeNum.
  • data - the data which is to be bound, as a pointer to a ODPIData 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.

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 enumeration ODPINativeTypeNum.
  • data - the data which is to be bound, as a pointer to a ODPIData 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.

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.

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 enumeration ODPIExecMode, OR'ed together.

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 enumeration ODPIExecMode, 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.

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)

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).

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.

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 using get_batch_error_count().

Returns the number of unique bind variables in the prepared statement.

Returns the names of the unique bind variables in the prepared statement.

Gets the array size used for performing fetches.

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.

Returns information about the statement.

Returns the number of columns that are being queried.

Returns information about the column that is being queried.

Returns the value of the column at the given position for the currently fetched row, without needing to provide a variable.

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.

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.

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().

Releases a reference to the statement. A count of the references to the statement is maintained and when this count reaches zero, the memory associated with the statement is freed and the statement is closed if that has not already taken place using the function close().

Scrolls the statement to the position in the cursor specified by the mode and offset.

  • mode - one of the values from the enumeration ODPIFetchMode.
  • offset - a value which is used with the mode in order to determine the row position in the cursor.
  • row_count_offset -

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.

Trait Implementations

impl From<*mut ODPIStmt> for Statement
[src]

Performs the conversion.