[MonetDB-users] JDBC: Problem with PreparedStatement parameter in Buffer

George Garbis ggarbis at di.uoa.gr
Mon Oct 10 12:12:23 CEST 2011


According to function declaration the second argument is float

CREATE FUNCTION Buffer(a Geometry, distance FLOAT) RETURNS Geometry
external name geom."Buffer";

So, why it is not clear what type to be expected ?
Is there any way to use question marks as function arguments?

--
George Garbis


On Mon, Oct 10, 2011 at 12:11 PM, Fabian Groffen <Fabian.Groffen at cwi.nl>wrote:

> On 10-10-2011 12:04:16 +0300, George Garbis wrote:
> > st = con.prepareStatement("SELECT Buffer(t.g, ?) AS buffer, t.g AS point
> > FROM geom AS t"); // This line throws an SQLException
>
> All queries from your mail, and in particular this one is misuse of the
> prepared statement.  The question mark is meant to be used on positions
> where it is clearly known what type is to be expected, e.g.:
>  SELECT x, y FROM table WHERE id = ?;
>
> > st.setFloat(1, (float)1.0);
>
> You better just do string manipulation here, and send that to the
> server.
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> MonetDB-users mailing list
> MonetDB-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/users-list/attachments/20111010/f9d63bb3/attachment.html>


More information about the users-list mailing list