Giter Site home page Giter Site logo

BLOB does not work in Oracle about soci HOT 11 OPEN

avpalienko avatar avpalienko commented on May 25, 2024
BLOB does not work in Oracle

from soci.

Comments (11)

vadz avatar vadz commented on May 25, 2024

AFAIU (@Krzmbrzl please correct me if I'm wrong), this never worked before, as you need a transaction in order to use LOBs with Oracle, but now this is more explicit.

IOW the fix is to have a transaction around the code working with LOBs.

from soci.

avpalienko avatar avpalienko commented on May 25, 2024

It worked at 047b749

from soci.

vadz avatar vadz commented on May 25, 2024

Could you please use git-bisect which exact commit broke it? I see 8b5b312 (Fix Oracle bug that prevented selecting into initialized BLOB, 2023-11-01) which might be related...

from soci.

Krzmbrzl avatar Krzmbrzl commented on May 25, 2024

Tbh I don't quite remember the exact semantics of Oracle. Iirc there were/are situations in which you didn't need an explicit transaction... it was a bit of an odd situation, that much I know πŸ‘€

It worked atΒ 047b749

@avpalienko "at" or "before"? Aka: is this the commit that broke it or is it the last commit for which this works as expected?

from soci.

avpalienko avatar avpalienko commented on May 25, 2024

I don't know - it works in my fork. Fork is based on 8ddddca
I try rebase to the last commit of master and found the problem

from soci.

Krzmbrzl avatar Krzmbrzl commented on May 25, 2024

Could you do a bisect to find the commit that causes the issue?

from soci.

avpalienko avatar avpalienko commented on May 25, 2024

Could you do a bisect to find the commit that causes the issue?

I'll try, but I have no experience with bisect. So it will take a while

from soci.

avpalienko avatar avpalienko commented on May 25, 2024

I found one more problem.
If rowset contains more than one row move_as() does access violation ( use after move )

diff --git a/tests/common-tests.h b/tests/common-tests.h
index d2b8fb42..ffc80fc6 100644
--- a/tests/common-tests.h
+++ b/tests/common-tests.h
@@ -6779,7 +6779,7 @@ TEST_CASE_METHOD(common_tests, "BLOB", "[core][blob]")
         }
         SECTION("move_as")
         {
-            soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id", soci::use(id));
+            soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id union all select b from soci_test where id=:id", soci::use(id, "id"));
             bool containedData = false;
             for (auto it = rowSet.begin(); it != rowSet.end(); ++it)
             {

from soci.

Krzmbrzl avatar Krzmbrzl commented on May 25, 2024

If rowset contains more than one row move_as() does access violation ( use after move )

What do you mean by that? If you use move_as on the same element that is an obvious error on the user side but I have the feeling that's not what you're getting at πŸ‘€
(I don't understand the relation between what you've written and the parch you have provided)

from soci.

avpalienko avatar avpalienko commented on May 25, 2024

This patch demonstrates the problem. If it apply the test fails with access violation error

            soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id union all select b from soci_test where id=:id", soci::use(id, "id"));
            bool containedData = false;
            for (auto it = rowSet.begin(); it != rowSet.end(); ++it)
            {
                containedData = true;
                const soci::row &currentRow = *it;

                soci::blob intoBlob = currentRow.move_as<soci::blob>(0);

at second iteration will error

Sorry for my bad English

from soci.

Krzmbrzl avatar Krzmbrzl commented on May 25, 2024

Thanks for the clarification. I have created a separate issue for this: #1144

from soci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.