From: Andres Olarte <olarte.andres@gmail.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Pgsql-Jdbc@Postgresql.Org <pgsql-jdbc@postgresql.org>
Subject: Re: How to get the SQL query from a PreparedStatement?
Date: Sun, 11 Nov 2007 11:46:02 -0600
Message-ID: <3fccaa690711110946l764ea585w3cb0539892474e4a@mail.gmail.com> (raw)
In-Reply-To: <47301BAA.1000804@opencloud.com>
References: <3fccaa690711051819s15082dehd5c67951a6e43dee@mail.gmail.com>
<47301BAA.1000804@opencloud.com>
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@opencloud.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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: olarte.andres@gmail.com, oliver@opencloud.com
Subject: Re: How to get the SQL query from a PreparedStatement?
In-Reply-To: <3fccaa690711110946l764ea585w3cb0539892474e4a@mail.gmail.com>
References: <3fccaa690711051819s15082dehd5c67951a6e43dee@mail.gmail.com> <47301BAA.1000804@opencloud.com> <3fccaa690711110946l764ea585w3cb0539892474e4a@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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