使用Groovy SQL类时,有没有办法查看发送到数据库的原始SQL。例如,以下代码...
def starship_name = mySql.firstRow("select name from starship where id = ${starShipId}".toString())?.name
我希望能够在控制台上看到类似.......
的内容select name from starship where id = 8
答案 0 :(得分:0)
您可以构建字符串,将其打印然后执行:
def query = "select name from starship where id = ${starShipId}"
println query
def starship_name = mySql.firstRow(query)