From b01865f6c45bdb0e8fa80408ae59fbe9f2da6f96 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Fri, 11 Jun 2021 22:17:38 +0800 Subject: [PATCH 01/10] [TD-4366] adding more ntp. try to make sure ntp is turned on --- tests/pytest/client/change_time_1_1.py | 4 +++- tests/pytest/client/change_time_1_2.py | 4 ++-- tests/pytest/fulltest.sh | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py index 24e0195a9c..abae49a41f 100644 --- a/tests/pytest/client/change_time_1_1.py +++ b/tests/pytest/client/change_time_1_1.py @@ -51,7 +51,8 @@ class TDTestCase: #move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write #leaving 7 data files. os.system ('timedatectl set-time 2020-10-25') - os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") + os.system('sudo timedatectl set-ntp on') commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') print(result.count('data')) @@ -61,6 +62,7 @@ class TDTestCase: tdLog.debug("data file number correct") tdSql.query('select first(ts) from stb_0') tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + os.system('sudo timedatectl set-ntp on') def stop(self): os.system('sudo timedatectl set-ntp on') diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index cd1a17926d..855b04873c 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -62,6 +62,7 @@ class TDTestCase: tdDnodes.start(1) tdSql.query('select first(ts) from stb_0') tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + os.system('sudo timedatectl set-ntp on') commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') print(result.count('data')) @@ -69,8 +70,7 @@ class TDTestCase: tdLog.exit('wrong number of files') else: tdLog.debug("data file number correct") - - + os.system('sudo timedatectl set-ntp on') def stop(self): os.system('sudo timedatectl set-ntp on') diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index fe023acc4b..bab56fa657 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -256,8 +256,6 @@ python3 ./test.py -f client/client.py python3 ./test.py -f client/version.py python3 ./test.py -f client/alterDatabase.py python3 ./test.py -f client/noConnectionErrorTest.py -python3 test.py -f client/change_time_1_1.py -python3 test.py -f client/change_time_1_2.py # Misc python3 testCompress.py @@ -344,4 +342,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py +python3 test.py -f client/change_time_1_1.py +python3 test.py -f client/change_time_1_2.py #======================p4-end=============== From 881a5506231700db5b9aeb1928dfd7a159ef905d Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 09:24:15 +0800 Subject: [PATCH 02/10] [TD-4366 adding sleep to prevent time problem] --- tests/pytest/alter/alter_keep.py | 20 ++++++++++---------- tests/pytest/client/change_time_1_1.py | 2 ++ tests/pytest/client/change_time_1_2.py | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/pytest/alter/alter_keep.py b/tests/pytest/alter/alter_keep.py index 9f66b08823..72ca635ac3 100644 --- a/tests/pytest/alter/alter_keep.py +++ b/tests/pytest/alter/alter_keep.py @@ -15,6 +15,7 @@ import sys from util.log import * from util.cases import * from util.sql import * +import time class TDTestCase: @@ -129,9 +130,6 @@ class TDTestCase: tdSql.prepare() - ##TODO: need to wait for TD-4445 to implement the following - ## tests - ## preset the keep tdSql.prepare() @@ -176,20 +174,22 @@ class TDTestCase: tdSql.error('insert into tb values (now-15d, 10)') tdSql.query('select * from tb') tdSql.checkRows(rowNum) - + tdLog.notice('testing keep will be altered if sudden change from small to big') - tdSql.execute('alter database db keep 14,14,14') - tdSql.execute('alter database db keep 15,15,15') - tdSql.execute('insert into tb values (now-15d, 10)') - tdSql.query('select * from tb') - tdSql.checkRows(rowNum + 1) + for i in range(30): + tdSql.execute('alter database db keep 14,14,14') + tdSql.execute('alter database db keep 16,16,16') + tdSql.execute('insert into tb values (now-15d, 10)') + tdSql.query('select * from tb') + rowNum += 1 + tdSql.checkRows(rowNum ) tdLog.notice('testing keep will be altered if sudden change from big to small') tdSql.execute('alter database db keep 16,16,16') tdSql.execute('alter database db keep 14,14,14') tdSql.error('insert into tb values (now-15d, 10)') tdSql.query('select * from tb') - tdSql.checkRows(rowNum + 1) + tdSql.checkRows(rowNum) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py index abae49a41f..54984747b5 100644 --- a/tests/pytest/client/change_time_1_1.py +++ b/tests/pytest/client/change_time_1_1.py @@ -19,6 +19,7 @@ from util.pathFinding import * from util.dnodes import tdDnodes from datetime import datetime import subprocess +import time ##TODO: this is now automatic, but not sure if this will run through jenkins class TDTestCase: @@ -63,6 +64,7 @@ class TDTestCase: tdSql.query('select first(ts) from stb_0') tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database os.system('sudo timedatectl set-ntp on') + time.sleep(5) def stop(self): os.system('sudo timedatectl set-ntp on') diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index 855b04873c..0937080b5c 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -71,6 +71,7 @@ class TDTestCase: else: tdLog.debug("data file number correct") os.system('sudo timedatectl set-ntp on') + time.sleep(5) def stop(self): os.system('sudo timedatectl set-ntp on') From 1a5aac6eeb76378868fe64dd5fd9999f16e8c69e Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 10:04:44 +0800 Subject: [PATCH 03/10] [TD-4366 adding sleep to prevent time problem] --- tests/pytest/client/change_time_1_1.py | 22 ++++++++++++++++------ tests/pytest/client/change_time_1_2.py | 17 ++++++++++++----- tests/pytest/fulltest.sh | 4 ++-- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py index 54984747b5..32917ab2e4 100644 --- a/tests/pytest/client/change_time_1_1.py +++ b/tests/pytest/client/change_time_1_1.py @@ -40,11 +40,16 @@ class TDTestCase: #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 #11 data files should be generated #vnode at TDinternal/community/sim/dnode1/data/vnode - os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") - commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] - result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') - print(result.count('data')) + try: + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) if result.count('data') != 11: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) tdLog.exit('wrong number of files') else: tdLog.debug("data file number correct") @@ -52,8 +57,13 @@ class TDTestCase: #move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write #leaving 7 data files. os.system ('timedatectl set-time 2020-10-25') - os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") + try: + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') print(result.count('data')) @@ -64,7 +74,7 @@ class TDTestCase: tdSql.query('select first(ts) from stb_0') tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database os.system('sudo timedatectl set-ntp on') - time.sleep(5) + tdLog.sleep(10) def stop(self): os.system('sudo timedatectl set-ntp on') diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index 0937080b5c..d693010be4 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -39,11 +39,17 @@ class TDTestCase: #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 #11 data files should be generated #vnode at TDinternal/community/sim/dnode1/data/vnode - os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") - commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] - result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') - print(result.count('data')) + try: + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + if result.count('data') != 11: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) tdLog.exit('wrong number of files') else: tdLog.debug("data file number correct") @@ -63,6 +69,7 @@ class TDTestCase: tdSql.query('select first(ts) from stb_0') tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') print(result.count('data')) @@ -71,7 +78,7 @@ class TDTestCase: else: tdLog.debug("data file number correct") os.system('sudo timedatectl set-ntp on') - time.sleep(5) + tdLog.sleep(10) def stop(self): os.system('sudo timedatectl set-ntp on') diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index bab56fa657..6a8497d241 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -342,6 +342,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py -python3 test.py -f client/change_time_1_1.py -python3 test.py -f client/change_time_1_2.py +# python3 test.py -f client/change_time_1_1.py +# python3 test.py -f client/change_time_1_2.py #======================p4-end=============== From 67d6339f1a4c2072a34d2d6afdc3b654feb774ac Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 12:48:02 +0800 Subject: [PATCH 04/10] [4711] uncomment the test case in fulltest.sh --- tests/pytest/fulltest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 9ab13914de..9e31e930ad 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -346,6 +346,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py -# python3 test.py -f client/change_time_1_1.py -# python3 test.py -f client/change_time_1_2.py +python3 test.py -f client/change_time_1_1.py +python3 test.py -f client/change_time_1_2.py #======================p4-end=============== From 08a9a1f765043c0c04a4e5baef57ed5e1e0b5239 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 13:05:30 +0800 Subject: [PATCH 05/10] [TD-4711] trying to solve the problem of ntp not swtich on --- tests/pytest/client/change_time_1_1.py | 3 ++- tests/pytest/client/change_time_1_2.py | 26 +++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py index 32917ab2e4..1744c09132 100644 --- a/tests/pytest/client/change_time_1_1.py +++ b/tests/pytest/client/change_time_1_1.py @@ -56,8 +56,8 @@ class TDTestCase: #move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write #leaving 7 data files. - os.system ('timedatectl set-time 2020-10-25') try: + os.system ('timedatectl set-time 2020-10-25') os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") except BaseException: os.system('sudo timedatectl set-ntp on') @@ -78,6 +78,7 @@ class TDTestCase: def stop(self): os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) tdSql.close() tdLog.success("alter block manual check finish") diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index d693010be4..d8180136e6 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -54,8 +54,14 @@ class TDTestCase: else: tdLog.debug("data file number correct") - tdSql.query('select first(ts) from stb_0') #check the last data in the database - tdSql.checkData(0,0,datetime(2020,10,11,0,0,0,0)) + + try: + tdSql.query('select first(ts) from stb_0') #check the last data in the database + tdSql.checkData(0,0,datetime(2020,10,11,0,0,0,0)) + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + os.system ('timedatectl set-time 2020-10-25') @@ -63,11 +69,17 @@ class TDTestCase: #4 oldest data file should be removed from tsdb/data #7 data file should be found #vnode at TDinternal/community/sim/dnode1/data/vnode - os.system ('timedatectl set-time 2020-10-25') - tdDnodes.stop(1) - tdDnodes.start(1) - tdSql.query('select first(ts) from stb_0') - tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + + try: + os.system ('timedatectl set-time 2020-10-25') + tdDnodes.stop(1) + tdDnodes.start(1) + tdSql.query('select first(ts) from stb_0') + tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + os.system('sudo timedatectl set-ntp on') tdLog.sleep(10) commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] From 7247919b765009af0b77d08f0110438ce03d1ea7 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 13:08:31 +0800 Subject: [PATCH 06/10] [TD-4711] trying to solve the problem of ntp not swtich on --- tests/pytest/client/change_time_1_2.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index d8180136e6..76400885f8 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -62,9 +62,6 @@ class TDTestCase: os.system('sudo timedatectl set-ntp on') tdLog.sleep(10) - - os.system ('timedatectl set-time 2020-10-25') - #moves 5 days ahead to 2020/10/25 and restart taosd #4 oldest data file should be removed from tsdb/data #7 data file should be found From 90cc682dd3167ba99722ddeec186dd8ae12b4ef9 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 16:27:20 +0800 Subject: [PATCH 07/10] removing from the auto test --- tests/pytest/fulltest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 9e31e930ad..9ab13914de 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -346,6 +346,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py -python3 test.py -f client/change_time_1_1.py -python3 test.py -f client/change_time_1_2.py +# python3 test.py -f client/change_time_1_1.py +# python3 test.py -f client/change_time_1_2.py #======================p4-end=============== From 545f2127e11edf3ace3d79558127cf2f607565d9 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 15 Jun 2021 18:09:47 +0800 Subject: [PATCH 08/10] [TD-4366] retry to commit --- tests/pytest/client/change_time_1_1.py | 1 + tests/pytest/client/change_time_1_2.py | 1 + tests/pytest/fulltest.sh | 8 +++----- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py index 1744c09132..acdea17fbf 100644 --- a/tests/pytest/client/change_time_1_1.py +++ b/tests/pytest/client/change_time_1_1.py @@ -35,6 +35,7 @@ class TDTestCase: ## change system time to 2020/10/20 os.system('sudo timedatectl set-ntp off') + tdLog.sleep(10) os.system('sudo timedatectl set-time 2020-10-20') #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py index 76400885f8..ec483b00be 100644 --- a/tests/pytest/client/change_time_1_2.py +++ b/tests/pytest/client/change_time_1_2.py @@ -34,6 +34,7 @@ class TDTestCase: ## change system time to 2020/10/20 os.system ('timedatectl set-ntp off') + tdLog.sleep(10) os.system ('timedatectl set-time 2020-10-20') #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index e8b369e0cd..1a7a0b64ee 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -257,8 +257,8 @@ python3 ./test.py -f client/client.py python3 ./test.py -f client/version.py python3 ./test.py -f client/alterDatabase.py python3 ./test.py -f client/noConnectionErrorTest.py -#python3 test.py -f client/change_time_1_1.py -#python3 test.py -f client/change_time_1_2.py +python3 test.py -f client/change_time_1_1.py +python3 test.py -f client/change_time_1_2.py # Misc python3 testCompress.py @@ -342,10 +342,8 @@ python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 ./test.py -f tag_lite/drop_auto_create.py python3 test.py -f insert/insert_before_use_db.py -#python3 test.py -f alter/alter_keep.py +python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py -# python3 test.py -f client/change_time_1_1.py -# python3 test.py -f client/change_time_1_2.py #======================p4-end=============== From 86414f03efaf9f20a58fee3df6cfd6fe3fcb31a3 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 16 Jun 2021 09:05:46 +0800 Subject: [PATCH 09/10] [TD-4366] removing time alter test case from auto test --- tests/pytest/fulltest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 1a7a0b64ee..146c47c51d 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -257,8 +257,8 @@ python3 ./test.py -f client/client.py python3 ./test.py -f client/version.py python3 ./test.py -f client/alterDatabase.py python3 ./test.py -f client/noConnectionErrorTest.py -python3 test.py -f client/change_time_1_1.py -python3 test.py -f client/change_time_1_2.py +# python3 test.py -f client/change_time_1_1.py +# python3 test.py -f client/change_time_1_2.py # Misc python3 testCompress.py From 9b6460e1750df2f3634c3c2bc64ca13c50eee2a6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 17 Jun 2021 02:59:37 +0000 Subject: [PATCH 10/10] [TD-4608] add test case for stmt error --- tests/script/api/stmtBatchTest.c | 649 +++++++++++++++++++++++++++++++ 1 file changed, 649 insertions(+) diff --git a/tests/script/api/stmtBatchTest.c b/tests/script/api/stmtBatchTest.c index 24291adfa0..c488f2fa89 100644 --- a/tests/script/api/stmtBatchTest.c +++ b/tests/script/api/stmtBatchTest.c @@ -4406,6 +4406,654 @@ static void SpecifyColumnBatchCase_autoCreateTbl(TAOS *taos) { } +/*=======================*/ +/* +char * taos_stmt_errstr(TAOS_STMT *stmt) 用于在其他stmt API 返回错误(返回错误码或空指针)时获取错误信息,返回的错误信息可能是以下3种的一个: +1. 当stmt或sqlobj为空时的terrno对于的错误消息; +2. (可有的)详细错误消息; +3. 返回的错误码对于的错误消息; +*/ +static int stmt_specifyCol_bind_error_case_001(TAOS_STMT *stmt, int tableNum, int rowsOfPerColum, int bingNum, int lenOfBinaryDef, int lenOfBinaryAct, int columnNum) { + sampleValue* v = (sampleValue *)calloc(1, sizeof(sampleValue)); + + int totalRowsPerTbl = rowsOfPerColum * bingNum; + + v->ts = (int64_t *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * tableNum)); + v->br = (char *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * lenOfBinaryDef)); + v->nr = (char *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * lenOfBinaryDef)); + + int *lb = (int *)malloc(MAX_ROWS_OF_PER_COLUMN * sizeof(int)); + + TAOS_MULTI_BIND *params = calloc(1, sizeof(TAOS_MULTI_BIND) * (size_t)(bingNum * columnNum * (tableNum+1) * rowsOfPerColum)); + char* is_null = malloc(sizeof(char) * MAX_ROWS_OF_PER_COLUMN); + char* no_null = malloc(sizeof(char) * MAX_ROWS_OF_PER_COLUMN); + + int64_t tts = 1591060628000; + + for (int i = 0; i < rowsOfPerColum; ++i) { + lb[i] = lenOfBinaryAct; + no_null[i] = 0; + is_null[i] = (i % 10 == 2) ? 1 : 0; + v->b[i] = (int8_t)(i % 2); + v->v1[i] = (int8_t)((i+1) % 2); + v->v2[i] = (int16_t)i; + v->v4[i] = (int32_t)(i+1); + v->v8[i] = (int64_t)(i+2); + v->f4[i] = (float)(i+3); + v->f8[i] = (double)(i+4); + char tbuf[MAX_BINARY_DEF_LEN]; + memset(tbuf, 0, MAX_BINARY_DEF_LEN); + sprintf(tbuf, "binary-%d-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", i%10); + memcpy(v->br + i*lenOfBinaryDef, tbuf, (size_t)lenOfBinaryAct); + memset(tbuf, 0, MAX_BINARY_DEF_LEN); + sprintf(tbuf, "nchar-%d-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", i%10); + memcpy(v->nr + i*lenOfBinaryDef, tbuf, (size_t)lenOfBinaryAct); + v->ts2[i] = tts + i; + } + + int i = 0; + for (int j = 0; j < bingNum * tableNum; j++) { + params[i+0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + params[i+0].buffer_length = sizeof(int64_t); + params[i+0].buffer = &v->ts[j*rowsOfPerColum]; + params[i+0].length = NULL; + params[i+0].is_null = no_null; + params[i+0].num = rowsOfPerColum; + + params[i+1].buffer_type = TSDB_DATA_TYPE_BOOL; + params[i+1].buffer_length = sizeof(int8_t); + params[i+1].buffer = v->b; + params[i+1].length = NULL; + params[i+1].is_null = is_null; + params[i+1].num = rowsOfPerColum; + + params[i+2].buffer_type = TSDB_DATA_TYPE_INT; + params[i+2].buffer_length = sizeof(int32_t); + params[i+2].buffer = v->v4; + params[i+2].length = NULL; + params[i+2].is_null = is_null; + params[i+2].num = rowsOfPerColum; + + params[i+3].buffer_type = TSDB_DATA_TYPE_FLOAT; + params[i+3].buffer_length = sizeof(float); + params[i+3].buffer = v->f4; + params[i+3].length = NULL; + params[i+3].is_null = is_null; + params[i+3].num = rowsOfPerColum; + + params[i+4].buffer_type = TSDB_DATA_TYPE_BINARY; + params[i+4].buffer_length = (uintptr_t)lenOfBinaryDef; + params[i+4].buffer = v->br; + params[i+4].length = lb; + params[i+4].is_null = is_null; + params[i+4].num = rowsOfPerColum; + + i+=columnNum; + } + + //int64_t tts = 1591060628000; + for (int i = 0; i < totalRowsPerTbl * tableNum; ++i) { + v->ts[i] = tts + i; + } + + unsigned long long starttime = getCurrentTime(); + +// create table m%d (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, br binary(%d), nr nchar(%d), ts2 timestamp) + char *sql = "insert into m0 (ts,b,v4,f4,br) values(?,?,?,?,?)"; + + int code; + //TAOS_STMT *stmtNull = NULL; + //int code = taos_stmt_prepare(stmtNull, sql, 0); + //if (code != 0){ + // printf("failed to execute taos_stmt_prepare. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmtNull)); + // return -1; + //} + + //char* sqlNull = NULL; + //code = taos_stmt_prepare(stmt, sqlNull, 0); + //if (code != 0){ + // printf("failed to execute taos_stmt_prepare. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + //} + + code = taos_stmt_prepare(stmt, sql, 0); + if (code != 0){ + printf("failed to execute taos_stmt_prepare. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + return -1; + } + + int id = 0; + for (int l = 0; l < bingNum; l++) { + for (int zz = 0; zz < tableNum; zz++) { + //char buf[32]; + //sprintf(buf, "m%d", zz); + //code = taos_stmt_set_tbname(stmt, buf); + //if (code != 0){ + // printf("failed to execute taos_stmt_set_tbname. code:0x%x[%s]\n", code, tstrerror(code)); + // return -1; + //} + + //for (int col=0; col < columnNum + 1000; ++col) { + for (int col=0; col < columnNum; ++col) { + if (col >= columnNum) col = 0; + //code = taos_stmt_bind_single_param_batch(NULL, params + id, col); + //code = taos_stmt_bind_single_param_batch(stmt, NULL, col); + //code = taos_stmt_bind_single_param_batch(stmt, params + id, columnNum); + code = taos_stmt_bind_single_param_batch(stmt, params + id, col); + if (code != 0){ + printf("failed to execute taos_stmt_bind_single_param_batch. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + return -1; + } + id++; + } + + //code = taos_stmt_add_batch(NULL); + code = taos_stmt_add_batch(stmt); + if (code != 0) { + printf("failed to execute taos_stmt_add_batch. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + return -1; + } + + //code = taos_stmt_add_batch(stmt); + //if (code != 0) { + // printf("failed to execute taos_stmt_add_batch second. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + // return -1; + //} + } + + code = taos_stmt_execute(stmt); + if (code != 0) { + printf("failed to execute taos_stmt_execute. code:0x%x[%s]\n", code, tstrerror(code)); + return -1; + } + } + + unsigned long long endtime = getCurrentTime(); + unsigned long long totalRows = (uint32_t)(totalRowsPerTbl * tableNum); + printf("insert total %d records, used %u seconds, avg:%u useconds per record\n", totalRows, (endtime-starttime)/1000000UL, (endtime-starttime)/totalRows); + + free(v->ts); + free(v->br); + free(v->nr); + free(v); + free(lb); + free(params); + free(is_null); + free(no_null); + + return 0; +} + +static int stmt_specifyCol_bind_error_case_002(TAOS_STMT *stmt, int tableNum, int rowsOfPerColum, int bingNum, int lenOfBinaryDef, int lenOfBinaryAct, int columnNum) { + sampleValue* v = (sampleValue *)calloc(1, sizeof(sampleValue)); + + int totalRowsPerTbl = rowsOfPerColum * bingNum; + + v->ts = (int64_t *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * tableNum)); + v->br = (char *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * lenOfBinaryDef)); + v->nr = (char *)malloc(sizeof(int64_t) * (size_t)(totalRowsPerTbl * lenOfBinaryDef)); + + int *lb = (int *)malloc(MAX_ROWS_OF_PER_COLUMN * sizeof(int)); + + TAOS_MULTI_BIND *params = calloc(1, sizeof(TAOS_MULTI_BIND) * (size_t)(bingNum * columnNum * (tableNum+1) * rowsOfPerColum)); + char* is_null = malloc(sizeof(char) * MAX_ROWS_OF_PER_COLUMN); + char* no_null = malloc(sizeof(char) * MAX_ROWS_OF_PER_COLUMN); + + int64_t tts = 1591060628000; + + for (int i = 0; i < rowsOfPerColum; ++i) { + lb[i] = lenOfBinaryAct; + no_null[i] = 0; + is_null[i] = (i % 10 == 2) ? 1 : 0; + v->b[i] = (int8_t)(i % 2); + v->v1[i] = (int8_t)((i+1) % 2); + v->v2[i] = (int16_t)i; + v->v4[i] = (int32_t)(i+1); + v->v8[i] = (int64_t)(i+2); + v->f4[i] = (float)(i+3); + v->f8[i] = (double)(i+4); + char tbuf[MAX_BINARY_DEF_LEN]; + memset(tbuf, 0, MAX_BINARY_DEF_LEN); + sprintf(tbuf, "binary-%d", i%10); + memcpy(v->br + i*lenOfBinaryDef, tbuf, (size_t)lenOfBinaryAct); + memset(tbuf, 0, MAX_BINARY_DEF_LEN); + sprintf(tbuf, "nchar-%d", i%10); + memcpy(v->nr + i*lenOfBinaryDef, tbuf, (size_t)lenOfBinaryAct); + v->ts2[i] = tts + i; + } + + int i = 0; + for (int j = 0; j < bingNum * tableNum; j++) { + params[i+0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + params[i+0].buffer_length = sizeof(int64_t); + params[i+0].buffer = &v->ts[j*rowsOfPerColum]; + params[i+0].length = NULL; + params[i+0].is_null = no_null; + params[i+0].num = rowsOfPerColum; + + params[i+1].buffer_type = TSDB_DATA_TYPE_BOOL; + params[i+1].buffer_length = sizeof(int8_t); + params[i+1].buffer = v->b; + params[i+1].length = NULL; + params[i+1].is_null = is_null; + params[i+1].num = rowsOfPerColum; + + params[i+2].buffer_type = TSDB_DATA_TYPE_INT; + params[i+2].buffer_length = sizeof(int32_t); + params[i+2].buffer = v->v4; + params[i+2].length = NULL; + params[i+2].is_null = is_null; + params[i+2].num = rowsOfPerColum; + + params[i+3].buffer_type = TSDB_DATA_TYPE_FLOAT; + params[i+3].buffer_length = sizeof(float); + params[i+3].buffer = v->f4; + params[i+3].length = NULL; + params[i+3].is_null = is_null; + params[i+3].num = rowsOfPerColum; + + params[i+4].buffer_type = TSDB_DATA_TYPE_BINARY; + params[i+4].buffer_length = (uintptr_t)lenOfBinaryDef; + params[i+4].buffer = v->br; + params[i+4].length = lb; + params[i+4].is_null = is_null; + params[i+4].num = rowsOfPerColum; + + i+=columnNum; + } + + //int64_t tts = 1591060628000; + for (int i = 0; i < totalRowsPerTbl * tableNum; ++i) { + v->ts[i] = tts + i; + } + + unsigned long long starttime = getCurrentTime(); + +// create table m%d (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, br binary(%d), nr nchar(%d), ts2 timestamp) + char *sql = "insert into ? (ts,b,v4,f4,br) values(?,?,?,?,?)"; + int code = taos_stmt_prepare(stmt, sql, 0); + if (code != 0){ + printf("failed to execute taos_stmt_prepare. code:0x%x[%s]\n", code, tstrerror(code)); + return -1; + } + + int id = 0; + for (int l = 0; l < bingNum; l++) { + for (int zz = 0; zz < tableNum; zz++) { + char buf[32]; + sprintf(buf, "m%d", zz); + + //stmt=NULL; + code = taos_stmt_set_tbname(stmt, buf); + if (code != 0){ + printf("failed to execute taos_stmt_set_tbname. code:0x%x[%s][%s]\n", code, tstrerror(code), taos_stmt_errstr(stmt)); + return -1; + } + + for (int col=0; col < columnNum; ++col) { + code = taos_stmt_bind_single_param_batch(stmt, params + id, col); + if (code != 0){ + printf("failed to execute taos_stmt_bind_single_param_batch. code:0x%x[%s]\n", code, tstrerror(code)); + return -1; + } + id++; + } + + code = taos_stmt_add_batch(stmt); + if (code != 0) { + printf("failed to execute taos_stmt_add_batch. code:0x%x[%s]\n", code, tstrerror(code)); + return -1; + } + } + + code = taos_stmt_execute(stmt); + if (code != 0) { + printf("failed to execute taos_stmt_execute. code:0x%x[%s]\n", code, tstrerror(code)); + return -1; + } + } + + unsigned long long endtime = getCurrentTime(); + unsigned long long totalRows = (uint32_t)(totalRowsPerTbl * tableNum); + printf("insert total %d records, used %u seconds, avg:%u useconds per record\n", totalRows, (endtime-starttime)/1000000UL, (endtime-starttime)/totalRows); + + free(v->ts); + free(v->br); + free(v->nr); + free(v); + free(lb); + free(params); + free(is_null); + free(no_null); + + return 0; +} + +static void SpecifyColumnBatchErrorCase(TAOS *taos) { + TAOS_STMT *stmt = NULL; + + int tableNum; + int lenOfBinaryDef; + int rowsOfPerColum; + int bingNum; + int lenOfBinaryAct; + int columnNum; + + int totalRowsPerTbl; + +//=======================================================================// +//=============================== single table ==========================// +//========== case 1: ======================// +#if 0 +{ + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 1; + bingNum = 1; + lenOfBinaryDef = 40; + lenOfBinaryAct = 8; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db1"); + stmt_specifyCol_bind_error_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 1 check result end\n\n"); +} +#endif + + //========== case 2: ======================// +#if 1 +{ + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 5; + bingNum = 1; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 15; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db2"); + stmt_specifyCol_bind_error_case_002(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + //checkResult(taos, "m1", 0, totalRowsPerTbl); + //checkResult(taos, "m2", 0, totalRowsPerTbl); + //checkResult(taos, "m3", 0, totalRowsPerTbl); + //checkResult(taos, "m4", 0, totalRowsPerTbl); + //checkResult(taos, "m5", 0, totalRowsPerTbl); + //checkResult(taos, "m6", 0, totalRowsPerTbl); + //checkResult(taos, "m7", 0, totalRowsPerTbl); + //checkResult(taos, "m8", 0, totalRowsPerTbl); + //checkResult(taos, "m9", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 2 check result end\n\n"); +} +#endif + + //========== case 2-1: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 32767; + bingNum = 1; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 15; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db2_1"); + stmt_specifyCol_bind_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + //checkResult(taos, "m1", 0, totalRowsPerTbl); + //checkResult(taos, "m2", 0, totalRowsPerTbl); + //checkResult(taos, "m3", 0, totalRowsPerTbl); + //checkResult(taos, "m4", 0, totalRowsPerTbl); + //checkResult(taos, "m5", 0, totalRowsPerTbl); + //checkResult(taos, "m6", 0, totalRowsPerTbl); + //checkResult(taos, "m7", 0, totalRowsPerTbl); + //checkResult(taos, "m8", 0, totalRowsPerTbl); + //checkResult(taos, "m9", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 2-1 check result end\n\n"); + } +#endif + //========== case 2-2: ======================// +#if 0 + { + printf("====case 2-2 error test start\n"); + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 32768; + bingNum = 1; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 15; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db2_2"); + stmt_specifyCol_bind_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + //checkResult(taos, "m1", 0, totalRowsPerTbl); + //checkResult(taos, "m2", 0, totalRowsPerTbl); + //checkResult(taos, "m3", 0, totalRowsPerTbl); + //checkResult(taos, "m4", 0, totalRowsPerTbl); + //checkResult(taos, "m5", 0, totalRowsPerTbl); + //checkResult(taos, "m6", 0, totalRowsPerTbl); + //checkResult(taos, "m7", 0, totalRowsPerTbl); + //checkResult(taos, "m8", 0, totalRowsPerTbl); + //checkResult(taos, "m9", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("====case 2-2 check result end\n\n"); + } +#endif + + + //========== case 3: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 1; + bingNum = 5; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 20; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db3"); + stmt_specifyCol_bind_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + //checkResult(taos, "m1", 0, totalRowsPerTbl); + //checkResult(taos, "m2", 0, totalRowsPerTbl); + //checkResult(taos, "m3", 0, totalRowsPerTbl); + //checkResult(taos, "m4", 0, totalRowsPerTbl); + //checkResult(taos, "m5", 0, totalRowsPerTbl); + //checkResult(taos, "m6", 0, totalRowsPerTbl); + //checkResult(taos, "m7", 0, totalRowsPerTbl); + //checkResult(taos, "m8", 0, totalRowsPerTbl); + //checkResult(taos, "m9", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 3 check result end\n\n"); + } +#endif + + //========== case 4: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 5; + bingNum = 5; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 33; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db4"); + stmt_specifyCol_bind_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + //checkResult(taos, "m1", 0, totalRowsPerTbl); + //checkResult(taos, "m2", 0, totalRowsPerTbl); + //checkResult(taos, "m3", 0, totalRowsPerTbl); + //checkResult(taos, "m4", 0, totalRowsPerTbl); + //checkResult(taos, "m5", 0, totalRowsPerTbl); + //checkResult(taos, "m6", 0, totalRowsPerTbl); + //checkResult(taos, "m7", 0, totalRowsPerTbl); + //checkResult(taos, "m8", 0, totalRowsPerTbl); + //checkResult(taos, "m9", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 4 check result end\n\n"); + } +#endif + +//=======================================================================// +//=============================== multi tables ==========================// + //========== case 5: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 5; + rowsOfPerColum = 1; + bingNum = 1; + lenOfBinaryDef = 40; + lenOfBinaryAct = 16; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db5"); + stmt_specifyCol_bind_case_002(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + checkResult(taos, "m1", 0, totalRowsPerTbl); + checkResult(taos, "m2", 0, totalRowsPerTbl); + checkResult(taos, "m3", 0, totalRowsPerTbl); + checkResult(taos, "m4", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 5 check result end\n\n"); + } +#endif + + //========== case 6: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 5; + rowsOfPerColum = 5; + bingNum = 1; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 20; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db6"); + stmt_specifyCol_bind_case_002(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + checkResult(taos, "m1", 0, totalRowsPerTbl); + checkResult(taos, "m2", 0, totalRowsPerTbl); + checkResult(taos, "m3", 0, totalRowsPerTbl); + checkResult(taos, "m4", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 6 check result end\n\n"); + } +#endif + + //========== case 7: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 5; + rowsOfPerColum = 1; + bingNum = 5; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 33; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db7"); + stmt_specifyCol_bind_case_002(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + checkResult(taos, "m1", 0, totalRowsPerTbl); + checkResult(taos, "m2", 0, totalRowsPerTbl); + checkResult(taos, "m3", 0, totalRowsPerTbl); + checkResult(taos, "m4", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 7 check result end\n\n"); + } +#endif + + //========== case 8: ======================// +#if 0 +{ + stmt = taos_stmt_init(taos); + + tableNum = 5; + rowsOfPerColum = 5; + bingNum = 5; + lenOfBinaryDef = 1000; + lenOfBinaryAct = 40; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db8"); + stmt_specifyCol_bind_case_002(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + checkResult(taos, "m1", 0, totalRowsPerTbl); + checkResult(taos, "m2", 0, totalRowsPerTbl); + checkResult(taos, "m3", 0, totalRowsPerTbl); + checkResult(taos, "m4", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 8 check result end\n\n"); +} +#endif + + //=======================================================================// + //=============================== multi-rows to single table ==========================// + //========== case 9: ======================// +#if 0 + { + stmt = taos_stmt_init(taos); + + tableNum = 1; + rowsOfPerColum = 23740; + bingNum = 1; + lenOfBinaryDef = 40; + lenOfBinaryAct = 8; + columnNum = 5; + + prepareVcolumn(taos, 1, tableNum, lenOfBinaryDef, "db9"); + stmt_specifyCol_bind_case_001(stmt, tableNum, rowsOfPerColum, bingNum, lenOfBinaryDef, lenOfBinaryAct, columnNum); + + totalRowsPerTbl = rowsOfPerColum * bingNum; + checkResult(taos, "m0", 0, totalRowsPerTbl); + taos_stmt_close(stmt); + printf("case 9 check result end\n\n"); + } +#endif + + return ; + +} + int main(int argc, char *argv[]) { TAOS *taos; @@ -4472,6 +5120,7 @@ int main(int argc, char *argv[]) //runCase_long(taos); //SpecifyColumnBatchCase(taos); SpecifyColumnBatchCase_autoCreateTbl(taos); + //SpecifyColumnBatchErrorCase(taos); return 0; }