Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 42AC59F95B9 for ; Sun, 11 Nov 2007 13:46:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 18257-07 for ; Sun, 11 Nov 2007 13:46:05 -0400 (AST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by postgresql.org (Postfix) with ESMTP id 4289E9F99D8 for ; Sun, 11 Nov 2007 13:46:04 -0400 (AST) Received: by py-out-1112.google.com with SMTP id u77so867696pyb for ; Sun, 11 Nov 2007 09:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=HP0Ogk/Sp3FY5WiiH7DvV3W87ONdlOPs1MmcO1u6ZMs=; b=ITxrMRLFNoHHdb9cVhFQCPS0wUHLlFMvXdhMvruxgzA9SjYjHQbryoxtJBz/70y63QtPrwYJevRywsBICTyVnmQsFjxCQZI/rDMoSBUCEqcZ+nvOJ9LjZuZzuLt4YQdOAnIqgmgH66OkbI/o2CvvfgwxdZMZaPe7Of2cM782b6c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=psN5ZM/lMlkYkdruQRLjItKgbeDF2jEPdfH6gPh+l0Z0RVSdcrTX3u0qmmYrFCDZKiPgb3HwdqsJGKb3uqNpzOEH7TgSjt4OELTLwuH6yaDlt1rZDnMyPlnxvc4JsHM+UedxDYBnGYa+Xsl3POFedB55A4Zwvb6IqCGyPcVmO7g= Received: by 10.142.158.17 with SMTP id g17mr112620wfe.1194803162861; Sun, 11 Nov 2007 09:46:02 -0800 (PST) Received: by 10.142.194.21 with HTTP; Sun, 11 Nov 2007 09:46:02 -0800 (PST) Message-ID: <3fccaa690711110946l764ea585w3cb0539892474e4a@mail.gmail.com> Date: Sun, 11 Nov 2007 11:46:02 -0600 From: "Andres Olarte" To: "Oliver Jowett" Subject: Re: How to get the SQL query from a PreparedStatement? Cc: "Pgsql-Jdbc@Postgresql.Org" In-Reply-To: <47301BAA.1000804@opencloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3fccaa690711051819s15082dehd5c67951a6e43dee@mail.gmail.com> <47301BAA.1000804@opencloud.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/48 X-Sequence-Number: 17803 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 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 >