You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extern crate oracle;
use oracle::{Connection, Error, Result};
fn sql()-> Result<()> {
// Connect to a database.
let conn = Connection::connect("scott", "tiger", "//base/base", &[])?;
let sql = "select ename, sal, comm from emp where deptno = :1";
// Select a table with a bind variable.
println!("---------------|---------------|---------------|");
let rows = conn.query(sql, &[&30])?;
for row_result in &rows {
let row = row_result?;
// get a column value by position (0-based)
let ename: String = row.get(0)?;
// get a column by name (case-insensitive)
let sal: i32 = row.get("sal")?;
// Use `Option<...>` to get a nullable column.
// Otherwise, `Err(Error::NullValue)` is returned
// for null values.
let comm: Option<i32> = row.get(2)?;
println!(" {:14}| {:>10} | {:>10} |",
ename,
sal,
comm.map_or("".to_string(), |v| v.to_string()));
}
// Another way to fetch rows.
// The rows iterator returns Result<(String, i32, Option<i32>)>.
println!("---------------|---------------|---------------|");
let rows = conn.query_as::<(String, i32, Option<i32>)>(sql, &[&10])?;
for row_result in &rows {
let (ename, sal, comm) = row_result?;
println!(" {:14}| {:>10} | {:>10} |",
ename,
sal,
comm.map_or("".to_string(), |v| v.to_string()));
}
Ok(())
}
fn main() {
match sql() {
Ok(_) => {},
Err(error) => { println!("{:?}", error); }
}
}
The code is compiled ok. I am compiling to the windows gnu target:
But the execution result is:
DpiError(DbError { code: 0, offset: 0, message: "DPI-1020: version 3.0 is not supported by ODPI-C library version 2.4", fn_name: "dpiContext_create", action: "check version" })
The text was updated successfully, but these errors were encountered:
My Cargo.toml:
My code:
The code is compiled ok. I am compiling to the windows gnu target:
But the execution result is:
DpiError(DbError { code: 0, offset: 0, message: "DPI-1020: version 3.0 is not supported by ODPI-C library version 2.4", fn_name: "dpiContext_create", action: "check version" })
The text was updated successfully, but these errors were encountered: