开发者

Why groovy sql remove schema name from SQL queries?

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 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