Git Product home page Git Product logo

Comments (2)

mp911de avatar mp911de commented on June 14, 2024

Thanks for picking up on this loose end. JDBC users want probably a conversion of ? to $1/@P1. We have also another aspect that plays into that which is stream parameter reuse:

conn.createStatement("INSERT INTO names (first_name, last_name) VALUES (:PARAM:, :PARAM:) ")
    .bind(":PARAM:", Blob.from(…))
    .execute()

In this case, native execution accepts a single blob and translates it into the right result. Bind marker conversion would likely try to consume the Blob twice if we go for identifiable bind markers. Anonymous bind markers (such as ?) require users to specify individual items because they correlate by positional occurence.

from r2dbc-proxy.

ttddyy avatar ttddyy commented on June 14, 2024

With current converter API, above bind operation can be translated like this in converter.

Blob blob = Blob.from(...);
stmt.bind("$0", blob);
stmt.bind("$1", blob);

So, single stmt.bind(":PARAM:", Blob.from(…)) can be converted to multiple bind operations - stmt.bind("$0", blob).bind("$1", blob).

Or, even query can be translated to INSERT INTO names (first_name, last_name) VALUES ($0,$0) and bind operation can perform stmt.bind("$0", Blob.from(...)) if driver/database allow such query and operation.

There is interesting aspect in multiple parameter expansion (as above example) with Blob(or Clob).
As you mentioned, I think the Blob will be consumed twice. So, this wouldn't work if blob is not able to support multiple read. If driver supports such that blob can be reused in different parameter binding (when same Blob object is passed in different bind operation), then it would work.

At this converter level, it is still manipulating SPI.
So, after all, it's pretty much on the driver that how much support it has, and the implementation of this converter API transforms the user defined binding operations to the extent that driver can understand by performing pass-through, skip, or modifying originated bind operations.

from r2dbc-proxy.

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.