pub struct BindParam {
pub value: Option<Value>,
pub direction: BindDirection,
pub oracle_type: OracleType,
pub buffer_size: u32,
}Expand description
A bind parameter for PL/SQL execution with direction support
This struct allows specifying IN, OUT, and IN OUT parameters for PL/SQL calls.
§Examples
use oracle_rs::{BindParam, BindDirection, OracleType, Value};
// IN parameter (default)
let in_param = BindParam::input(Value::Integer(42));
// OUT parameter - specify the expected type and size
let out_param = BindParam::output(OracleType::Varchar, 100);
// IN OUT parameter
let inout_param = BindParam::input_output(Value::String("hello".into()), 100);
// Execute PL/SQL
let results = conn.execute_plsql(
"BEGIN :1 := :2 * 2; END;",
&[out_param, in_param]
).await?;Fields§
§value: Option<Value>The value (None for pure OUT parameters)
direction: BindDirectionParameter direction
oracle_type: OracleTypeOracle type (required for OUT parameters)
buffer_size: u32Buffer size for OUT parameters
Implementations§
Source§impl BindParam
impl BindParam
Sourcepub fn output(oracle_type: OracleType, buffer_size: u32) -> Self
pub fn output(oracle_type: OracleType, buffer_size: u32) -> Self
Create an OUT (output) parameter with the expected type and size
Sourcepub fn output_cursor() -> Self
pub fn output_cursor() -> Self
Create an OUT parameter for a REF CURSOR
Sourcepub fn output_collection(obj_type: &DbObjectType) -> Self
pub fn output_collection(obj_type: &DbObjectType) -> Self
Create an OUT parameter for a collection (VARRAY, Nested Table)
The DbObjectType provides element type information for proper decoding.
Sourcepub fn input_collection(obj_type: &DbObjectType, collection: DbObject) -> Self
pub fn input_collection(obj_type: &DbObjectType, collection: DbObject) -> Self
Create an IN parameter for a collection (VARRAY, Nested Table)
The DbObjectType provides element type information for proper encoding, and the DbObject contains the actual element values.
§Example
let varray_type = conn.get_type("NUMBER_VARRAY").await?;
let mut coll = DbObject::collection("NUMBER_VARRAY");
coll.append(Value::Integer(1));
coll.append(Value::Integer(2));
let param = BindParam::input_collection(&varray_type, coll);Sourcepub fn input_output(value: Value, buffer_size: u32) -> Self
pub fn input_output(value: Value, buffer_size: u32) -> Self
Create an IN OUT (input/output) parameter
Sourcepub fn placeholder_value(&self) -> Value
pub fn placeholder_value(&self) -> Value
Create a placeholder value for OUT parameters based on the Oracle type This is used when sending bind metadata to the server
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BindParam
impl RefUnwindSafe for BindParam
impl Send for BindParam
impl Sync for BindParam
impl Unpin for BindParam
impl UnwindSafe for BindParam
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)