-1

以下のコードは、SQL の各行に権限を与えます。SQL 書き込みの最後に 1 行を修正する方法はありますか? その構文は何ですか?「このレポートは 2013 年 7 月 1 日にユーザー John Doe によって実行されました」のようなものです。

db.eachRow(sql) {
    def desc = it.summary
    desc = desc.replaceAll("[\r\n]", "")
    file.append(it.CHANGEID + "\t" + it.REGION + "\t" + it.DIVISION + "\t" + desc + "\t" + "\n")
    }
4

2 に答える 2

1

もしかして

String user = 'tim' // for example

new File( 'output.txt' ).withWriter { w ->
  db.eachRow(sql) {
    def desc = it.summary
    desc = desc.replaceAll("[\r\n]", "")
    w.writeLine( "$it.CHANGEID\t$it.REGION\t$it.DIVISION\t$desc" )
  }
  w.writeLine( "written by $user on ${new Date()}" )
}
于 2013-07-01T19:07:40.700 に答える