Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WSLRM-0001un-3M for pgsql-jdbc@arkaria.postgresql.org; Tue, 25 Mar 2014 07:06:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WSLRL-0006nh-DJ for pgsql-jdbc@arkaria.postgresql.org; Tue, 25 Mar 2014 07:06:27 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WSLRK-0006mZ-8p for pgsql-jdbc@postgresql.org; Tue, 25 Mar 2014 07:06:26 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WSLRH-0008KV-Mo for pgsql-jdbc@postgresql.org; Tue, 25 Mar 2014 07:06:25 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WSLRH-0007L9-A6 for pgsql-jdbc@postgresql.org; Tue, 25 Mar 2014 00:06:23 -0700 Date: Tue, 25 Mar 2014 00:06:23 -0700 (PDT) From: David Johnston To: pgsql-jdbc@postgresql.org Message-ID: <1395731183295-5797356.post@n5.nabble.com> In-Reply-To: <1395728007716-5797354.post@n5.nabble.com> References: <71a63038-181d-46ea-9af6-4231d8c279a4@o15g2000vbe.googlegroups.com> <132b310f-65ae-494f-a2bb-e314c1b6c7c5@n12g2000yqh.googlegroups.com> <26b8239e-b98b-4edf-ad07-28dd9063ddd7@m37g2000yqc.googlegroups.com> <1395728007716-5797354.post@n5.nabble.com> Subject: Re: Prepared statement with function as argument: how to bind values? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 4.5 (++++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Sivakumar wrote > I think it's too late to respond for this issue, but i hope it will be > useful for someone else. I also faced the same issue of binding, how i > solved is > > > String sql = "INSERT INTO > poi(geom,latitude,longitude,description,comment) VALUES > ( * > ST_GeomFromText(?, 4326) * > , ?, ?, ?, ?)"; > stmt = conn.prepareStatement(sql); * > stmt.setString(1, "POINT(" +lon + " " + lat + ")"); * > stmt.setFloat(2, lon); > stmt.setFloat(3, lat); > stmt.setTimestamp(4, descr); > stmt.setString(5, comment); > > Thanks, > Sivakumar Doesn't seem that much an improvement over dynamic SQL. INSERT INTO ... SELECT func_outer(func_inner(val1, val2), 4326), val3 FROM (VALUES (?,?,?)) src (val1,val2,val3); David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Prepared-statement-with-function-as-argument-how-to-bind-values-tp4833351p5797356.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc