pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Wish list
2+ messages / 2 participants
[nested] [flat]

* Wish list
@ 2005-06-29 12:37 Kevin Murphy <murphy@genome.chop.edu>
  2005-06-29 13:38 ` Re: Wish list Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kevin Murphy @ 2005-06-29 12:37 UTC (permalink / raw)
  To: pgsql-jdbc

In the context of my current project of writing code that can 1) access 
a database directly, 2) write sql statements to a file instead of 
executing them, and also, 3) write raw data for insert to flat files:

it would be nice if the JDBC driver could somehow expose the 
functionality to do the quoting and escaping required in steps 2 and 3 
without ever requiring a database connection.

I know it's not the driver's main line of business, but since it is able 
to do these things anyway (in PreparedStatement.toString), and they are 
useful but non-trivial to do properly, why not expose the functionality?

I know very little about java and JDBC, so maybe this doesn't make sense.

BTW, thanks to Craig Servin and Mark Lewis for turning me on to 
java.lang.reflect.Proxy.

Kevin Murphy




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Wish list
  2005-06-29 12:37 Wish list Kevin Murphy <murphy@genome.chop.edu>
@ 2005-06-29 13:38 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Jowett @ 2005-06-29 13:38 UTC (permalink / raw)
  To: Kevin Murphy <murphy@genome.chop.edu>; +Cc: pgsql-jdbc

Kevin Murphy wrote:

> it would be nice if the JDBC driver could somehow expose the
> functionality to do the quoting and escaping required in steps 2 and 3
> without ever requiring a database connection.
> 
> I know it's not the driver's main line of business, but since it is able
> to do these things anyway (in PreparedStatement.toString), and they are
> useful but non-trivial to do properly, why not expose the functionality?

Uh, PreparedStatement.toString() *doesn't* necessarily produce correctly
quoted queries; the PostgreSQL driver implementation produces a query
string by blindly substituting parameter values with no escaping. It's
more of a debugging tool than anything else. At the protocol level, the
driver isn't escaping strings anyway because they're being passed
separately to the query in a Bind message rather than embedded in the
query string itself.

Also, the plans for post-8.1 string escaping mean that you will need to
know what version of the server you are talking to (or something
equivalent via a read-only GUC) to know which type of escaping is
correct.. it's hard to see how that works without a database connection.

-O



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-06-29 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-29 12:37 Wish list Kevin Murphy <murphy@genome.chop.edu>
2005-06-29 13:38 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox