Struct oracle::SqlValue [−][src]
A type containing an Oracle value
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.
Implementations
impl SqlValue
[src]
pub fn get<T>(&self) -> Result<T> where
T: FromSql,
[src]
T: FromSql,
Gets the Oracle value. It internally does 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. When it is null and the return
type is
Option<FromSql>
, it returnsOk(None)
. When it is null and it isn’tOption<FromSql>
, it returnsErr(Error::NullValue)
. - 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
get::<i64>()
is called forVARCHAR2
columns. If the conversion fails, various errors are returned.
pub fn set(&mut self, val: &dyn ToSql) -> Result<()>
[src]
Sets a rust value to the Oracle value. It internally does 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. - When the argument type is
None::<ToSql>
, null is set. - Otherwise, 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(100i64)
is called forVARCHAR2
columns. When the argument isNone::<ToSql>
If the conversion fails, various errors are returned.
pub fn is_null(&self) -> Result<bool>
[src]
Returns Ok(true)
when the SQL value is null. Ok(false)
when it isn’t null.
pub fn set_null(&mut self) -> Result<()>
[src]
Sets null to the SQL value.
pub fn oracle_type(&self) -> Result<&OracleType>
[src]
Gets the Oracle type of the SQL value.
pub fn dup(&self, conn: &Connection) -> Result<SqlValue>
[src]
Returns a duplicated value of self.
Trait Implementations
impl Debug for SqlValue
[src]
impl Display for SqlValue
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Formats any SQL value to string using the given formatter.
Note that both a null value and a string NULL
are formatted
as NULL
.
impl Drop for SqlValue
[src]
Auto Trait Implementations
impl !RefUnwindSafe for SqlValue
impl !Send for SqlValue
impl !Sync for SqlValue
impl Unpin for SqlValue
impl !UnwindSafe for SqlValue
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,