fix: tweak delete max value

This commit is contained in:
Alex Duan 2024-01-20 14:26:34 +08:00
parent 95975801d5
commit e1b0d4a555
2 changed files with 14 additions and 1 deletions

View File

@ -172,7 +172,14 @@ class TDTestCase(TBase):
realMax = self.queryMax(colname)
if realMax != expectMax:
tdLog.exit(f"Max value not expect. expect:{expectMax} real:{realMax}")
sql = f"delete from d0 where ui={expectMax}"
# query ts list
sql = f"select ts from d0 where ui={expectMax}"
tdSql.query(sql)
tss = tdSql.getColData(0)
strts = ",".join(tss)
# delete
sql = f"delete from d0 where ts in ({strts})"
tdSql.execute(sql)
expectMax -= 1

View File

@ -224,6 +224,12 @@ class TDSql:
self.checkRowCol(row, col)
return self.res[row][col]
def getColData(self, col):
colDatas = []
for i in range(self.queryRows):
colDatas.append(self.res[i][col])
return colDatas
def getResult(self, sql):
self.sql = sql
try: