Re: Prepared statement with function as argument: how to bind values? - Mailing list pgsql-jdbc

From alexbruy
Subject Re: Prepared statement with function as argument: how to bind values?
Date
Msg-id 132b310f-65ae-494f-a2bb-e314c1b6c7c5@n12g2000yqh.googlegroups.com
Whole thread Raw
In response to Prepared statement with function as argument: how to bind values?  (alexbruy <alexander.bruy@gmail.com>)
Responses Re: Prepared statement with function as argument: how to bind values?  (Maciek Sakrejda <msakrejda@truviso.com>)
List pgsql-jdbc
Hi,

On 23 сен, 16:25, p...@fastcrypt.com (Dave Cramer) wrote:
> Do you have to quote 'POINT(?,?)'
Yes, because this is argument of ST_GeomFromText function.


On 23 сен, 19:28, msakre...@truviso.com (Maciek Sakrejda) wrote:
> Since that's an argument to ST_GeomFrom*Text*, I imagine he does. Or
> do you mean is he quoting the parameter value with SQL apostrophe
> quotes, which he shouldn't?. In any case, that looks like a weird
> API--if there's a different function you can call, Alex, that will
> take an actual point object, that would probably make your life
> easier.
Unfortunately there is no another function that can take actual point.
But it is possible to create stored procedure that will take all
necessary
arguments.

> If this is all you have to work with, the problem is that you can't
> parameterize a text literal. I think you would need to pass the full
> String 'POINT(34.567 45.5621)' as a jdbc parameter value. However, I
> don't quite understand the error you're getting. I would expect
> complains about extra parameters, not about the number of columns
> (which looks legit).
Thanks, I'll try. Regarding error message, I find it a bit confusing.
As I
understand, it says about number of columns because there are 5
columns listed in query and I try to bind value to non existing 6
column.

Thanks,
Alex

pgsql-jdbc by date:

Previous
From: Amar Dhole
Date:
Subject: Re: use of savepoint in containter managed transaction
Next
From: Maciek Sakrejda
Date:
Subject: Re: Prepared statement with function as argument: how to bind values?