This commit is contained in:
cpwu 2022-04-28 17:59:39 +08:00
parent 3bbc422bd0
commit 2d43f3e56c
1 changed files with 23 additions and 14 deletions

View File

@ -59,21 +59,30 @@ class TDTestCase:
groups = ["", group_having, group_no_having] groups = ["", group_having, group_no_having]
for group_condition in groups: for group_condition in groups:
tdSql.query(f"select {condition} from {tbname} {where_condition} {group_condition} ") # tdSql.query(f"select {condition} from {tbname} {where_condition} {group_condition} ")
datas = [tdSql.getData(i,0) for i in range(tdSql.queryRows)] # datas = [tdSql.getData(i,0) for i in range(tdSql.queryRows)]
# length_data = [ len(str(data)) if data else None for data in datas ] # # length_data = [ len(str(data)) if data else None for data in datas ]
length_data = [] # length_data = []
for data in datas : # for data in datas :
if not data: # if not data:
length_data.append(None) # length_data.append(None)
elif "as nchar" in condition or (NCHAR_COL in condition and "as binary" not in condition): # elif "as nchar" in condition or (NCHAR_COL in condition and "as binary" not in condition):
length_data.append(len(str(data)) * 4) # length_data.append(len(str(data)) * 4)
else: # else:
length_data.append(len(str(data))) # length_data.append(len(str(data)))
# tdSql.query(f"select length( {condition} ) from {tbname} {where_condition} {group_condition}")
# for i in range(len(length_data)):
# tdSql.checkData(i, 0, length_data[i] ) if length_data[i] else tdSql.checkData(i, 0, None)
tdSql.query(f"select {condition}, length( {condition} ) from {tbname} {where_condition} {group_condition} ")
for i in range(tdSql.queryRows):
if not tdSql.getData(i,1):
tdSql.checkData(i, 1, None)
elif "as nchar" in condition or (NCHAR_COL in condition and "as binary" not in condition):
tdSql.checkData(i, 1, len(tdSql.getData(i,1)) * 4 )
else:
tdSql.checkData(i, 1, len(tdSql.getData(i,1)))
tdSql.query(f"select length( {condition} ) from {tbname} {where_condition} {group_condition}")
for i in range(len(length_data)):
tdSql.checkData(i, 0, length_data[i] ) if length_data[i] else tdSql.checkData(i, 0, None)
def __length_err_check(self,tbname): def __length_err_check(self,tbname):
sqls = [] sqls = []