Temporary LOB caching · Issue #10 · oracle/odpi (original) (raw)

Dear Anthony,

There is a problem in the folowing function (dpiLob.c:1427):

int dpiOci__lobCreateTemporary(dpiLob *lob, dpiError *error)
{
    uint8_t lobType;
    int status;

    DPI_OCI_LOAD_SYMBOL("OCILobCreateTemporary",
            dpiOciSymbols.fnLobCreateTemporary)
    if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_BLOB)
        lobType = DPI_OCI_TEMP_BLOB;
    else lobType = DPI_OCI_TEMP_CLOB;
    status = (*dpiOciSymbols.fnLobCreateTemporary)(lob->conn->handle,
            error->handle, lob->locator, DPI_OCI_DEFAULT,
            lob->type->charsetForm, lobType, 0, DPI_OCI_DURATION_SESSION);
    return dpiError__check(error, status, lob->conn, "create temporary LOB");
}

It creates temporary lob with cache=false, which leads to unnecessary physical io every time such a variable is created.

For example, if we try to pass empty string from python code to plsql procedure with CLOB in parameter using cx_Oracle and ODPI, it would generate physical IO (could be easily seen in 10046 trace).

I believe it should be changed to chache=true, or, which is probably better, make this parameter configurable.

Regards,
Andrey