0.alterclass.mql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. delete from /ootest/test/basic/extend with version
  2. -- { onerror(continue) }
  3. ;
  4. delete from /ootest/test/basic with version
  5. -- { onerror(continue) }
  6. ;
  7. delete from /ootest/test with version
  8. -- { onerror(continue) }
  9. ;
  10. delete from /ootest with version
  11. -- { onerror(continue) }
  12. ;
  13. drop class if exists /ootest/test/basic/extend
  14. -- { sleep(1s) }
  15. ;
  16. drop class if exists /ootest/test/basic
  17. -- { sleep(1s) }
  18. ;
  19. drop class if exists /ootest/test
  20. -- { sleep(1s) }
  21. ;
  22. drop class if exists /ootest
  23. -- { onerror(continue) sleep(1s) }
  24. ;
  25. create class if not exists /ootest()
  26. -- { sleep(1s) schema(/ootest) retry(3) }
  27. ;
  28. create class if not exists /ootest/test(
  29. xid int "id",
  30. xcode varchar "code",
  31. xkey varchar "key",
  32. xextend text "",
  33. vtime timestamp "vtime",
  34. keys(xid),
  35. indexes(xid,xcode,xkey)
  36. )
  37. -- { sleep(1s) schema(/ootest/test) retry(3) }
  38. ;
  39. create class if not exists /ootest/test/basic()
  40. -- { sleep(1s) schema(/ootest/test/basic) retry(3) }
  41. ;
  42. create class if not exists /ootest/test/basic/extend()
  43. -- { sleep(1s) schema(/ootest/test/basic/extend) retry(3) }
  44. ;
  45. alter class /ootest/test/basic/extend add index column
  46. z0000name varchar 'name',
  47. z0000desc varchar 'desc',
  48. z0000type varchar 'type'
  49. -- { sleep(1s) }
  50. ;
  51. insert into /ootest/test/basic/extend (xid,xcode,xkey,z0000name,z0000desc,z0000type,xextend)
  52. values (10000,'10000','10000.10000','10000','10000','xxxx','...128 Bytes...')
  53. ;
  54. insert into /ootest/test/basic/extend (xid,xcode,xkey,z0000name,z0000desc,z0000type,xextend)
  55. values (20000,'20000','20000.20000','20000','20000','yyyy','...128 Bytes...')
  56. ;
  57. insert into /ootest/test/basic/extend (xid,xcode,xkey,z0000name,z0000desc,z0000type,xextend)
  58. values (30000,'30000','30000.30000','30000','30000','xxxx','...128 Bytes...')
  59. ;
  60. insert into /ootest/test/basic/extend (xid,xcode,xkey,z0000name,z0000desc,z0000type,xextend)
  61. values (40000,'40000','40000.40000','40000','40000','xxxx','...128 Bytes...')
  62. ;
  63. select * from /ootest/test/basic/extend refresh
  64. -- { output() count(4) }
  65. ;
  66. select * from /ootest/test/basic/extend where xid=10000 refresh
  67. -- { output() count(1) equal(0,z0000type,xxxx) }
  68. ;
  69. select * from /ootest/test/basic/extend where xcode='10000' refresh
  70. -- { output() count(1) equal(0,z0000type,xxxx) }
  71. ;
  72. select * from /ootest/test/basic/extend where z0000type='xxxx' refresh
  73. -- { output() count(3) }
  74. ;
  75. select * from /ootest/test/basic/extend where z0000type='yyyy' refresh
  76. -- { output() count(1) }
  77. ;
  78. select * from /ootest/test/basic/extend where z0000type=null refresh
  79. -- { output() count(0) }
  80. ;
  81. select * from /ootest/test/basic/extend order by xcode refresh
  82. -- { output() count(4) equal(2,z0000type,xxxx) }
  83. ;
  84. select xcode,vtime from /ootest/test/basic/extend order by vtime desc refresh
  85. -- { output() count(4) sleep(10s) equal(0,xcode,40000) }
  86. ;