Struct oracle::SqlValue
[−]
[src]
pub struct SqlValue { /* fields omitted */ }
A type containing an Oracle value.
General users cannot use this directly. They access this via FromSql and ToSql.
When this is a column value in a select statement, the Oracle type is determined by the column type.
When this is a bind value in a SQL statement, the Oracle type is determined by ToSql.oratype which is internally called within Statement.bind, Statement.execute and Connection.execute.
Getter methods such as as_i64()
do the followings:
- Checks whether the conversion from the Oracle type to the target rust type
is allowed. It returns
Err(Error::InvalidTypeConversion(...))
when it isn't allowed. - Checks whether the Oracle value is null. It returns
Err(Error::NullValue)
when it is null. (is_null()
is also available to check whether the value is null.) - Converts the Oracle value to the rust value. The data type is converted
implicitly if required. For example string is converted to i64 by
parse if
as_i64()
is called forVARCHAR2
columns. If the conversion fails, various errors are returned.
Setter methods such as set_i64()
do the followings:
- Checks whether the conversion from the rust type to the target Oracle type
is allowed. It returns
Err(Error::InvalidTypeConversion(...))
when it isn't allowed. - Converts the rust value to the Oracle value. The data type is converted
implicitly if required. For example i64 is converted to string by
to_string()
ifset_i64()
is called forVARCHAR2
columns. If the conversion fails, various errors are returned. The value becomesnot null
.
The setter methods change the SQL value not null
. You need to call
set_null to make it null
.
Methods
impl SqlValue
[src]
fn is_null(&self) -> Result<bool>
[src]
Returns Ok(true)
when the SQL value is null. Ok(false)
when it isn't null.
fn set_null(&mut self) -> Result<()>
[src]
Sets null to the SQL value.
fn oracle_type(&self) -> Result<&OracleType>
[src]
Gets the Oracle type of the SQL value.
fn as_i8(&self) -> Result<i8>
[src]
Gets the SQL value as i8. The Oracle type must be numeric or string (excluding LOB) types.
fn as_i16(&self) -> Result<i16>
[src]
Gets the SQL value as i16. The Oracle type must be numeric or string (excluding LOB) types.
fn as_i32(&self) -> Result<i32>
[src]
Gets the SQL value as i32. The Oracle type must be numeric or string (excluding LOB) types.
fn as_i64(&self) -> Result<i64>
[src]
Gets the SQL value as i64. The Oracle type must be numeric or string (excluding LOB) types.
fn as_u8(&self) -> Result<u8>
[src]
Gets the SQL value as u8. The Oracle type must be numeric or string (excluding LOB) types.
fn as_u16(&self) -> Result<u16>
[src]
Gets the SQL value as u16. The Oracle type must be numeric or string (excluding LOB) types.
fn as_u32(&self) -> Result<u32>
[src]
Gets the SQL value as u32. The Oracle type must be numeric or string (excluding LOB) types.
fn as_u64(&self) -> Result<u64>
[src]
Gets the SQL value as u64. The Oracle type must be numeric or string (excluding LOB) types.
fn as_f32(&self) -> Result<f32>
[src]
Gets the SQL value as f32. The Oracle type must be numeric or string (excluding LOB) types.
fn as_f64(&self) -> Result<f64>
[src]
Gets the SQL value as f64. The Oracle type must be numeric or string (excluding LOB) types.
fn as_string(&self) -> Result<String>
[src]
Gets the SQL value as string. ...
fn as_bytes(&self) -> Result<Vec<u8>>
[src]
Gets the SQL value as Vec<u8>. ...
fn as_timestamp(&self) -> Result<Timestamp>
[src]
Gets the SQL value as Timestamp. The Oracle type must be
DATE
, TIMESTAMP
, or TIMESTAMP WITH TIME ZONE
.
fn as_interval_ds(&self) -> Result<IntervalDS>
[src]
Gets the SQL value as IntervalDS. The Oracle type must be
INTERVAL DAY TO SECOND
.
fn as_interval_ym(&self) -> Result<IntervalYM>
[src]
Gets the SQL value as IntervalYM. The Oracle type must be
INTERVAL YEAR TO MONTH
.
fn as_bool(&self) -> Result<bool>
[src]
Gets the SQL value as bool. The Oracle type must be
BOOLEAN
(PL/SQL only).
fn set_i8(&mut self, val: &i8) -> Result<()>
[src]
Sets i8 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_i16(&mut self, val: &i16) -> Result<()>
[src]
Sets i16 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_i32(&mut self, val: &i32) -> Result<()>
[src]
Sets i32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_i64(&mut self, val: &i64) -> Result<()>
[src]
Sets i64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_u8(&mut self, val: &u8) -> Result<()>
[src]
Sets u8 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_u16(&mut self, val: &u16) -> Result<()>
[src]
Sets u16 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_u32(&mut self, val: &u32) -> Result<()>
[src]
Sets u32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_u64(&mut self, val: &u64) -> Result<()>
[src]
Sets u64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_f32(&mut self, val: &f32) -> Result<()>
[src]
Sets f32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_f64(&mut self, val: &f64) -> Result<()>
[src]
Sets f64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.
fn set_string(&mut self, val: &str) -> Result<()>
[src]
Sets &str to the SQL value. ...
fn set_bytes(&self, val: &Vec<u8>) -> Result<()>
[src]
Sets Vec<u8> to the SQL value. ...
fn set_timestamp(&self, val: &Timestamp) -> Result<()>
[src]
Sets Timestamp to the SQL value. The Oracle type must be
DATE
, TIMESTAMP
, or TIMESTAMP WITH TIME ZONE
.
fn set_interval_ds(&self, val: &IntervalDS) -> Result<()>
[src]
Sets IntervalDS to the SQL value. The Oracle type must be
INTERVAL DAY TO SECOND
.
fn set_interval_ym(&self, val: &IntervalYM) -> Result<()>
[src]
Sets IntervalYM to the SQL value. The Oracle type must be
INTERVAL YEAR TO MONTH
.
fn set_bool(&mut self, val: &bool) -> Result<()>
[src]
Sets boolean to the SQL value. The Oracle type must be
BOOLEAN
(PL/SQL only).
Trait Implementations
impl Display for SqlValue
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for SqlValue
[src]
fn clone(&self) -> SqlValue
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more