groovy字符串格式

时间:2012-03-14 14:02:26

标签: groovy

我正在尝试测试groovy / grails的SQL查询。仔细考虑为什么SQL插入不起作用,我正在尝试打印出该查询行。令人惊讶,甚至不是那个工作,所以我正在调查groovy中的字符串格式。如果有人对此有所了解,请告诉我。

println  """INSERT INTO iu (version, path, uuid, name, description,
                            sourceversionfrom, sourceversionexto,
                            targetversionfrom, targetversionexto,
                            phase, directive, classname, methodname,
                            functionalarea_id, upgradepath_id, date_created,
                            last_updated, mark4delete, firstAvailable_id,
                            lastAvailable_id, uniqueid_id, elementcreateddate,
                            purpose, implementationdetails, userimpact)
              VALUES ( ${this.version}, ${this.path}, ${this.uuid}, ${this.name},
                       ${this.description}, ${this.sourceversionfrom},
                       ${this.sourceversionexto}, ${this.targetversionfrom},
                       ${this.targetversionexto}, ${this.phase}, ${this.directive},
                       ${this.classname}, ${this.methodname}, $functionalarea_id,
                       $upgradepath_id, NOW(), NOW(), 0, ${this.projID},
                       ${this.projID}, ${this.uniqueid_id},
                       ${this.getElementCreatedDate()}, ${this.purpose},
                       ${this.implementationDetails}, ${this.userImpact} )"""

程序在该行之后停止并待命

1 个答案:

答案 0 :(得分:1)

您的查询字符串没有任何问题。该程序可能会在通过getter或version调用时检索其中一个属性(pathuuidgetElementCreatedDate等)。

要查看程序挂起时您正在执行的操作,可以生成线程转储。当在终端或控制台窗口中以交互方式运行groovy时,发送QUIT信号或在Linux或OS X上键入 ctrl - \ ,或在Windows上键入 ctrl-break 。查找"main"线程并向下扫描堆栈跟踪,直到找到自己的代码。