test: tag/col insert syntax
This commit is contained in:
parent
b3db823767
commit
26fdab743b
|
@ -65,8 +65,7 @@ static int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint
|
|||
}
|
||||
|
||||
errno = 0;
|
||||
char *endPtr = NULL;
|
||||
bool parsed = false;
|
||||
char *endPtr = NULL;
|
||||
if (z[0] == '0' && n > 2) {
|
||||
if (z[1] == 'b' || z[1] == 'B') {
|
||||
// paring as binary
|
||||
|
@ -76,26 +75,29 @@ static int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint
|
|||
if (z[1] == 'x' || z[1] == 'X') {
|
||||
// parsing as hex
|
||||
*value = taosStr2UInt64(z, &endPtr, 16);
|
||||
parsed = true;
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parsed && parseFloat) {
|
||||
if (parseFloat) {
|
||||
// parsing as double
|
||||
double val = taosStr2Double(z, &endPtr);
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
if (val > UINT64_MAX) {
|
||||
errno == ERANGE;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
*value = round(val);
|
||||
}
|
||||
|
||||
if (errno == ERANGE || errno == EINVAL || endPtr - z != n) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value) {
|
||||
if (n == 0) {
|
||||
errno = EINVAL;
|
||||
|
@ -104,12 +106,11 @@ int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value) {
|
|||
|
||||
errno = 0;
|
||||
char *endPtr = NULL;
|
||||
*value = taosStr2Double(z, &endPtr);
|
||||
if (errno != ERANGE && errno != EINVAL && endPtr - z == n) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
*value = taosStr2Double(z, &endPtr); // 0x already converted here
|
||||
if (errno == ERANGE || errno == EINVAL) return TSDB_CODE_FAILED;
|
||||
if (endPtr - z == n) return TSDB_CODE_SUCCESS;
|
||||
|
||||
if (type == TK_NK_BIN || type == TK_NK_STRING) {
|
||||
if (type == TK_NK_BIN) {
|
||||
bool is_neg = false;
|
||||
uint64_t uv = 0;
|
||||
if (TSDB_CODE_SUCCESS == parseSignAndUInteger(z, n, &is_neg, &uv, false)) {
|
||||
|
|
|
@ -582,7 +582,7 @@ endi
|
|||
# case 04: illegal input
|
||||
sql_error create table st_bool_e0 using mt_bool tags (123abc)
|
||||
sql_error create table st_bool_e1 using mt_bool tags ("123abc")
|
||||
sql_error create table st_bool_e2 using mt_bool tags ("123")
|
||||
sql create table st_bool_e2 using mt_bool tags ("123")
|
||||
sql_error create table st_bool_e3 using mt_bool tags (abc)
|
||||
sql_error create table st_bool_e4 using mt_bool tags ("abc")
|
||||
sql_error create table st_bool_e5 using mt_bool tags (" ")
|
||||
|
@ -606,7 +606,7 @@ sql_error insert into st_bool_g6 values (now, '')
|
|||
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (123abc) values (now, 1)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags ("123abc") values (now, 1)
|
||||
sql_error insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
|
||||
sql insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (abc) values (now, 1)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags ("abc") values (now, 1)
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (" ") values (now, 1)
|
||||
|
@ -614,7 +614,7 @@ sql_error insert into st_bool_h6 using mt_bool tags ('') values (now, 1)
|
|||
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (1) values (now, 123abc)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags (1) values (now, "123abc")
|
||||
sql_error insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
|
||||
sql insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (1) values (now, abc)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags (1) values (now, "abc")
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (1) values (now, " ")
|
||||
|
@ -630,7 +630,7 @@ sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1)
|
|||
|
||||
sql_error alter table st_bool_i0 set tag tagname=123abc
|
||||
sql_error alter table st_bool_i1 set tag tagname="123abc"
|
||||
sql_error alter table st_bool_i2 set tag tagname="123"
|
||||
sql alter table st_bool_i2 set tag tagname="123"
|
||||
sql_error alter table st_bool_i3 set tag tagname=abc
|
||||
sql_error alter table st_bool_i4 set tag tagname="abc"
|
||||
sql_error alter table st_bool_i5 set tag tagname=" "
|
||||
|
|
|
@ -94,6 +94,103 @@ sql show tags from st_int_14
|
|||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_100 using mt_int tags ("0x01")
|
||||
sql show tags from st_int_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_101 using mt_int tags ("0b01")
|
||||
sql show tags from st_int_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_102 using mt_int tags ("+0x01")
|
||||
sql show tags from st_int_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_103 using mt_int tags ("-0b01")
|
||||
sql show tags from st_int_103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_104 using mt_int tags ("-123.1")
|
||||
sql show tags from st_int_104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_105 using mt_int tags ("+123.5")
|
||||
sql show tags from st_int_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_106 using mt_int tags ("-1e-1")
|
||||
sql show tags from st_int_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_107 using mt_int tags ("+0.1235e3")
|
||||
sql show tags from st_int_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_108 using mt_int tags ("-0.11e-30")
|
||||
sql show tags from st_int_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_109 using mt_int tags ("-1.1e-307")
|
||||
sql show tags from st_int_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_110 using mt_int tags ( -1e-1 )
|
||||
sql show tags from st_int_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_111 using mt_int tags ( +0.1235e3 )
|
||||
sql show tags from st_int_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_112 using mt_int tags (-0.11e-30)
|
||||
sql show tags from st_int_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_113 using mt_int tags (-1.1e-307)
|
||||
sql show tags from st_int_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_200 using mt_int tags ( 0x01)
|
||||
sql show tags from st_int_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_201 using mt_int tags (0b01 )
|
||||
sql show tags from st_int_201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_202 using mt_int tags (+0x01)
|
||||
sql show tags from st_int_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_int_203 using mt_int tags ( -0b01 )
|
||||
sql show tags from st_int_203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 01: insert values for test column values
|
||||
sql insert into st_int_0 values (now, NULL)
|
||||
|
@ -187,6 +284,122 @@ if $data01 != -56 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_100 values (now, "0x01")
|
||||
sql select * from st_int_100
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_101 values (now, "0b01")
|
||||
sql select * from st_int_101
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_102 values (now, "+0x01")
|
||||
sql select * from st_int_102
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_103 values (now, "-0b01")
|
||||
sql select * from st_int_103
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_104 values (now, "-123.1")
|
||||
sql select * from st_int_104
|
||||
if $data01 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_105 values (now, "+123.5")
|
||||
sql select * from st_int_105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_106 values (now, "-1e-1")
|
||||
sql select * from st_int_106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_107 values (now, "+0.1235e3")
|
||||
sql select * from st_int_107
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_108 values (now, "-0.11e-30")
|
||||
sql select * from st_int_108
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_109 values (now, "-1.1e-307")
|
||||
sql select * from st_int_109
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_110 values (now, -1e-1 )
|
||||
sql select * from st_int_110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_111 values (now, +0.1235e3 )
|
||||
sql select * from st_int_111
|
||||
if $data01 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_112 values (now, -0.11e-30)
|
||||
sql select * from st_int_112
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_113 values (now, -1.1e-307)
|
||||
sql select * from st_int_113
|
||||
if $data01 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_200 values (now, 0x01)
|
||||
sql select * from st_int_200
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_201 values (now, 0b01 )
|
||||
sql select * from st_int_201
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_202 values (now, +0x01)
|
||||
sql select * from st_int_202
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_203 values (now, -0b01 )
|
||||
sql select * from st_int_203
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL)
|
||||
sql show create table st_int_16
|
||||
|
@ -307,48 +520,303 @@ sql select * from st_int_28
|
|||
if $data01 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1100 using mt_int tags ("0x01") values(now, "0x01");
|
||||
sql show tags from st_int_1100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1100
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1101 using mt_int tags ("0b01") values(now, "0b01");
|
||||
sql show tags from st_int_1101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1101
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1102 using mt_int tags ("+0x01") values(now, "+0x01");
|
||||
sql show tags from st_int_1102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1102
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1103 using mt_int tags ("-0b01") values(now, "-0b01");
|
||||
sql show tags from st_int_1103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1103
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1104 using mt_int tags ("-123.1") values(now, "-123.1");
|
||||
sql show tags from st_int_1104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1104
|
||||
if $data01 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1105 using mt_int tags ("+123.5") values(now, "+123.5");
|
||||
sql show tags from st_int_1105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1105
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1106 using mt_int tags ("-1e-1") values(now, "-1e-1");
|
||||
sql show tags from st_int_1106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1106
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1107 using mt_int tags ("+0.1235e3") values(now, "+0.1235e3");
|
||||
sql show tags from st_int_1107
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1108 using mt_int tags ("-0.11e-30") values(now, "-0.11e-30");
|
||||
sql show tags from st_int_1108
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1108
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1109 using mt_int tags ("-1.1e-307") values(now, "-1.1e-307");
|
||||
sql show tags from st_int_1109
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1109
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1110 using mt_int tags ( -1e-1 ) values(now, -1e-1);
|
||||
sql show tags from st_int_1110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1110
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1111 using mt_int tags ( +0.1235e3 ) values(now, +0.1235e3);
|
||||
sql show tags from st_int_1111
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1111
|
||||
if $data01 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1112 using mt_int tags (-0.11e-30) values(now, -0.11e-30);
|
||||
sql show tags from st_int_1112
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1112
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1113 using mt_int tags (-1.1e-307) values(now, -1.1e-307);
|
||||
sql show tags from st_int_1113
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1113
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1200 using mt_int tags ( 0x01) values(now, 0x01);
|
||||
sql show tags from st_int_1200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1200
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1201 using mt_int tags (0b01 ) values(now, 0b01);
|
||||
sql show tags from st_int_1201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1201
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_1202 using mt_int tags (+0x01) values(now, +0x01);
|
||||
sql show tags from st_int_1202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1202
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_int_1203 using mt_int tags ( -0b01 ) values(now, -0b01);
|
||||
sql show tags from st_int_1203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_1203
|
||||
if $data01 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_int_0 set tag tagname=2147483647
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-2147483647
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+100
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-33
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='+98'
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='-076'
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+0012
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-00063
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
sql alter table st_int_0 set tag tagname=2147483647
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-2147483647
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=+100
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-33
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -33 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname='+98'
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 98 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname='-076'
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -76 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=+0012
|
||||
sql show tags from st_int_0
|
||||
if $data05 != 12 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_0 set tag tagname=-00063
|
||||
sql show tags from st_int_0
|
||||
if $data05 != -63 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_100 set tag tagname="0x01"
|
||||
sql show tags from st_int_100
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_101 set tag tagname="0b01"
|
||||
sql show tags from st_int_101
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_102 set tag tagname="+0x01"
|
||||
sql show tags from st_int_102
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_103 set tag tagname="-0b01"
|
||||
sql show tags from st_int_103
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_104 set tag tagname="-123.1"
|
||||
sql show tags from st_int_104
|
||||
if $data05 != -123 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_105 set tag tagname="+123.5"
|
||||
sql show tags from st_int_105
|
||||
if $data05 != 124 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_106 set tag tagname="-1e-1"
|
||||
sql show tags from st_int_106
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_107 set tag tagname="+0.1235e3"
|
||||
sql show tags from st_int_107
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_108 set tag tagname="-0.11e-30"
|
||||
sql show tags from st_int_108
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_109 set tag tagname="-1.1e-307"
|
||||
sql show tags from st_int_109
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_110 set tag tagname= -1e-1
|
||||
sql show tags from st_int_110
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_111 set tag tagname= +0.1235e3
|
||||
sql show tags from st_int_111
|
||||
if $data05 != 124 then
|
||||
print $data05 != 124
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_112 set tag tagname=-0.11e-30
|
||||
sql show tags from st_int_112
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_113 set tag tagname=-1.1e-307
|
||||
sql show tags from st_int_113
|
||||
if $data05 != 0 then
|
||||
print $data05 != 0
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_200 set tag tagname= 0x01
|
||||
sql show tags from st_int_200
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_201 set tag tagname=0b01
|
||||
sql show tags from st_int_201
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_202 set tag tagname=+0x01
|
||||
sql show tags from st_int_202
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_int_203 set tag tagname= -0b01
|
||||
sql show tags from st_int_203
|
||||
if $data05 != -1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_int_e0 using mt_int tags (2147483648)
|
||||
|
|
|
@ -139,7 +139,7 @@ if $data03 != 0 then
|
|||
endi
|
||||
|
||||
### bool:
|
||||
sql_error create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
|
||||
sql create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
|
||||
sql_error create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
|
||||
sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL')
|
||||
sql insert into st4 (ts, col1) values(now, 1)
|
||||
|
@ -182,7 +182,7 @@ endi
|
|||
|
||||
#### case 2: dynamic create table using super table when insert into
|
||||
sql create table mt3 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool)
|
||||
sql_error insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31')
|
||||
sql insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31')
|
||||
sql_error insert into st32 using mt3 tags (NULL, 'ABC', 103, 'FALSE') values (now+2s, 32, 32.12345, 'bin_32', 'abc', 'nchar_32')
|
||||
sql_error insert into st33 using mt3 tags ('NULL', '123aBc', 104, 'NULL') values (now+3s, 33, 33, 'bin_33', 'false123', 'nchar_33')
|
||||
sql_error insert into st34 using mt3 tags ('NULL', '123aBc', 105, NULL) values (now+4s, 34, 34.12345, 'bin_34', 'true123', 'nchar_34')
|
||||
|
@ -343,7 +343,7 @@ if $data03 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error alter table st41 set tag tag_bool = '123'
|
||||
sql alter table st41 set tag tag_bool = '123'
|
||||
sql_error alter table st41 set tag tag_bool = ''
|
||||
sql_error alter table st41 set tag tag_bool = abc379
|
||||
|
||||
|
|
|
@ -391,10 +391,11 @@ sql alter table $mt add tag tgcol6 bool
|
|||
sql reset query cache
|
||||
sql alter table $tb set tag tgcol4=4
|
||||
sql alter table $tb set tag tgcol5='5'
|
||||
sql_error alter table $tb set tag tgcol6='1'
|
||||
sql alter table $tb set tag tgcol6='1'
|
||||
sql reset query cache
|
||||
|
||||
sql select * from $mt where tgcol5 = '5'
|
||||
print $mt
|
||||
print select * from $mt where tgcol5 = 5
|
||||
print $data01 $data02 $data03 $data04
|
||||
if $rows != 1 then
|
||||
|
@ -409,7 +410,7 @@ endi
|
|||
if $data03 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != NULL then
|
||||
if $data04 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ class TDTestCase:
|
|||
if check_result == False and (nv[0:1] == '\'' or nv[0:1] == '\"'):
|
||||
if check_item == nv[1:-1].strip().lower():
|
||||
check_result = True
|
||||
if check_result == False and (nv.find('1') != -1 or nv.find('2') != -1):
|
||||
if check_result == False and (nv.find('1') != -1 or nv.find('2') != -1): # char 1 or 2 exist for non-zero values
|
||||
if check_item == "true":
|
||||
check_result = True
|
||||
else:
|
||||
|
@ -161,7 +161,7 @@ class TDTestCase:
|
|||
elif dtype == TDDataType.BOOL:
|
||||
self._query_check_bool(result, okv, nv, nRows, 4)
|
||||
elif dtype == TDDataType.VARBINARY:
|
||||
pass # TODO
|
||||
pass
|
||||
elif dtype == TDDataType.INT:
|
||||
self._query_check_int(result, okv, nv, nRows, 4)
|
||||
elif dtype == TDDataType.UINT:
|
||||
|
@ -169,7 +169,7 @@ class TDTestCase:
|
|||
elif dtype == TDDataType.FLOAT or dtype == TDDataType.DOUBLE:
|
||||
self._query_check_int(result, okv, nv, nRows, 4)
|
||||
elif dtype == TDDataType.GEOMETRY:
|
||||
pass # TODO
|
||||
pass
|
||||
else:
|
||||
tdLog.info(f"unknown data type %s" % (dtype))
|
||||
|
||||
|
@ -319,8 +319,6 @@ class TDTestCase:
|
|||
RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, RAW_INTEGER_P, RAW_INTEGER_M,
|
||||
RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M]
|
||||
|
||||
|
||||
|
||||
PARAM_LIST = [
|
||||
["db", "stb_vc", "ctb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR],
|
||||
["db", "stb_nc", "ctb_nc", OK_NC, KO_NC, "\'nc\'", TDDataType.NCHAR],
|
||||
|
|
Loading…
Reference in New Issue