Skip to content

Commit

Permalink
Oracle: Add 64-bit size support for BLOBs
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Jan 28, 2024
1 parent d92a250 commit 1dc95a3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/backends/oracle/blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ std::size_t oracle_blob_backend::get_len()
return 0;
}

ub4 len;
oraub8 len;

sword res = OCILobGetLength(session_.svchp_, session_.errhp_,
sword res = OCILobGetLength2(session_.svchp_, session_.errhp_,
lobp_, &len);

if (res != OCI_SUCCESS)
Expand All @@ -80,10 +80,10 @@ std::size_t oracle_blob_backend::read_from_start(void *buf, std::size_t toRead,
throw soci_error("Can't read past-the-end of BLOB data.");
}

ub4 amt = static_cast<ub4>(toRead);
auto amt = static_cast<oraub8>(toRead);

sword res = OCILobRead(session_.svchp_, session_.errhp_, lobp_, &amt,
static_cast<ub4>(offset + 1), buf, amt, 0, 0, 0, 0);
sword res = OCILobRead2(session_.svchp_, session_.errhp_, lobp_, &amt, nullptr,
static_cast<oraub8>(offset + 1), buf, amt, OCI_ONE_PIECE, nullptr, 0, SQLCS_IMPLICIT);
if (res != OCI_SUCCESS)
{
throw_oracle_soci_error(res, session_.errhp_);
Expand All @@ -102,10 +102,10 @@ std::size_t oracle_blob_backend::write_from_start(const void *buf, std::size_t t

ensure_initialized();

ub4 amt = static_cast<ub4>(toWrite);
auto amt = static_cast<oraub8>(toWrite);

sword res = OCILobWrite(session_.svchp_, session_.errhp_, lobp_, &amt,
static_cast<ub4>(offset + 1),
sword res = OCILobWrite2(session_.svchp_, session_.errhp_, lobp_, &amt, nullptr,
static_cast<oraub8>(offset + 1),
const_cast<void*>(buf), amt, OCI_ONE_PIECE, 0, 0, 0, 0);
if (res != OCI_SUCCESS)
{
Expand All @@ -119,10 +119,10 @@ std::size_t oracle_blob_backend::append(const void *buf, std::size_t toWrite)
{
ensure_initialized();

ub4 amt = static_cast<ub4>(toWrite);
auto amt = static_cast<oraub8>(toWrite);

sword res = OCILobWriteAppend(session_.svchp_, session_.errhp_, lobp_,
&amt, const_cast<void*>(buf), amt, OCI_ONE_PIECE, 0, 0, 0, 0);
sword res = OCILobWriteAppend2(session_.svchp_, session_.errhp_, lobp_,
&amt, nullptr, const_cast<void*>(buf), amt, OCI_ONE_PIECE, 0, 0, 0, 0);
if (res != OCI_SUCCESS)
{
throw_oracle_soci_error(res, session_.errhp_);
Expand All @@ -133,8 +133,8 @@ std::size_t oracle_blob_backend::append(const void *buf, std::size_t toWrite)

void oracle_blob_backend::trim(std::size_t newLen)
{
sword res = OCILobTrim(session_.svchp_, session_.errhp_, lobp_,
static_cast<ub4>(newLen));
sword res = OCILobTrim2(session_.svchp_, session_.errhp_, lobp_,
static_cast<oraub8>(newLen));
if (res != OCI_SUCCESS)
{
throw_oracle_soci_error(res, session_.errhp_);
Expand Down

0 comments on commit 1dc95a3

Please sign in to comment.