phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clement Escoffier <clement.escoff...@gmail.com>
Subject Re: JDBC - prepared statement with auto generated keys
Date Wed, 25 Nov 2015 14:18:11 GMT
Hello,

Here is the Jira: https://issues.apache.org/jira/browse/PHOENIX-2453 <https://issues.apache.org/jira/browse/PHOENIX-2453>.
I’ve attached a patch too.

Clement

> On 24 nov. 2015, at 02:13, James Taylor <jamestaylor@apache.org> wrote:
> 
> Thanks for the explanation, Clement. Please file a JIRA - it seems that your suggestion
would be ok based on the javadoc for prepareStatement(String sql, int autoGeneratedKeys) [1]:
> 
>     This parameter is ignored if the SQL statement is not an INSERT statement, or an
SQL statement able to return
>     auto-generated keys (the list of such statements is vendor-specific).
> 
> We should probably do the same for the one that takes an int[] columnIndexes too.
> 
> Patch would be good too with a couple of simple unit tests.
> 
> Thanks,
> James
> 
> [1] https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#prepareStatement(java.lang.String,%20int)
<https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#prepareStatement(java.lang.String,%20int)>
> 
> On Mon, Nov 23, 2015 at 2:18 AM, Clement Escoffier <clement@apache.org <mailto:clement@apache.org>>
wrote:
> Hi James,
> 
> Sorry for the delay, I tried to get a complete overview of our issue.
> 
> So let me explain the use case. For the context, the issue was raised by a user of vert.x
(http://vertx.io <http://vertx.io/>). This user tries to connect the vertx-jdbc-client
to phoenix. A vert.x application cannot use directly the JDBC driver because it promotes an
asynchronous and non-blocking development model (while jdbc interactions are blocking). The
vertx-jdbc-client is using ` `prepareStatement(String sql, int autoGeneratedKeys)` which throws
an exception. 
> 
> Actually, in the vert.x case, it would be acceptable to delegate  `prepareStatement(String
sql, int autoGeneratedKeys)` to `prepareStatement(String sql)`, and totally ignore the `autoGeneratedKeys`.
Would this be acceptable for you (if so I would do a PR) ? 
> 
> Thanks and Regards,
> 
> Clement
> 
> On 20 novembre 2015 at 17:37:36, James Taylor (jamestaylor@apache.org <mailto:jamestaylor@apache.org>)
wrote:
> 
>> Hi Clement,
>> Can you tell us a little more about your use case and how you'd like prepareStatement(String
sql, int autoGeneratedKeys) to behave?
>> Thanks,
>> James
>> 
>> On Fri, Nov 20, 2015 at 2:31 AM, clement escoffier <clement@apache.org <mailto:clement@apache.org>>
wrote:
>> Hello,
>> 
>> I’m facing an issue with the prepared statement support. Right now, we are trying
a build a prepared statement using the `prepareStatement(String sql, int autoGeneratedKeys)`
method. This method is not supported by the Phoenix JDBC driver. Is it something you plan
to support ?
>> 
>> Thanks & Regards,
>> 
>> Clement
>> 
>> 
> 


Mime
View raw message