I need to execute this query:
Select * from my_schema.table_within_schema
Unfortunately groogy.sql.SQL is removing my_schema and executing a query without schema information:
Select * from table_within_schema
I wonder if it is possible to force groovy.sql.Sql to keep a schema name in the query.
Groovy: 1.7, Db: I use a jdbc driver that requires开发者_运维技巧 a schema name specified.
I haven't run into this situation yet but you can 'force' groovy to use a String query instead of a GString if you want to, below is a mysql jdbc example:
Sql sql = ...(the usual)
def query = "SELECT * from `my_schema`.mytable"
sql.eachRow( query.toString() ) {
// do something
}
精彩评论