{"title":"批处理","inframe":false,"hidden":false,"roles":{"dev":1},"pageLink":"","children":[{"configs":{"serverScript":"var rows = [{\n  ID_FIELD: SysUtil.getId(),\n  STRING_FIELD: 'value 1',\n  DATETIME_FIELD: new Date()\n}, {\n  ID_FIELD: SysUtil.getId(),\n  STRING_FIELD: 'value 2',\n  DATETIME_FIELD: new Date()\n}, {\n  ID_FIELD: SysUtil.getId(),\n  STRING_FIELD: 'value 3',\n  DATETIME_FIELD: new Date()\n}];\n//除varchar类型无需显式指定参数类型，其他类型建议显式指定参数类型，以适应跨数据库需要。在SQL Server中无需指定类型。具体取决于JDBC驱动对参数的理解。\n//如果使用批处理，app.run方法默认启用事务\napp.run('insert into WB_MISC (ID_FIELD,STRING_FIELD,DATETIME_FIELD)' +\n  ' values({?ID_FIELD?},{?nvarchar.STRING_FIELD?},{?timestamp.DATETIME_FIELD?})', {\n    arrayData: new org.json.JSONArray(Wb.encode(rows))\n  });\n//如果 arrayData 来自外部参数，可使用arrayName参数替代\n/*\napp.run(sql, {\n  arrayName: 'arrayParamName'\n});\n*/\napp.send('请查看module serverScript中的源码');","itemId":"module"},"children":[],"type":"module","expanded":false}],"iconCls":""}