This is an Oracle driver for Rust based on ODPI-C.
It is under development. Public API may be changed for each commit.
Compile-time Requirements
in this document.Rust-oracle has not been published to crates.io. You need to put this in your Cargo.toml:
text
[dependencies]
oracle = { git = "https://github.com/kubo/rust-oracle.git" }
Values in Oracle are converted to Rust type as possible as it can. The following table indicates supported conversion.
| Oracle Type | Rust Type |
| --- | --- |
| CHAR, NCHAR, VARCHAR2, NVARCHAR2 | String |
| ″ | i8, i16, i32, i64, u8, u16, u32, u64 via parse()
|
| ... | ... |
This conversion is used also to get values from output parameters.
When a rust value is set to an input parameter, its Oracle type is determined by the rust type.
| Rust Type | Oracle Type |
| --- | --- |
| str, String | NVARCHAR2(length of the rust value) |
| str, String via bind_value(value, length)
| NVARCHAR2(length passed to bind_value()
) |
| str, String via bind_value(value, AS_LONG)
| LONG |
| str, String via bind_value(value, AS_CLOB)
| CLOB |
| str, String via bind_value(value, AS_NCLOB)
| NCLOB |
| i8, i16, i32, i64, u8, u16, u32, u64, f32, f64 | NUMBER |
| i8, i16, i32, i64, u8, u16, u32, u64, f32, f64 via bind_value(&value, AS_BINARY_DOUBLE)
| BINARY_DOUBLE |
| Vec\bind_value(value, length)
| RAW(length passed to bind_value()
) |
| Vec\bind_value(value, AS_LONG_RAW)
| LONG RAW |
| Vec\bind_value(value, AS_BLOB)
| BLOB |
| chrono::DateTime, Timestamp | TIMESTAMP(9) WITH TIME ZONE |
| chrono::Date | TIMESTAMP(0) WITH TIME ZONE |
| chrono::naive::NaiveDateTime | TIMESTAMP(9) |
| chrono::naive::NaiveDate | TIMESTAMP(0) |
| chrono::Duration, IntervalDS | INTERVAL DAY(9) TO SECOND(9) |
| IntervalYM | INTERVAL YEAR(9) TO MONTH |
Rust-oracle itself is under 2-clause BSD-style license.
ODPI-C bundled in rust-oracle is under the terms of: