Hi
I need to send to Postgresql the query:
/SELECT a, a_tsvector
FROM t1
WHERE a_tsvector @@ to_tsquery('aa:* & bb:* & ccc:* & dddd:*')
LIMIT 10 ;/
I am succeding with:
/def query2 = 'SELECT a, a_tsvector FROM t2 WHERE a_tsvector @@
to_tsquery(\'aa:* & bb:* & ccc:* & dddd:*\') LIMIT 10 ; '
def rows = db.rows(query2)/
But I fail attempting a PreparedStatement with parameters, like this:
/def query1 = 'SELECT a, a_tsvector FROM t2 WHERE a_tsvector @@
to_tsquery(\':a & :b & :c & :d\') LIMIT 10 ; '
def params = [ a: 'aa:*', b: 'bb:*', c: 'ccc:*', d: 'dddd:*' ]
def rows = db.rows(query1,params)/
Jun 20, 2013 1:13:26 PM groovy.sql.Sql$AbstractQueryCommand execute
WARNING: Failed to execute: SELECT a, a_tsvector FROM t2 WHERE a_tsvector @@
to_tsquery(':a & :b & :c & :d') LIMIT 10 ; because: Can't infer the SQL
type to use for an instance of java.util.LinkedHashMap. Use setObject() with
an explicit Types value to specify the type to use.
Caught: org.postgresql.util.PSQLException: Can't infer the SQL type to use
for an instance of java.util.LinkedHashMap. Use setObject() with an explicit
Types value to specify the type to use.
org.postgresql.util.PSQLException: Can't infer the SQL type to use for an
instance of java.util.LinkedHashMap. Use setObject() with an explicit Types
value to specify the type to use.
at
org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1805)
at
org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:37)
at
org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:46)
at test_postgresql_fts.run(test_postgresql_fts.groovy:21)
Thank you very much in advance.
Regards, Rawi
--
View this message in context:
http://groovy.329449.n5.nabble.com/Please-help-with-SQL-PreparedStatement-tp5715892.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email