Re: Synthesize support for Statement.getGeneratedKeys()?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Ken Johanson <pg-user(at)kensystem(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Date: 2007-12-13 07:05:57
Message-ID: Pine.BSO.4.64.0712130158490.10148@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

On Wed, 12 Dec 2007, Ken Johanson wrote:

> Kris, do you what token parsers utils exists in the current JDBC
> package? E.g the most tried and true way to get the schema and table
> name from:
>
> INSERT INTO foo (col1, col2..) VALUES ..

Most of the parsing code in the driver is focused on finding placeholders
and escape sequences and doesn't care what the query is actually doing.
Deriving the base tables of a query happens in only one place, updatable
resultset support. See
org.postgresql.jdbc2.AbstractJdbc2ResultSet#parseQuery. That said, the
current implementation is terrible and is fooled by many queries. It just
looks for the first " FROM " and takes anything after that as the table
the select is based on. Clearly this doesn't work for SELECT col AS from
FROM tab; or SELECT /* FROM */ * FROM tab; or SELECT (SELECT col FROM tab)
FROM tab2; and many other ways. So I doubt modelling new code on it is a
good idea.

Kris Jurka

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-12-13 07:08:35 Re: Slow PITR restore
Previous Message Kris Jurka 2007-12-13 06:57:06 Re: RETURNING clause: how to specifiy column indexes?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ken Johanson 2007-12-13 07:17:37 Re: RETURNING clause: how to specifiy column indexes?
Previous Message Kris Jurka 2007-12-13 06:57:06 Re: RETURNING clause: how to specifiy column indexes?