Skip to content

Problems with loading large clob values via returning clauses #64

Open
@weiznich

Description

@weiznich

I've tried the following code:

use oracle::*; // oracle = "0.5.6"

const CREATE_TEST_TABLE: &str = "CREATE TABLE test_table (\
        text clob
    )";

fn repro(conn: Connection) {
    let _ = conn.execute("DROP TABLE test_table", &[]);
    conn.execute(CREATE_TEST_TABLE, &[]).unwrap();
    let mut stmt = conn
        .statement("INSERT INTO test_table(text) VALUES (:in1) RETURNING text INTO :out1")
        .build()
        .unwrap();
    let long_text = std::iter::repeat('a').take(4000).collect::<String>();
    stmt.execute_named(&[("in1", &long_text), ("out1", &None::<String>)])
        .unwrap();
    let s: &String = &stmt.returned_values("out1").unwrap()[0];
    assert_eq!(s, &long_text);
}

I expect that this code passes without an error for a valid connection. Instead of that I get the following error message:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: OciError(DbError { code: 22835, offset: 53, message: "ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 4000, maximum: 2000)", fn_name: "dpiStmt_execute", action: "execute" })', src/main.rs:16:10

(where line main.rs:16 refers to the unwrap after the execute_named)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions