我有一个包含内容的文本文件:
ACTION = NEW // (NEW, CHANGE)
NEW_NUMBER = '123456'
NUMBER_FOR_CHANGE = '789456'
TEXT_NAME1 = 'TEST1'
TEXT_NAME2 = 'TEST2'
TEXT_NAME3 = 'TEST3'
我想在 Groovy 脚本上编写一个代码来解析这个文件并进行下一个更改:
如果行动=新:
`sql.executeInsert "INSERT INTO TABLE.DB (NUMBER, NAME1, NAME2, NAME3) VALUES ($NEW_NUMBER, $TEXT_NAME1, $TEXT_NAME2, $TEXT_NAME3)" `
如果行动=改变:
sql.executeUpdate "UPDATE TABLE.DB SET NAME1 = $TEXT_NAME1, NAME2 = $TEXT_NAME2, NAME3 = $TEXT_NAME3 WHERE NUMBER LIKE $NUMBER_FOR_CHANGE"
如果动作 = 删除:
sql.execute "DELETE FROM TABLE.DB WHERE NUMBER = $NUMBER_FOR_CHANGE"
我将不胜感激任何帮助
谢谢