Skip site navigation (1) Skip section navigation (2)

Re: How to get the SQL query from a PreparedStatement?

From: "Andres Olarte" <olarte(dot)andres(at)gmail(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "Pgsql-Jdbc(at)Postgresql(dot)Org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: How to get the SQL query from a PreparedStatement?
Date: 2007-11-11 17:46:02
Message-ID: 3fccaa690711110946l764ea585w3cb0539892474e4a@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Then, is it possible to use the driver just to format the parameters
into the PG format?  My guess is that it should be done somewhere, for
example when using setXXX methods.  But I haven't looked deep enough
in the source.  Would it be possible to use this functionality so I
don't have to reinvent the wheel?

On Nov 6, 2007 1:45 AM, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
> Andres Olarte wrote:
>
> > Is it possible to get the query string (including the formatted
> > parameters) from a PreparedStatement?
>
> In general you can't because the query's not sent like that (the
> parameter values are sent out of line from the query).
>
> IIRC, PreparedStatement.toString() will give you an approximation, but
> I'm not sure how accurate the results are (and it's not part of the spec)
>
> -O
>

In response to

pgsql-jdbc by date

Next:From: joël WintereggDate: 2007-11-11 22:25:33
Subject: Re: XAResource implementation
Previous:From: Kris JurkaDate: 2007-11-10 18:57:40
Subject: Re: gborg -> pgfoundry

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group