Coder Social home page Coder Social logo

Reusing prepared statement hangs about ocilib HOT 2 CLOSED

AIIleG avatar AIIleG commented on July 3, 2024
Reusing prepared statement hangs

from ocilib.

Comments (2)

vrogier avatar vrogier commented on July 3, 2024 1

Hi,

This is a misuse of the API.
Host bind variables must remain valid during the lifetime of the prepared statement.
In your code you are deleting these variables while still being bounded to the statement.
As you did not set the option to allow rebinding variables, second binding calls fail and the statement still uses previously bounded and destroyed host variables leading accessing dandling pointers and thus undefined behaviour.
The concept of bind variables is to bind them once and reuse them across executions. You just need to update their content.

Regards,

Vincent

from ocilib.

AIIleG avatar AIIleG commented on July 3, 2024

Oh I see, the binding is still part of the prepare stage so to say. Well, that works with one exception: I have to use OCI_LobTruncate() for every consecutive run because OCI_LobWrite() appends the text otherwise.
In practice however, at least for things like number and varchar, using OCI_AllowRebinding() is much better because declaring all variables in advance (the insert values are often generated within loops) is usually not possible or would require to copy the content to the already bound variables every time. The latter is the case for lob or date anyway so for them it doesn't matter.

Thanks for the reply and sorry for the false bugreport.

from ocilib.

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.