wecisecode 2 hete
szülő
commit
033fc0bce1

+ 1 - 1
odbctest/mql/aaa/16partition/00init.mql

@@ -19,7 +19,7 @@ create class if not exists /test/aaa/test_mpartition (
 
     indexes(m_id, m_name, m_value),
     keys(m_id, m_name)
-) with partition=m_id, partition=m_name, core=cassandraonly
+) with partition=(m_id, m_name), core=cassandraonly
 ;
 
 -- 等待数据写入完成

+ 7 - 24
odbctest/mql/aaa/18prepare/14prepare_batch.mql

@@ -3,18 +3,11 @@
 -- ============================================================
 
 -- 1. 通过 loop 模拟 prepare batch 插入
+insert into /test/aaa/test_prepare (p_name, p_int) values (?, ?)
 /**
 scope(mql)
 loop(5)
-beforerun(set(prep_name, concat('prep_batch_', mqli)), set(prep_val, mqli))
-**/
-;
-
-insert into /test/aaa/test_prepare (p_name, p_int) values (?, ?)
-/**
-params(prep_name, prep_val)
-onerror(continue,'invalid value for int field')
+params("prep_batch_{%d,mqli}", {%d,mqli})
 **/
 ;
 
@@ -26,17 +19,11 @@ output()
 ;
 
 -- 3. 再次使用 loop 做批量 update
+update /test/aaa/test_prepare set p_int=? where p_name=?
 /**
 scope(mql)
 loop(5)
-beforerun(set(prep_name, concat('prep_batch_', mqli)), set(prep_val, 999))
-**/
-;
-
-update /test/aaa/test_prepare set p_int=? where p_name=?
-/**
-params(prep_val, prep_name)
-onerror(continue)
+params(999, "prep_batch_{%d,mqli}")
 **/
 ;
 
@@ -47,18 +34,12 @@ output()
 **/
 ;
 
+-- 5. 批量删除(删除前 3 条)
+delete from /test/aaa/test_prepare where p_name=?
 /**
 scope(mql)
 loop(3)
-beforerun(set(prep_name, concat('prep_batch_', mqli)))
-**/
-;
-
-delete from /test/aaa/test_prepare where p_name=?
-/**
-params(prep_name)
-onerror(continue)
+params("prep_batch_{%d,mqli}")
 **/
 ;
 

+ 2 - 1
odbctest/mql/aaa/19extensions/12loop_file.mql

@@ -1,5 +1,5 @@
 -- ============================================================
+-- scope(file) loop(N) parallel(N) 测试:{%d,filei} {%d,filemqls}
 -- ============================================================
 
 /**
@@ -11,7 +11,7 @@ parallel(2)
 
 -- 并发循环执行本文件 3 次,最大并行数 2
 -- 使用 filei 作为流水号
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values (concat('file_test_', {%d,filei}), {%d,filei}, concat('filei=', {%d,filei}, ' filecount=', {%d,filecount}))
+insert into /test/aaa/test_ext (e_name, e_value, e_text) values (concat('file_test_', {%d,filei}), {%d,filei}, concat('filei=', {%d,filei}, ' filemqls=', {%d,filemqls}))
 /**
 onerror(continue)
 sleep(100ms)

+ 3 - 1
odbctest/mql/aaa/19extensions/13loop_dir.mql

@@ -1,5 +1,5 @@
 -- ============================================================
+-- scope(dir) loop(N) 测试:{%d,diri} {%d,dirmqls}
 -- ============================================================
 
 /**
@@ -9,8 +9,8 @@ loop(4)
 ;
 
 -- 对当前目录下所有文件循环 4 次
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values ({%d,diri}, {%d,diri}, concat('diri=', {%d,diri}, ' dircount=', {%d,dircount}))
+-- diri=目录循环索引, dirmqls=当前目录下已执行的 mql 数量
+insert into /test/aaa/test_ext (e_name, e_value, e_text) values ({%d,diri}, {%d,diri}, concat('diri=', {%d,diri}, ' dirmqls=', {%d,dirmqls}))
 /**
 onerror(continue)
 **/

+ 6 - 9
odbctest/mql/aaa/19extensions/14loop_top.mql

@@ -1,17 +1,11 @@
 -- ============================================================
