Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
c-bik opened this issue Sep 26, 2018 · 1 comment
Open

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

c-bik opened this issue Sep 26, 2018 · 1 comment
Assignees

Comments

@c-bik
Copy link
Member

c-bik commented Sep 26, 2018

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!

@c-bik c-bik self-assigned this Sep 26, 2018
@c-bik
Copy link
Member Author

c-bik commented Sep 26, 2018

This better to be done correctly in NIF driver than trying to fix this here! Will possibliy be closed after further evaluation.

@c-bik c-bik changed the title Length isn't respoected in Stmt:lob(LobId, Offset, Length) Length param isn't respected in Stmt:lob(LobId, Offset, Length) Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant