{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"quoted":"true","itemId":"text","js":"//获取本次请求共享的数据库连接对象，query和dp默认使用该连接\n//var connection = DbUtil.getConnection(request);\n//connection.setAutoCommit(false);该代码等效app.run(sql,{transaction:'start'});\n//开始事务并执行SQL语句\napp.run('update WB_MISC set INT_FIELD=123 where 1=0', {\n  transaction: 'start'\n});\napp.run('update WB_DUAL set DMY=0 where 1=0'); //在一个事务内执行其他SQL语句\n//此处可编写其他更多业务代码\n//throw '异常';如果发生任何异常，系统自动回滚数据库事务\n//如果所有代码没有发生异常，在本次请求完成后系统自动提交数据库事务"},"expanded":false,"children":[],"type":"string"},{"configs":{"layout":"fit","itemId":"viewport1"},"expanded":true,"children":[{"configs":{"itemId":"xwl1","file":"m?xwl=sys/dialog/dev/script-editor"},"expanded":false,"children":[],"type":"xwl"}],"type":"viewport","events":{"afterrender":"app.xwl1.setValue(\"{#text#}\", null, true);"}}],"type":"module"}],"roles":{"demo":1},"title":"事务处理","iconCls":"","inframe":false,"pageLink":""}