12drop.mql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. -- ============================================================
  2. -- Class drop 操作测试
  3. -- ============================================================
  4. -- 1. 创建临时 class 用于 drop 测试
  5. create class if not exists /test/aaa/test_drop (
  6. name varchar,
  7. value int,
  8. keys(name)
  9. )
  10. ;
  11. -- 2. drop class 前插入数据验证
  12. insert into /test/aaa/test_drop (name, value) values ('before_drop', 100)
  13. ;
  14. select * from /test/aaa/test_drop where name='before_drop'
  15. /**
  16. output()
  17. **/
  18. ;
  19. -- 3. drop class 安全操作
  20. drop class if exists /test/aaa/test_drop
  21. ;
  22. -- 4. 验证已 drop 的 class(应报错)
  23. select * from /test/aaa/test_drop
  24. /**
  25. onerror(continue,'not exist','not find','not found')
  26. **/
  27. ;
  28. -- 5. 重复 drop 已删除的 class
  29. drop class if exists /test/aaa/test_drop
  30. ;
  31. -- 6. 删除不存在的 class
  32. drop class if exists /test/aaa/non_exist_drop
  33. ;
  34. -- 7. drop 带 alias 的 class
  35. create class if not exists /test/aaa/test_drop_alias (
  36. name varchar,
  37. keys(name)
  38. ) with nickname='drop_alias'
  39. ;
  40. drop class if exists /test/aaa/test_drop_alias
  41. ;
  42. -- 8. 批量创建和删除
  43. create class if not exists /test/aaa/test_batch_drop_1 (
  44. id int,
  45. keys(id)
  46. )
  47. ;
  48. create class if not exists /test/aaa/test_batch_drop_2 (
  49. id int,
  50. keys(id)
  51. )
  52. ;
  53. drop class if exists /test/aaa/test_batch_drop_1
  54. ;
  55. drop class if exists /test/aaa/test_batch_drop_2
  56. ;