23noerrinfo_skip.mql 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. -- ============================================================
  2. -- noerrinfo() skip() onerror(continue/break) 测试
  3. -- ============================================================
  4. -- 1. noerrinfo() - 出错时不输出错误信息
  5. insert into /test/aaa/non_exist_xxx (name) values ('noerrinfo test')
  6. /**
  7. noerrinfo()
  8. onerror(continue,'not exist','not find','not found')
  9. **/
  10. ;
  11. -- 2. skip() - 跳过本语句(不执行)
  12. insert into /test/aaa/test_ext (e_name, e_value) values ('should_be_skipped', 999)
  13. /**
  14. skip()
  15. **/
  16. ;
  17. -- 验证 skip() 的语句未执行
  18. select e_name from /test/aaa/test_ext where e_name='should_be_skipped'
  19. /**
  20. output()
  21. count(0)
  22. **/
  23. ;
  24. -- 3. onerror(continue) - 出错时忽略错误,继续执行
  25. insert into /test/aaa/non_exist_xxx_continue (name) values ('continue test')
  26. /**
  27. onerror(continue,'not exist','not find','not found')
  28. **/
  29. ;
  30. -- 验证错误被忽略后,后续语句继续执行
  31. select count(*) from /test/aaa/test_ext
  32. /**
  33. output()
  34. **/
  35. ;
  36. -- 4. onerror(break) - 出错时中断循环(配合 loop 使用)
  37. insert into /test/aaa/non_exist_class_break (e_name) values ('break_test')
  38. /**
  39. scope(mql)
  40. loop(3)
  41. onerror(break)
  42. noerrinfo()
  43. **/
  44. ;