22onerror.mql 1000 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. -- ============================================================
  2. -- onerror(continue, must, exit) 各种错误处理测试
  3. -- ============================================================
  4. -- 1. onerror(continue) - 忽略错误继续执行
  5. insert into /test/aaa/non_exist_class (name) values ('test')
  6. /**
  7. onerror(continue,'not exist','not find','not found')
  8. **/
  9. ;
  10. -- 2. onerror(continue) - 忽略重复插入错误
  11. insert into /test/aaa/test_ext (e_name, e_value) values ('ext_001', 1)
  12. /**
  13. onerror(continue)
  14. **/
  15. ;
  16. -- 3. onerror(continue) - 忽略多个错误关键词
  17. select * from /test/aaa/no_such_class_222 where x=1
  18. /**
  19. onerror(continue,'not exist','not find','not found','no such','cannot')
  20. **/
  21. ;
  22. -- 4. onerror(continue) - 空参数,忽略所有错误
  23. insert into /test/aaa/test_ext (e_name) values ('onerror_all')
  24. /**
  25. onerror(continue)
  26. **/
  27. ;
  28. -- 验证上面的插入成功(虽然有错但被忽略了)
  29. select e_name from /test/aaa/test_ext where e_name='onerror_all'
  30. /**
  31. output()
  32. **/
  33. ;