[TD-2971] feature: make python connector support unsigned type.
This commit is contained in:
parent
d27fb22759
commit
8904a04603
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.5",
|
version="2.0.6",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,6 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0.3'
|
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
@ -21,4 +20,4 @@ def connect(*args, **kwargs):
|
||||||
|
|
||||||
@rtype: TDengineConnector
|
@rtype: TDengineConnector
|
||||||
"""
|
"""
|
||||||
return TDengineConnection(*args, **kwargs)
|
return TDengineConnection(*args, **kwargs)
|
||||||
|
|
|
@ -37,7 +37,15 @@ def _crow_tinyint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_tinyint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C tinyint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C smallint row to python row
|
"""Function to convert C smallint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -46,6 +54,14 @@ def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_smallint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C smallint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)]]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C int row to python row
|
"""Function to convert C int row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -54,6 +70,14 @@ def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_int_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C int row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C bigint row to python row
|
"""Function to convert C bigint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -62,6 +86,14 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_bigint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C bigint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C float row to python row
|
"""Function to convert C float row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -156,8 +188,12 @@ _CONVERT_FUNC = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python,
|
FieldType.C_BINARY: _crow_binary_to_python,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python
|
FieldType.C_NCHAR : _crow_nchar_to_python,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
_CONVERT_FUNC_BLOCK = {
|
_CONVERT_FUNC_BLOCK = {
|
||||||
|
@ -169,8 +205,12 @@ _CONVERT_FUNC_BLOCK = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python_block,
|
FieldType.C_BINARY: _crow_binary_to_python_block,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python_block
|
FieldType.C_NCHAR : _crow_nchar_to_python_block,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
# Corresponding TAOS_FIELD structure in C
|
# Corresponding TAOS_FIELD structure in C
|
||||||
|
@ -298,7 +338,7 @@ class CTaosInterface(object):
|
||||||
raise AttributeError("sql is expected as a string")
|
raise AttributeError("sql is expected as a string")
|
||||||
# finally:
|
# finally:
|
||||||
# CTaosInterface.libtaos.close(connection)
|
# CTaosInterface.libtaos.close(connection)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def affectedRows(result):
|
def affectedRows(result):
|
||||||
"""The affected rows after runing query
|
"""The affected rows after runing query
|
||||||
|
@ -392,6 +432,7 @@ class CTaosInterface(object):
|
||||||
else:
|
else:
|
||||||
return None, 0
|
return None, 0
|
||||||
return blocks, abs(num_of_rows)
|
return blocks, abs(num_of_rows)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def freeResult(result):
|
def freeResult(result):
|
||||||
CTaosInterface.libtaos.taos_free_result(result)
|
CTaosInterface.libtaos.taos_free_result(result)
|
||||||
|
|
|
@ -18,13 +18,21 @@ class FieldType(object):
|
||||||
C_BINARY = 8
|
C_BINARY = 8
|
||||||
C_TIMESTAMP = 9
|
C_TIMESTAMP = 9
|
||||||
C_NCHAR = 10
|
C_NCHAR = 10
|
||||||
|
C_TINYINT_UNSIGNED = 12
|
||||||
|
C_SMALLINT_UNSIGNED = 13
|
||||||
|
C_INT_UNSIGNED = 14
|
||||||
|
C_BIGINT_UNSIGNED = 15
|
||||||
# NULL value definition
|
# NULL value definition
|
||||||
# NOTE: These values should change according to C definition in tsdb.h
|
# NOTE: These values should change according to C definition in tsdb.h
|
||||||
C_BOOL_NULL = 0x02
|
C_BOOL_NULL = 0x02
|
||||||
C_TINYINT_NULL = -128
|
C_TINYINT_NULL = -128
|
||||||
|
C_TINYINT_UNSIGNED_NULL = 255
|
||||||
C_SMALLINT_NULL = -32768
|
C_SMALLINT_NULL = -32768
|
||||||
|
C_SMALLINT_UNSIGNED_NULL = 65535
|
||||||
C_INT_NULL = -2147483648
|
C_INT_NULL = -2147483648
|
||||||
|
C_INT_UNSIGNED_NULL = 4294967295
|
||||||
C_BIGINT_NULL = -9223372036854775808
|
C_BIGINT_NULL = -9223372036854775808
|
||||||
|
C_BIGINT_UNSIGNED_NULL = 18446744073709551615
|
||||||
C_FLOAT_NULL = float('nan')
|
C_FLOAT_NULL = float('nan')
|
||||||
C_DOUBLE_NULL = float('nan')
|
C_DOUBLE_NULL = float('nan')
|
||||||
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
||||||
|
|
|
@ -158,11 +158,26 @@ class TDengineCursor(object):
|
||||||
if (dataType.upper() == "TINYINT"):
|
if (dataType.upper() == "TINYINT"):
|
||||||
if (self._description[col][1] == FieldType.C_TINYINT):
|
if (self._description[col][1] == FieldType.C_TINYINT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "TINYINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_TINYINT_UNSIGNED):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "INT"):
|
if (dataType.upper() == "INT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_INT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "INT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_INT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "BIGINT"):
|
if (dataType.upper() == "BIGINT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_BIGINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "BIGINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_BIGINT_UNSIGNED):
|
||||||
return True
|
return True
|
||||||
if (dataType.upper() == "FLOAT"):
|
if (dataType.upper() == "FLOAT"):
|
||||||
if (self._description[col][1] == FieldType.C_FLOAT):
|
if (self._description[col][1] == FieldType.C_FLOAT):
|
||||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.4",
|
version="2.0.5",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,6 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0.3'
|
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,15 @@ def _crow_tinyint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_tinyint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C tinyint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C smallint row to python row
|
"""Function to convert C smallint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -46,6 +54,14 @@ def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_smallint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C smallint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)]]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C int row to python row
|
"""Function to convert C int row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -54,6 +70,14 @@ def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_int_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C int row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C bigint row to python row
|
"""Function to convert C bigint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -62,6 +86,14 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_bigint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C bigint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C float row to python row
|
"""Function to convert C float row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -156,8 +188,12 @@ _CONVERT_FUNC = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python,
|
FieldType.C_BINARY: _crow_binary_to_python,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python
|
FieldType.C_NCHAR : _crow_nchar_to_python,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
_CONVERT_FUNC_BLOCK = {
|
_CONVERT_FUNC_BLOCK = {
|
||||||
|
@ -169,8 +205,12 @@ _CONVERT_FUNC_BLOCK = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python_block,
|
FieldType.C_BINARY: _crow_binary_to_python_block,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python_block
|
FieldType.C_NCHAR : _crow_nchar_to_python_block,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
# Corresponding TAOS_FIELD structure in C
|
# Corresponding TAOS_FIELD structure in C
|
||||||
|
|
|
@ -18,13 +18,21 @@ class FieldType(object):
|
||||||
C_BINARY = 8
|
C_BINARY = 8
|
||||||
C_TIMESTAMP = 9
|
C_TIMESTAMP = 9
|
||||||
C_NCHAR = 10
|
C_NCHAR = 10
|
||||||
|
C_TINYINT_UNSIGNED = 12
|
||||||
|
C_SMALLINT_UNSIGNED = 13
|
||||||
|
C_INT_UNSIGNED = 14
|
||||||
|
C_BIGINT_UNSIGNED = 15
|
||||||
# NULL value definition
|
# NULL value definition
|
||||||
# NOTE: These values should change according to C definition in tsdb.h
|
# NOTE: These values should change according to C definition in tsdb.h
|
||||||
C_BOOL_NULL = 0x02
|
C_BOOL_NULL = 0x02
|
||||||
C_TINYINT_NULL = -128
|
C_TINYINT_NULL = -128
|
||||||
|
C_TINYINT_UNSIGNED_NULL = 255
|
||||||
C_SMALLINT_NULL = -32768
|
C_SMALLINT_NULL = -32768
|
||||||
|
C_SMALLINT_UNSIGNED_NULL = 65535
|
||||||
C_INT_NULL = -2147483648
|
C_INT_NULL = -2147483648
|
||||||
|
C_INT_UNSIGNED_NULL = 4294967295
|
||||||
C_BIGINT_NULL = -9223372036854775808
|
C_BIGINT_NULL = -9223372036854775808
|
||||||
|
C_BIGINT_UNSIGNED_NULL = 18446744073709551615
|
||||||
C_FLOAT_NULL = float('nan')
|
C_FLOAT_NULL = float('nan')
|
||||||
C_DOUBLE_NULL = float('nan')
|
C_DOUBLE_NULL = float('nan')
|
||||||
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
||||||
|
|
|
@ -168,11 +168,26 @@ class TDengineCursor(object):
|
||||||
if (dataType.upper() == "TINYINT"):
|
if (dataType.upper() == "TINYINT"):
|
||||||
if (self._description[col][1] == FieldType.C_TINYINT):
|
if (self._description[col][1] == FieldType.C_TINYINT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "TINYINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_TINYINT_UNSIGNED):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "INT"):
|
if (dataType.upper() == "INT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_INT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "INT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_INT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "BIGINT"):
|
if (dataType.upper() == "BIGINT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_BIGINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "BIGINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_BIGINT_UNSIGNED):
|
||||||
return True
|
return True
|
||||||
if (dataType.upper() == "FLOAT"):
|
if (dataType.upper() == "FLOAT"):
|
||||||
if (self._description[col][1] == FieldType.C_FLOAT):
|
if (self._description[col][1] == FieldType.C_FLOAT):
|
||||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.4",
|
version="2.0.5",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,6 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0.4'
|
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,15 @@ def _crow_tinyint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_TINYINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_tinyint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C tinyint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_TINYINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_byte))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C smallint row to python row
|
"""Function to convert C smallint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -46,6 +54,14 @@ def _crow_smallint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_SMALLINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_smallint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C smallint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)]]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_SMALLINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_short))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C int row to python row
|
"""Function to convert C int row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -54,6 +70,14 @@ def _crow_int_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_INT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_int_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C int row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_INT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C bigint row to python row
|
"""Function to convert C bigint row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -62,6 +86,14 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
else:
|
else:
|
||||||
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
return [ None if ele == FieldType.C_BIGINT_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
|
def _crow_bigint_unsigned_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
|
"""Function to convert C bigint row to python row
|
||||||
|
"""
|
||||||
|
if num_of_rows > 0:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
else:
|
||||||
|
return [ None if ele == FieldType.C_BIGINT_UNSIGNED_NULL else ele for ele in ctypes.cast(data, ctypes.POINTER(ctypes.c_long))[:abs(num_of_rows)] ]
|
||||||
|
|
||||||
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_float_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C float row to python row
|
"""Function to convert C float row to python row
|
||||||
"""
|
"""
|
||||||
|
@ -156,8 +188,12 @@ _CONVERT_FUNC = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python,
|
FieldType.C_BINARY: _crow_binary_to_python,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python
|
FieldType.C_NCHAR : _crow_nchar_to_python,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
_CONVERT_FUNC_BLOCK = {
|
_CONVERT_FUNC_BLOCK = {
|
||||||
|
@ -169,8 +205,12 @@ _CONVERT_FUNC_BLOCK = {
|
||||||
FieldType.C_FLOAT : _crow_float_to_python,
|
FieldType.C_FLOAT : _crow_float_to_python,
|
||||||
FieldType.C_DOUBLE : _crow_double_to_python,
|
FieldType.C_DOUBLE : _crow_double_to_python,
|
||||||
FieldType.C_BINARY: _crow_binary_to_python_block,
|
FieldType.C_BINARY: _crow_binary_to_python_block,
|
||||||
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
FieldType.C_TIMESTAMP : _crow_timestamp_to_python,
|
||||||
FieldType.C_NCHAR : _crow_nchar_to_python_block
|
FieldType.C_NCHAR : _crow_nchar_to_python_block,
|
||||||
|
FieldType.C_TINYINT_UNSIGNED : _crow_tinyint_unsigned_to_python,
|
||||||
|
FieldType.C_SMALLINT_UNSIGNED : _crow_smallint_unsigned_to_python,
|
||||||
|
FieldType.C_INT_UNSIGNED : _crow_int_unsigned_to_python,
|
||||||
|
FieldType.C_BIGINT_UNSIGNED : _crow_bigint_unsigned_to_python
|
||||||
}
|
}
|
||||||
|
|
||||||
# Corresponding TAOS_FIELD structure in C
|
# Corresponding TAOS_FIELD structure in C
|
||||||
|
|
|
@ -18,13 +18,21 @@ class FieldType(object):
|
||||||
C_BINARY = 8
|
C_BINARY = 8
|
||||||
C_TIMESTAMP = 9
|
C_TIMESTAMP = 9
|
||||||
C_NCHAR = 10
|
C_NCHAR = 10
|
||||||
|
C_TINYINT_UNSIGNED = 12
|
||||||
|
C_SMALLINT_UNSIGNED = 13
|
||||||
|
C_INT_UNSIGNED = 14
|
||||||
|
C_BIGINT_UNSIGNED = 15
|
||||||
# NULL value definition
|
# NULL value definition
|
||||||
# NOTE: These values should change according to C definition in tsdb.h
|
# NOTE: These values should change according to C definition in tsdb.h
|
||||||
C_BOOL_NULL = 0x02
|
C_BOOL_NULL = 0x02
|
||||||
C_TINYINT_NULL = -128
|
C_TINYINT_NULL = -128
|
||||||
|
C_TINYINT_UNSIGNED_NULL = 255
|
||||||
C_SMALLINT_NULL = -32768
|
C_SMALLINT_NULL = -32768
|
||||||
|
C_SMALLINT_UNSIGNED_NULL = 65535
|
||||||
C_INT_NULL = -2147483648
|
C_INT_NULL = -2147483648
|
||||||
|
C_INT_UNSIGNED_NULL = 4294967295
|
||||||
C_BIGINT_NULL = -9223372036854775808
|
C_BIGINT_NULL = -9223372036854775808
|
||||||
|
C_BIGINT_UNSIGNED_NULL = 18446744073709551615
|
||||||
C_FLOAT_NULL = float('nan')
|
C_FLOAT_NULL = float('nan')
|
||||||
C_DOUBLE_NULL = float('nan')
|
C_DOUBLE_NULL = float('nan')
|
||||||
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
C_BINARY_NULL = bytearray([int('0xff', 16)])
|
||||||
|
|
|
@ -168,11 +168,26 @@ class TDengineCursor(object):
|
||||||
if (dataType.upper() == "TINYINT"):
|
if (dataType.upper() == "TINYINT"):
|
||||||
if (self._description[col][1] == FieldType.C_TINYINT):
|
if (self._description[col][1] == FieldType.C_TINYINT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "TINYINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_TINYINT_UNSIGNED):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "SMALLINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_SMALLINT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "INT"):
|
if (dataType.upper() == "INT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_INT):
|
||||||
return True
|
return True
|
||||||
|
if (dataType.upper() == "INT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_INT_UNSIGNED):
|
||||||
|
return True
|
||||||
if (dataType.upper() == "BIGINT"):
|
if (dataType.upper() == "BIGINT"):
|
||||||
if (self._description[col][1] == FieldType.C_INT):
|
if (self._description[col][1] == FieldType.C_BIGINT):
|
||||||
|
return True
|
||||||
|
if (dataType.upper() == "BIGINT UNSIGNED"):
|
||||||
|
if (self._description[col][1] == FieldType.C_BIGINT_UNSIGNED):
|
||||||
return True
|
return True
|
||||||
if (dataType.upper() == "FLOAT"):
|
if (dataType.upper() == "FLOAT"):
|
||||||
if (self._description[col][1] == FieldType.C_FLOAT):
|
if (self._description[col][1] == FieldType.C_FLOAT):
|
||||||
|
|
|
@ -3,7 +3,6 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0.3'
|
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
@ -21,4 +20,4 @@ def connect(*args, **kwargs):
|
||||||
|
|
||||||
@rtype: TDengineConnector
|
@rtype: TDengineConnector
|
||||||
"""
|
"""
|
||||||
return TDengineConnection(*args, **kwargs)
|
return TDengineConnection(*args, **kwargs)
|
||||||
|
|
|
@ -3,7 +3,6 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0.3'
|
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
@ -21,4 +20,4 @@ def connect(*args, **kwargs):
|
||||||
|
|
||||||
@rtype: TDengineConnector
|
@rtype: TDengineConnector
|
||||||
"""
|
"""
|
||||||
return TDengineConnection(*args, **kwargs)
|
return TDengineConnection(*args, **kwargs)
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
ret = tdSql.execute('create table tb (ts timestamp, speed int unsigned)')
|
||||||
|
|
||||||
|
insertRows = 10
|
||||||
|
tdLog.info("insert %d rows" % (insertRows))
|
||||||
|
for i in range(0, insertRows):
|
||||||
|
ret = tdSql.execute(
|
||||||
|
'insert into tb values (now + %dm, %d)' %
|
||||||
|
(i, i))
|
||||||
|
|
||||||
|
tdLog.info("insert earlier data")
|
||||||
|
tdSql.execute('insert into tb values (now - 5m , 10)')
|
||||||
|
tdSql.execute('insert into tb values (now - 6m , 10)')
|
||||||
|
tdSql.execute('insert into tb values (now - 7m , 10)')
|
||||||
|
tdSql.execute('insert into tb values (now - 8m , 4294967294)')
|
||||||
|
|
||||||
|
tdSql.error('insert into tb values (now - 9m, -1)')
|
||||||
|
tdSql.error('insert into tb values (now - 9m, 4294967295)')
|
||||||
|
|
||||||
|
tdSql.query("select * from tb")
|
||||||
|
tdSql.checkRows(insertRows + 4)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
Loading…
Reference in New Issue