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:

  1. 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.
  2. 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.)
  3. 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 for VARCHAR2 columns. If the conversion fails, various errors are returned.

Setter methods such as set_i64() do the followings:

  1. 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.
  2. 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() if set_i64() is called for VARCHAR2 columns. If the conversion fails, various errors are returned. The value becomes not null.

The setter methods change the SQL value not null. You need to call set_null to make it null.

Methods

impl SqlValue
[src]

[src]

Returns Ok(true) when the SQL value is null. Ok(false) when it isn't null.

[src]

Sets null to the SQL value.

[src]

Gets the Oracle type of the SQL value.

[src]

Gets the SQL value as i8. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as i16. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as i32. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as i64. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as u8. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as u16. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as u32. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as u64. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as f32. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as f64. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Gets the SQL value as string. ...

[src]

Gets the SQL value as Vec<u8>. ...

[src]

Gets the SQL value as Timestamp. The Oracle type must be DATE, TIMESTAMP, or TIMESTAMP WITH TIME ZONE.

[src]

Gets the SQL value as IntervalDS. The Oracle type must be INTERVAL DAY TO SECOND.

[src]

Gets the SQL value as IntervalYM. The Oracle type must be INTERVAL YEAR TO MONTH.

[src]

Gets the SQL value as bool. The Oracle type must be BOOLEAN(PL/SQL only).

[src]

Sets i8 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets i16 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets i32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets i64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets u8 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets u16 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets u32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets u64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets f32 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets f64 to the SQL value. The Oracle type must be numeric or string (excluding LOB) types.

[src]

Sets &str to the SQL value. ...

[src]

Sets Vec<u8> to the SQL value. ...

[src]

Sets Timestamp to the SQL value. The Oracle type must be DATE, TIMESTAMP, or TIMESTAMP WITH TIME ZONE.

[src]

Sets IntervalDS to the SQL value. The Oracle type must be INTERVAL DAY TO SECOND.

[src]

Sets IntervalYM to the SQL value. The Oracle type must be INTERVAL YEAR TO MONTH.

[src]

Sets boolean to the SQL value. The Oracle type must be BOOLEAN(PL/SQL only).

Trait Implementations

impl Display for SqlValue
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for SqlValue
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Drop for SqlValue
[src]

[src]

Executes the destructor for this type. Read more