update CI test case stmt_error
This commit is contained in:
parent
48560ddf43
commit
c9153b8176
|
@ -196,6 +196,51 @@ class TDTestCase:
|
|||
conn.close()
|
||||
raise err
|
||||
|
||||
def test_stmt_nornmal_value_error(self, conn):
|
||||
# type: (TaosConnection) -> None
|
||||
dbname = "pytest_taos_stmt_error"
|
||||
try:
|
||||
conn.execute("drop database if exists %s" % dbname)
|
||||
conn.execute("create database if not exists %s" % dbname)
|
||||
conn.select_db(dbname)
|
||||
|
||||
conn.execute(
|
||||
"create table if not exists log(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\
|
||||
bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \
|
||||
ff float, dd double, bb binary(100), nn nchar(100), tt timestamp , error_data int )",
|
||||
)
|
||||
conn.load_table_info("log")
|
||||
|
||||
|
||||
stmt = conn.statement("insert into log values(NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
|
||||
params = new_bind_params(16)
|
||||
params[0].timestamp(1626861392589, PrecisionEnum.Milliseconds)
|
||||
params[1].bool(True)
|
||||
params[2].tinyint(None)
|
||||
params[3].tinyint(2)
|
||||
params[4].smallint(3)
|
||||
params[5].int(4)
|
||||
params[6].bigint(5)
|
||||
params[7].tinyint_unsigned(6)
|
||||
params[8].smallint_unsigned(7)
|
||||
params[9].int_unsigned(8)
|
||||
params[10].bigint_unsigned(9)
|
||||
params[11].float(10.1)
|
||||
params[12].double(10.11)
|
||||
params[13].binary("hello")
|
||||
params[14].nchar("stmt")
|
||||
params[15].timestamp(1626861392589, PrecisionEnum.Milliseconds)
|
||||
|
||||
stmt.bind_param(params)
|
||||
stmt.execute()
|
||||
|
||||
conn.close()
|
||||
|
||||
except Exception as err:
|
||||
conn.execute("drop database if exists %s" % dbname)
|
||||
conn.close()
|
||||
raise err
|
||||
|
||||
def run(self):
|
||||
|
||||
self.test_stmt_insert(self.conn())
|
||||
|
@ -203,7 +248,16 @@ class TDTestCase:
|
|||
self.test_stmt_insert_error(self.conn())
|
||||
except Exception as error :
|
||||
|
||||
if str(error)=='[0x0200]: no mix usage for ? and values':
|
||||
if str(error)=='[0x0200]: stmt bind param does not support normal value in sql':
|
||||
tdLog.info('=========stmt error occured for bind part column ==============')
|
||||
else:
|
||||
tdLog.exit("expect error(%s) not occured" % str(error))
|
||||
|
||||
try:
|
||||
self.test_stmt_nornmal_value_error(self.conn())
|
||||
except Exception as error :
|
||||
|
||||
if str(error)=='[0x0200]: stmt bind param does not support normal value in sql':
|
||||
tdLog.info('=========stmt error occured for bind part column ==============')
|
||||
else:
|
||||
tdLog.exit("expect error(%s) not occured" % str(error))
|
||||
|
|
Loading…
Reference in New Issue