Re: Prepared statement with function as argument: how to bind values?

From: alexbruy <alexander(dot)bruy(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Prepared statement with function as argument: how to bind values?
Date: 2011-09-23 18:21:58
Message-ID: 132b310f-65ae-494f-a2bb-e314c1b6c7c5@n12g2000yqh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

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

On 23 сен, 19:28, msakre(dot)(dot)(dot)(at)truviso(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Amar Dhole 2011-09-23 18:31:21 Re: use of savepoint in containter managed transaction
Previous Message Mikko Tiihonen 2011-09-23 17:01:22 Re: Binary transfer patches v15 - sending part was missing