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

From: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: alexbruy <alexander(dot)bruy(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Prepared statement with function as argument: how to bind values?
Date: 2011-09-23 16:28:59
Message-ID: CAH_hXRas_aMNSbotahEuMTHU6KjgwJsztEO9K1hY+7gEXY_NCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> Do you have to quote 'POINT(?,?)'

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.

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).

---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mikko Tiihonen 2011-09-23 17:01:22 Re: Binary transfer patches v15 - sending part was missing
Previous Message Radosław Smogura 2011-09-23 13:58:42 Re: use of savepoint in containter managed transaction