Skip to content

Length param isn't respected in Stmt:lob(LobId, Offset, Length) #70

Description

@c-bik

cc @acautin @stoch
Ref : https://docs.oracle.com/cd/B28359_01/appdev.111/b28395/oci17msc002.htm#i578721

oraub8 loblenc = 0;
checkerr(&r,
    OCILobRead2((OCISvcCtx*)_svchp, (OCIError*)_errhp, lob,
/* oraub8 *byte_amtp (IN/OUT)
IN - The number of bytes to read from the database. Used for BLOB and BFILE always. For CLOB and NCLOB, it is used only when char_amtp is zero.
OUT - The number of bytes read into the user buffer. */
       (oraub8*)&loblen,
/* oraub8 *char_amtp (IN/OUT)
IN - The maximum number of characters to read into the user buffer. Ignored for BLOB and BFILE.
OUT - The number of characters read into the user buffer. Undefined for BLOB and BFILE. */
       &loblenc,
       (oraub8)offset,
       (void*)buf,
       (oraub8)length,
       OCI_ONE_PIECE, (dvoid*)0, (OCICallbackLobRead2)0, (ub2)0, csfrm)
);
if(r.fn_ret != OCI_SUCCESS) {
    REMOTE_LOG(ERR, "failed OCILobRead2 for %p reason %s (%s)\n", lob, r.gerrbuf, _stmtstr);
    throw r;
} 

oraub8 loblenc = 0;
checkerr(&r, OCILobRead2((OCISvcCtx*)_svchp, (OCIError*)_errhp, lob, (oraub8*)&loblen, &loblenc, (oraub8)offset, (void*)buf, (oraub8)length , OCI_ONE_PIECE, (dvoid*)0, (OCICallbackLobRead2)0, (ub2)0, csfrm));
if(r.fn_ret != OCI_SUCCESS) {
REMOTE_LOG(ERR, "failed OCILobRead2 for %p reason %s (%s)\n", lob, r.gerrbuf, _stmtstr);
throw r;
}

Always full byte/char length is requested!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions