12drop.mql 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ) with nickname='test_drop'
  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. delete from /test/aaa/test_drop with version
  21. /**
  22. onerror(continue,'not exist','not find','not found')
  23. **/
  24. ;
  25. drop class if exists /test/aaa/test_drop
  26. ;
  27. -- 4. 验证已 drop 的 class(应报错)
  28. select * from /test/aaa/test_drop
  29. /**
  30. onerror(continue,'not exist','not find','not found')
  31. **/
  32. ;
  33. -- 5. 重复 drop 已删除的 class
  34. drop class if exists /test/aaa/test_drop
  35. ;
  36. -- 6. 删除不存在的 class
  37. drop class if exists /test/aaa/non_exist_drop
  38. ;
  39. -- 7. drop 带 alias 的 class
  40. create class if not exists /test/aaa/test_drop_alias (
  41. name varchar,
  42. keys(name)
  43. ) with nickname='drop_alias'
  44. ;
  45. drop class if exists /test/aaa/test_drop_alias
  46. ;
  47. -- 8. 批量创建和删除
  48. create class if not exists /test/aaa/test_batch_drop_1 (
  49. id int,
  50. keys(id)
  51. ) with nickname='test_batch_drop_1'
  52. ;
  53. create class if not exists /test/aaa/test_batch_drop_2 (
  54. id int,
  55. keys(id)
  56. ) with nickname='test_batch_drop_2'
  57. ;
  58. drop class if exists /test/aaa/test_batch_drop_1
  59. ;
  60. drop class if exists /test/aaa/test_batch_drop_2
  61. ;