Module oci_rs::oci_error[][src]

Errors.

Any errors arising from interaction with the OCI library will be returned as an OciError. All Oracle errors will be returned as the OciError::Oracle type. The Oracle error code and description can be seen through this.

Examples

Here is an example of how an Oracle error will reach you if you choose to display it:

use oci_rs::connection::Connection;

let conn = Connection::new("localhost:1521/xe", "oci_rs", "test").unwrap();

// Create a table
let sql_create = "CREATE TABLE BrokenToys (ToyId INT,
                                           Name VARCHAR(20),
                                           Price SINK)";
let mut create = conn.create_prepared_statement(sql_create).unwrap();
if let Err(err) = create.execute() {
    panic!("Execution failed: {}", err)
}

The above code will produce the following (this specific output comes from running this documentation test without the should_panic attribute):

thread 'main' panicked at 'Execution failed: Executing statement
Error number: 1
Error code: ORA-902
Error text: ORA-00902: invalid datatype
', <anon>:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

In this case "SINK" is not a valid SQL data type.

Note that there might be more than one error and in such cases all errors will be listed, this is why there is an error number.

Structs

ErrorRecord

Used to capture the errors details from OCI errors. Typically these come as Oracle error codes and text such as "ORA-24312: illegal parameters specified for allocating user memory"

Enums

OciError

The various errors that might result when interacting with the OCI library.