scruz-denodo opened a new issue, #1375:
URL: https://github.com/apache/arrow-java/issues/1375

   ### Describe the enhancement requested
   
   # Describe the enhancement requested
   
   The Flight SQL JDBC driver always prepares a statement on the server and 
binds its parameters. It can exists servers implementing Flight SQL connection 
interface which do not support the parameters binding process. 
   
   - they do not implement `CreatePreparedStatement`, or
   - they can prepare a statement but cannot bind its parameters .
   
   In those cases, the usage of `PreparedStatements` is not 100% usable. 
   
   One of the main problems of this is that thirdparty-tools using the JDBC 
driver usually make use of `PreparedStatement` classes and there is no way for 
overriding that behavior.
   
   I have changes which I think they can be useful for this. They consist on 
adding an optional mode in which the driver handles `PreparedStatement ` on the 
client side:
   
   - It keeps the statement text.
   - It writes the parameter values into it as SQL literals, using a pluggable 
`SqlDialect`.
   - It runs the result as a plain query or update.
   
   Statements prepared on the server keep their current behavior, and the 
default behavior does not change.
   
   ## Proposed design
   
   ### Connection properties
   
   - `disableServerPreparedStatements`: No statement is prepared on the server. 
(disabled by default, so the current behavior is the default)
   - `disableServerPreparedQueries`: Only queries are handled on the client. 
Updates with parameters are still prepared on the server.
   - `dialect `/ `dialectClass`: The SQL dialect used to write literals, chosen 
by name through a registry or by class.
   - `clientSideMetadataProbe`: Whether the first getMetaData() call asks the 
server for the result columns.
   
   
   ### Dialects
   - `SqlDialect` is an interface in which every method has an ANSI SQL 
default, so a dialect overrides only what its database does differently.
     - It is discovered through `ServiceLoader` and a `SqlDialectRegistry`.
     - It covers literals for strings, numbers, binary values, dates, times, 
timestamps, intervals, ``, arrays and rows.
     - It classifies a statement as query or update by its first keyword.
     - It produces the metadata probe by replacing every parameter marker with 
NULL.
   - A default `AnsiSqlDialect` which keeps all the defaults.
   - `SqlParameterScanner `finds the `?` markers outside string literals, 
quoted identifiers and comments. Dialects can tune it with lexical rules, for 
example // comments.
   
   ### Value conversion
   
   `SqlValueFactory` turns what JDBC and Avatica hand over for a parameter into 
a small value model. The dialect implementations then deals with one 
representation.
   
   This issue is related with 
[issue-62](https://github.com/apache/arrow-java/issues/62).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to