+-- scope(top) 循环变量测试:{%d,topi} {%d,topmqls}
 -- ============================================================
 
-/**
-scope(file)
-loop(1)
-onerror(continue)
-**/
-;
-
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values ({%d,topi}, {%d,topi}, concat('topi=', {%d,topi}, ' topcount=', {%d,topcount}))
+-- 顶层循环次数由配置 loop 控制(默认 1 次)
+-- 00init 中已设置 scope(top) timeout(30m)
+-- topi=顶层循环索引, topmqls=当前测试已执行的 mql 数量
+insert into /test/aaa/test_ext (e_name, e_value, e_text) values (concat('top_', {%d,topi}), {%d,topi}, concat('topi=', {%d,topi}, ' topmqls=', {%d,topmqls}))
 /**
 onerror(continue)
 sleep(100ms)
@@ -19,7 +13,7 @@ sleep(100ms)
 ;
 
 -- 验证 top 循环结果
-select e_name, e_value from /test/aaa/test_ext where e_name=^'top'
+select e_name, e_value from /test/aaa/test_ext where e_name=^'top_'
 /**
 output()
 **/

+ 5 - 9
odbctest/mql/aaa/19extensions/16fork_wait.mql

@@ -3,26 +3,22 @@
 -- ============================================================
 
 -- 1. fork 一个分组执行
+insert into /test/aaa/test_ext (e_name, e_value, e_text) values ('fork_a_1', 100, 'fork group a - 1')
 /**
-beforerun(fork(group_a))
+fork(group_a)
 **/
 ;
 
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values ('fork_a_1', 100, 'fork group a - 1')
-;
-
 -- 2. fork 另一个分组
+insert into /test/aaa/test_ext (e_name, e_value, e_text) values ('fork_a_2', 200, 'fork group a - 2')
 /**
-beforerun(fork(group_a))
+fork(group_a)
 **/
 ;
 
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values ('fork_a_2', 200, 'fork group a - 2')
-;
-
 -- 3. wait 等待 group_a 完成
 /**
-beforerun(wait(group_a))
+wait(group_a)
 **/
 ;
 

+ 11 - 11
odbctest/mql/aaa/19extensions/17beforerun.mql

@@ -70,39 +70,35 @@ output()
 **/
 ;
 
+-- 5. beforerun case 条件判断(条件匹配)
 /**
-beforerun(set(case_val, 'yes'), case(case_val,'yes'))
+beforerun(set(case_val, 'yes'), set(case_result, 'default'), case(case_val=='yes', set(case_result, 'matched')))
 **/
 ;
 
-insert into /test/aaa/test_ext (e_name, e_text) values ('beforerun_case_yes', 'case matched yes')
-/**
-sleep(2s)
-**/
+insert into /test/aaa/test_ext (e_name, e_text) values ('beforerun_case_yes', {%s,case_result})
 ;
 
-select e_name from /test/aaa/test_ext where e_name='beforerun_case_yes'
+select e_name, e_text from /test/aaa/test_ext where e_name='beforerun_case_yes'
 /**
 output()
-count(1)
+match("e_text","matched")
 **/
 ;
 
+-- 6. beforerun case 条件不匹配
 /**
-beforerun(set(case_val, 'no'), case(case_val,'yes'))
+beforerun(set(case_val, 'no'), set(case_result, 'default'), case(case_val=='yes', set(case_result, 'matched')))
 **/
 ;
 
-insert into /test/aaa/test_ext (e_name, e_text) values ('beforerun_case_no', 'case not matched - should not execute')
+insert into /test/aaa/test_ext (e_name, e_text) values ('beforerun_case_no', {%s,case_result})
 ;
 
-select e_name from /test/aaa/test_ext where e_name='beforerun_case_no'
+-- 验证 case 不匹配时保持默认值
+select e_name, e_text from /test/aaa/test_ext where e_name='beforerun_case_no'
 /**
 output()
-onerror(continue)
+match("e_text","default")
 **/
 ;

+ 18 - 35
odbctest/mql/aaa/19extensions/23noerrinfo_skip.mql

@@ -1,8 +1,8 @@
 -- ============================================================
+-- noerrinfo() skip() onerror(continue/break) 测试
 -- ============================================================
 
