28schema.mql 702 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. -- ============================================================
  2. -- schema(C) 检查类是否存在
  3. -- ============================================================
  4. -- 1. schema 检查已存在的 class
  5. /**
  6. schema(/test/aaa/test_ext)
  7. **/
  8. ;
  9. select count(*) from /test/aaa/test_ext
  10. /**
  11. output()
  12. **/
  13. ;
  14. -- 2. schema 检查不存在的 class(应跳过)
  15. /**
  16. schema(/test/aaa/non_exist_schema_class)
  17. **/
  18. ;
  19. select count(*) from /test/aaa/non_exist_schema_class
  20. /**
  21. onerror(continue,'not exist','not find','not found')
  22. **/
  23. ;
  24. -- 3. 使用 schema 验证 class 存在后才执行
  25. /**
  26. schema(/test/aaa/test_ext)
  27. **/
  28. ;
  29. select e_name from /test/aaa/test_ext where e_name='ext_001'
  30. /**
  31. output()
  32. count(1)
  33. **/
  34. ;