Rust-oracle - Work in progress

This is an Oracle driver for Rust based on ODPI-C.

It is under development. Public API may be changed for each commit.

Build-time Requirements

Run-time Requirements

Usage

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" }

Conversion from Oracle types to Rust types

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.

Conversion from Rust types to Oracle types

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\ | RAW(length of the rust value) | | Vec\ via bind_value(value, length) | RAW(length passed to bind_value()) | | Vec\ via bind_value(value, AS_LONG_RAW) | LONG RAW | | Vec\ via 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 |

TODO

License

Rust-oracle itself is under 2-clause BSD-style license.

ODPI-C bundled in rust-oracle is under the terms of:

  1. the Universal Permissive License v 1.0 or at your option, any later version; and/or
  2. the Apache License v 2.0.