+-- 1. noerrinfo() - 出错时不输出错误信息
 insert into /test/aaa/non_exist_xxx (name) values ('noerrinfo test')
 /**
 noerrinfo()
@@ -11,66 +11,40 @@ onerror(continue,'not exist','not find','not found')
 ;
 
 -- 2. skip() - 跳过本语句(不执行)
-
+insert into /test/aaa/test_ext (e_name, e_value) values ('should_be_skipped', 999)
 /**
-scope(mql)
-loop(5)
+skip()
 **/
 ;
 
+-- 验证 skip() 的语句未执行
+select e_name from /test/aaa/test_ext where e_name='should_be_skipped'
 /**
-beforerun(case({%d,mqli},'3'))
-**/
-;
-
-insert into /test/aaa/test_ext (e_name, e_value, e_text) values (concat('continue_test_', {%d,mqli}), {%d,mqli}, 'continue test - should skip mqli=3')
-/**
-onerror(continue)
+output()
+count(0)
 **/
 ;
 
+-- 3. onerror(continue) - 出错时忽略错误,继续执行
+insert into /test/aaa/non_exist_xxx_continue (name) values ('continue test')
 /**
-continue
+onerror(continue,'not exist','not find','not found')
 **/
 ;
 
-select e_name from /test/aaa/test_ext where e_name=^'continue_test'
+-- 验证错误被忽略后,后续语句继续执行
+select count(*) from /test/aaa/test_ext
 /**
 output()
 **/
 ;
 
+-- 4. onerror(break) - 出错时中断循环(配合 loop 使用)
+insert into /test/aaa/non_exist_class_break (e_name) values ('break_test')
 /**
 scope(mql)
-loop(10)
-**/
-;
-
-insert into /test/aaa/test_ext (e_name, e_value) values (concat('break_test_', {%d,mqli}), {%d,mqli})
-/**
-onerror(continue)
-**/
-;
-
-/**
-beforerun(case({%d,mqli},'3'))
-**/
-;
-
-/**
-break
-**/
-;
-
-select e_name from /test/aaa/test_ext where e_name=^'break_test'
-/**
-output()
+loop(3)
+onerror(break)
+noerrinfo()
 **/
 ;

+ 8 - 22
odbctest/mql/aaa/19extensions/31subscription.mql

@@ -3,15 +3,9 @@
 -- ============================================================
 
 -- 1. subscribe 订阅
-/**
-beforerun(subscribe('test_topic'))
-**/
-;
-
 insert into /test/aaa/test_ext (e_name, e_text) values ('sub_test_1', 'subscribe topic test')
-;
-
 /**
+subscribe('test_topic')
 sleep(2s)
 **/
 ;
@@ -24,15 +18,9 @@ onerror(continue)
 ;
 
 -- 2. unsubscribe 取消订阅
-/**
-beforerun(unsubscribe('test_topic'))
-**/
-;
-
 insert into /test/aaa/test_ext (e_name, e_text) values ('unsub_test_1', 'unsubscribe topic test')
-;
-
 /**
+unsubscribe('test_topic')
 sleep(2s)
 **/
 ;
@@ -45,20 +33,18 @@ onerror(continue)
 ;
 
 -- 3. 同时 subscribe 多个
-/**
-beforerun(subscribe('topic_a'), subscribe('topic_b'))
-**/
-;
-
 insert into /test/aaa/test_ext (e_name, e_text) values ('multi_sub_test', 'multi subscribe test')
-;
-
 /**
-beforerun(unsubscribe('topic_a'), unsubscribe('topic_b'))
+subscribe('topic_a')
+subscribe('topic_b')
 **/
 ;
 
+-- 取消多个订阅
+insert into /test/aaa/test_ext (e_name, e_text) values ('multi_unsub_test', 'multi unsubscribe test')
 /**
+unsubscribe('topic_a')
+unsubscribe('topic_b')
 sleep(2s)
 **/
 ;

+ 1 - 1
odbctest/mql/aaa/23system/12native.mql

@@ -8,7 +8,7 @@ select count(*) from /test/aaa/test_ext where e_name='ext_001'
 /**
 onerror(continue,'没有找到记录')
 output()
-match("count(*)","1")
+match("count","1")
 **/
 ;