Re: Synthesize support for Statement.getGeneratedKeys()?

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: Kris Jurka <jurka(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Cc: JP Liska <jp(at)stsa(dot)info>
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Date: 2007-12-06 06:57:08
Message-ID: 47579D44.6060005@kensystem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc


> The previous discussion does detail the remaining steps needed to get
> something ready to be committed: proper quoting, error checking, test
> cases, ... If you have the time and skill to work on these that would
> be appreciated.
>

Kris (and folks), I did actually find some justification for the time to
work on this. The attached patch should follow on from our last state in
Feb. Essentially the only thing I added was error checking of the
arguments to 'executeUpdate's columnNames. The checking is done in a new
Utils.needsQuoted(String in) (see javadoc) (feel free to rename this
method).

I opted to use the Quoting mechanism I already had in executeUpdate for
now, since the string validation (no 0x00 && no nested quotes) is being
done in needsQuoted (in the same loop that validates quotes and scans
for whitespace).

Let me know in detail what else needs to be implemented in terms of
error checking or methods. I did not add any unit-tests (that will be a
learning curve; seeking volunteers).

Questions:

-is whitespace the sole determinator for needing quoting? And other chars?

-is it fine to leave the string un-quoted if it contains no ws, vs
always quoting it (my feeling is yes).

-is '"' the only legal quoting chars? (I cant remember for having
dabbled with too many non-spec databases)

-my needsQuoted method throws if the identifier contains nested quotes
(foo"bar or "foo"bar"); is there a legal quote-escaping mechanism
similar to apostrophe doubling? eg: how or would one pass foo"bar (I
imagine quotes are never allowed in identifiers but don't have an SQL
spec handy)

Ken

PS - Kris, I recall you said the backslashes in the patch were
troublesome; did you find any fix for your patch tool aside from
translating them to '/'? If not I will translate them from hereto forth.

Attachment Content-Type Size
out.patch text/plain 7.6 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Johanson 2007-12-06 07:07:42 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Tom Lane 2007-12-06 05:16:03 Re: elegant way to fill a table with serial

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ken Johanson 2007-12-06 07:07:42 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Kris Jurka 2007-12-06 04:37:30 Re: JDBC and GSSAPI/Krb5