| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- -- ============================================================
- -- Prepare Batch 操作测试
- -- ============================================================
- -- 1. 通过 loop 模拟 prepare batch 插入
- -- 使用 beforerun 设置变量实现批量 prepare
- /**
- scope(mql)
- loop(5)
- beforerun(set(prep_name, concat('prep_batch_', mqli)), set(prep_val, mqli))
- **/
- ;
- insert into /test/aaa/test_prepare (p_name, p_int) values (?, ?)
- /**
- params(prep_name, prep_val)
- onerror(continue,'invalid value for int field')
- **/
- ;
- -- 2. 验证 prep batch 插入结果
- select p_name, p_int from /test/aaa/test_prepare where p_name=^'prep_batch'
- /**
- output()
- **/
- ;
- -- 3. 再次使用 loop 做批量 update
- /**
- scope(mql)
- loop(5)
- beforerun(set(prep_name, concat('prep_batch_', mqli)), set(prep_val, 999))
- **/
- ;
- update /test/aaa/test_prepare set p_int=? where p_name=?
- /**
- params(prep_val, prep_name)
- onerror(continue)
- **/
- ;
- -- 4. 验证批量更新
- select p_name, p_int from /test/aaa/test_prepare where p_name=^'prep_batch'
- /**
- output()
- **/
- ;
- -- 5. 批量删除
- /**
- scope(mql)
- loop(3)
- beforerun(set(prep_name, concat('prep_batch_', mqli)))
- **/
- ;
- delete from /test/aaa/test_prepare where p_name=?
- /**
- params(prep_name)
- onerror(continue)
- **/
- ;
- -- 6. 验证批量删除
- select p_name from /test/aaa/test_prepare where p_name=^'prep_batch'
- /**
- output()
- **/
- ;
|