Re: How to get the SQL query from a PreparedStatement? - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: How to get the SQL query from a PreparedStatement?
Date
Msg-id 47301BAA.1000804@opencloud.com
Whole thread Raw
In response to How to get the SQL query from a PreparedStatement?  ("Andres Olarte" <olarte.andres@gmail.com>)
Responses Re: How to get the SQL query from a PreparedStatement?
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: Kevin Neufeld
Date:
Subject: Re: Parsed Query Trees
Next
From: "Phillip Mills"
Date:
Subject: Beginning tuning