Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65b415d8
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
65b415d8
编写于
10月 21, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TS-272
上级
0d4b9df6
754f5724
变更
31
展开全部
显示空白变更内容
内联
并排
Showing
31 changed file
with
1637 addition
and
446 deletion
+1637
-446
documentation20/cn/05.insert/docs.md
documentation20/cn/05.insert/docs.md
+1
-1
documentation20/cn/12.taos-sql/docs.md
documentation20/cn/12.taos-sql/docs.md
+1
-1
documentation20/cn/14.devops/02.collectd/docs.md
documentation20/cn/14.devops/02.collectd/docs.md
+1
-1
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+2
-0
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+66
-14
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+23
-3
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+26
-9
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractStatement.java
...bc/src/main/java/com/taosdata/jdbc/AbstractStatement.java
+2
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+7
-7
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
+5
-5
src/inc/taos.h
src/inc/taos.h
+1
-0
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+935
-296
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+7
-1
src/plugins/blm3
src/plugins/blm3
+1
-1
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+5
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-1
src/tsdb/src/tsdbCompact.c
src/tsdb/src/tsdbCompact.c
+1
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
tests/examples/c/prepare.c
tests/examples/c/prepare.c
+11
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/insert/insertTelnetLines.py
tests/pytest/insert/insertTelnetLines.py
+2
-3
tests/pytest/insert/line_insert.py
tests/pytest/insert/line_insert.py
+2
-2
tests/pytest/table/create.py
tests/pytest/table/create.py
+4
-14
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
.../pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
+185
-0
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
...st/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
+63
-0
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
...t/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
+63
-0
tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNumLarge4096-stmt.json
...emoAllTest/stmt/insertColumnsAndTagNumLarge4096-stmt.json
+0
-0
tests/pytest/tools/taosdumpTest3.py
tests/pytest/tools/taosdumpTest3.py
+184
-83
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+5
-1
tests/script/api/stmt.c
tests/script/api/stmt.c
+22
-1
tests/script/api/stmtTest.c
tests/script/api/stmtTest.c
+8
-0
未找到文件。
documentation20/cn/05.insert/docs.md
浏览文件 @
65b415d8
...
@@ -243,7 +243,7 @@ repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for S
...
@@ -243,7 +243,7 @@ repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for S
{
{
port: 8125
port: 8125
, backends: ["./backends/repeater"]
, backends: ["./backends/repeater"]
, repeater: [{ host: '127.0.0.1', port:
8126
}]
, repeater: [{ host: '127.0.0.1', port:
6044
}]
}
}
```
```
...
...
documentation20/cn/12.taos-sql/docs.md
浏览文件 @
65b415d8
...
@@ -1601,7 +1601,7 @@ SELECT AVG(current), MAX(current), LEASTSQUARES(current, start_val, step_val), P
...
@@ -1601,7 +1601,7 @@ SELECT AVG(current), MAX(current), LEASTSQUARES(current, start_val, step_val), P
**GROUP BY的限制**
**GROUP BY的限制**
TAOS SQL 支持对标签、TBNAME 进行 GROUP BY 操作,也支持普通列进行 GROUP BY,前提是:仅限一列且该列的唯一值小于 10 万个。
TAOS SQL 支持对标签、TBNAME 进行 GROUP BY 操作,也支持普通列进行 GROUP BY,前提是:仅限一列且该列的唯一值小于 10 万个。
注意:group by 不支持float,double 类型。
**IS NOT NULL 与不为空的表达式适用范围**
**IS NOT NULL 与不为空的表达式适用范围**
...
...
documentation20/cn/14.devops/02.collectd/docs.md
浏览文件 @
65b415d8
...
@@ -57,7 +57,7 @@ repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for S
...
@@ -57,7 +57,7 @@ repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for S
### 导入 Dashboard
### 导入 Dashboard
使用 Web 浏览器访问
IP
:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
使用 Web 浏览器访问
运行 Grafana 的服务器的3000端口 host
:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
#### 导入 collectd 仪表盘
#### 导入 collectd 仪表盘
...
...
src/client/inc/tscParseLine.h
浏览文件 @
65b415d8
...
@@ -67,6 +67,8 @@ typedef struct {
...
@@ -67,6 +67,8 @@ typedef struct {
SMLProtocolType
protocol
;
SMLProtocolType
protocol
;
SMLTimeStampType
tsType
;
SMLTimeStampType
tsType
;
SHashObj
*
smlDataToSchema
;
SHashObj
*
smlDataToSchema
;
int64_t
affectedRows
;
}
SSmlLinesInfo
;
}
SSmlLinesInfo
;
int
tscSmlInsert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
,
SSmlLinesInfo
*
info
);
int
tscSmlInsert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
,
SSmlLinesInfo
*
info
);
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
65b415d8
...
@@ -761,7 +761,7 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
...
@@ -761,7 +761,7 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_prepare return %d:%s"
,
info
->
id
,
code
,
t
strerror
(
code
));
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_prepare return %d:%s"
,
info
->
id
,
code
,
t
aos_stmt_errstr
(
stmt
));
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
return
code
;
return
code
;
}
}
...
@@ -771,7 +771,11 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
...
@@ -771,7 +771,11 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
do
{
do
{
code
=
taos_stmt_set_tbname
(
stmt
,
cTableName
);
code
=
taos_stmt_set_tbname
(
stmt
,
cTableName
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_set_tbname return %d:%s"
,
info
->
id
,
code
,
tstrerror
(
code
));
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_set_tbname return %d:%s"
,
info
->
id
,
code
,
taos_stmt_errstr
(
stmt
));
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
info
->
affectedRows
+=
affectedRows
;
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
return
code
;
return
code
;
}
}
...
@@ -781,13 +785,21 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
...
@@ -781,13 +785,21 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
TAOS_BIND
*
colsBinds
=
taosArrayGetP
(
batchBind
,
i
);
TAOS_BIND
*
colsBinds
=
taosArrayGetP
(
batchBind
,
i
);
code
=
taos_stmt_bind_param
(
stmt
,
colsBinds
);
code
=
taos_stmt_bind_param
(
stmt
,
colsBinds
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_bind_param return %d:%s"
,
info
->
id
,
code
,
tstrerror
(
code
));
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_bind_param return %d:%s"
,
info
->
id
,
code
,
taos_stmt_errstr
(
stmt
));
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
info
->
affectedRows
+=
affectedRows
;
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
return
code
;
return
code
;
}
}
code
=
taos_stmt_add_batch
(
stmt
);
code
=
taos_stmt_add_batch
(
stmt
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_add_batch return %d:%s"
,
info
->
id
,
code
,
tstrerror
(
code
));
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_add_batch return %d:%s"
,
info
->
id
,
code
,
taos_stmt_errstr
(
stmt
));
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
info
->
affectedRows
+=
affectedRows
;
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
return
code
;
return
code
;
}
}
...
@@ -795,8 +807,9 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
...
@@ -795,8 +807,9 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
code
=
taos_stmt_execute
(
stmt
);
code
=
taos_stmt_execute
(
stmt
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_execute return %d:%s, try:%d"
,
info
->
id
,
code
,
t
strerror
(
code
),
try
);
tscError
(
"SML:0x%"
PRIx64
" taos_stmt_execute return %d:%s, try:%d"
,
info
->
id
,
code
,
t
aos_stmt_errstr
(
stmt
),
try
);
}
}
tscDebug
(
"SML:0x%"
PRIx64
" taos_stmt_execute inserted %d rows"
,
info
->
id
,
taos_stmt_affected_rows
(
stmt
));
tryAgain
=
false
;
tryAgain
=
false
;
if
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
if
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
...
@@ -825,6 +838,8 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
...
@@ -825,6 +838,8 @@ static int32_t doInsertChildTableWithStmt(TAOS* taos, char* sql, char* cTableNam
}
}
}
while
(
tryAgain
);
}
while
(
tryAgain
);
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
info
->
affectedRows
+=
affectedRows
;
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
return
code
;
return
code
;
...
@@ -1069,6 +1084,8 @@ int tscSmlInsert(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint, SSmlLine
...
@@ -1069,6 +1084,8 @@ int tscSmlInsert(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint, SSmlLine
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
info
->
affectedRows
=
0
;
tscDebug
(
"SML:0x%"
PRIx64
" build data point schemas"
,
info
->
id
);
tscDebug
(
"SML:0x%"
PRIx64
" build data point schemas"
,
info
->
id
);
SArray
*
stableSchemas
=
taosArrayInit
(
32
,
sizeof
(
SSmlSTableSchema
));
// SArray<STableColumnsSchema>
SArray
*
stableSchemas
=
taosArrayInit
(
32
,
sizeof
(
SSmlSTableSchema
));
// SArray<STableColumnsSchema>
code
=
buildDataPointSchemas
(
points
,
numPoint
,
stableSchemas
,
info
);
code
=
buildDataPointSchemas
(
points
,
numPoint
,
stableSchemas
,
info
);
...
@@ -1871,7 +1888,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
...
@@ -1871,7 +1888,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
//key field cannot start with digit
//key field cannot start with digit
if
(
isdigit
(
*
cur
))
{
if
(
isdigit
(
*
cur
))
{
tscError
(
"SML:0x%"
PRIx64
" Tag key cann
n
ot start with digit"
,
info
->
id
);
tscError
(
"SML:0x%"
PRIx64
" Tag key cannot start with digit"
,
info
->
id
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
}
while
(
*
cur
!=
'\0'
)
{
while
(
*
cur
!=
'\0'
)
{
...
@@ -1885,6 +1902,8 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
...
@@ -1885,6 +1902,8 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
}
}
//Escape special character
//Escape special character
if
(
*
cur
==
'\\'
)
{
if
(
*
cur
==
'\\'
)
{
//TODO: escape will work after column & tag
//support spcial characters
escapeSpecialCharacter
(
2
,
&
cur
);
escapeSpecialCharacter
(
2
,
&
cur
);
}
}
key
[
len
]
=
*
cur
;
key
[
len
]
=
*
cur
;
...
@@ -1911,13 +1930,42 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
...
@@ -1911,13 +1930,42 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
static
int32_t
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
static
int32_t
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
bool
*
is_last_kv
,
SSmlLinesInfo
*
info
,
bool
isTag
)
{
bool
*
is_last_kv
,
SSmlLinesInfo
*
info
,
bool
isTag
)
{
const
char
*
start
,
*
cur
;
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
char
*
value
=
NULL
;
char
*
value
=
NULL
;
uint16_t
len
=
0
;
uint16_t
len
=
0
;
bool
searchQuote
=
false
;
start
=
cur
=
*
index
;
start
=
cur
=
*
index
;
//if field value is string
if
(
!
isTag
)
{
if
(
*
cur
==
'"'
)
{
searchQuote
=
true
;
cur
+=
1
;
len
+=
1
;
}
else
if
(
*
cur
==
'L'
&&
*
(
cur
+
1
)
==
'"'
)
{
searchQuote
=
true
;
cur
+=
2
;
len
+=
2
;
}
}
while
(
1
)
{
while
(
1
)
{
// unescaped ',' or ' ' or '\0' identifies a value
// unescaped ',' or ' ' or '\0' identifies a value
if
((
*
cur
==
','
||
*
cur
==
' '
||
*
cur
==
'\0'
)
&&
*
(
cur
-
1
)
!=
'\\'
)
{
if
(((
*
cur
==
','
||
*
cur
==
' '
)
&&
*
(
cur
-
1
)
!=
'\\'
)
||
*
cur
==
'\0'
)
{
if
(
searchQuote
==
true
)
{
//first quote ignored while searching
if
(
*
(
cur
-
1
)
==
'"'
&&
len
!=
1
&&
len
!=
2
)
{
*
is_last_kv
=
(
*
cur
==
' '
||
*
cur
==
'\0'
)
?
true
:
false
;
break
;
}
else
if
(
*
cur
==
'\0'
)
{
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
}
else
{
cur
++
;
len
++
;
continue
;
}
}
//unescaped ' ' or '\0' indicates end of value
//unescaped ' ' or '\0' indicates end of value
*
is_last_kv
=
(
*
cur
==
' '
||
*
cur
==
'\0'
)
?
true
:
false
;
*
is_last_kv
=
(
*
cur
==
' '
||
*
cur
==
'\0'
)
?
true
:
false
;
if
(
*
cur
==
' '
&&
*
(
cur
+
1
)
==
' '
)
{
if
(
*
cur
==
' '
&&
*
(
cur
+
1
)
==
' '
)
{
...
@@ -1929,7 +1977,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -1929,7 +1977,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
}
}
//Escape special character
//Escape special character
if
(
*
cur
==
'\\'
)
{
if
(
*
cur
==
'\\'
)
{
escapeSpecialCharacter
(
2
,
&
cur
);
escapeSpecialCharacter
(
isTag
?
2
:
3
,
&
cur
);
}
}
cur
++
;
cur
++
;
len
++
;
len
++
;
...
@@ -1946,16 +1994,20 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -1946,16 +1994,20 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
if
(
!
convertSmlValueType
(
pKV
,
value
,
len
,
info
,
isTag
))
{
if
(
!
convertSmlValueType
(
pKV
,
value
,
len
,
info
,
isTag
))
{
tscError
(
"SML:0x%"
PRIx64
" Failed to convert sml value string(%s) to any type"
,
tscError
(
"SML:0x%"
PRIx64
" Failed to convert sml value string(%s) to any type"
,
info
->
id
,
value
);
info
->
id
,
value
);
//free previous alocated key field
free
(
pKV
->
key
);
pKV
->
key
=
NULL
;
free
(
value
);
free
(
value
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
ret
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
error
;
}
}
free
(
value
);
free
(
value
);
*
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
*
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
return
ret
;
error:
//free previous alocated key field
free
(
pKV
->
key
);
pKV
->
key
=
NULL
;
return
ret
;
}
}
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
65b415d8
...
@@ -138,14 +138,35 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
...
@@ -138,14 +138,35 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
const
char
*
start
,
*
cur
;
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int
len
=
0
;
int
len
=
0
;
bool
searchQuote
=
false
;
char
key
[]
=
OTD_METRIC_VALUE_COLUMN_NAME
;
char
key
[]
=
OTD_METRIC_VALUE_COLUMN_NAME
;
char
*
value
=
NULL
;
char
*
value
=
NULL
;
start
=
cur
=
*
index
;
start
=
cur
=
*
index
;
//if metric value is string
if
(
*
cur
==
'"'
)
{
searchQuote
=
true
;
cur
+=
1
;
len
+=
1
;
}
else
if
(
*
cur
==
'L'
&&
*
(
cur
+
1
)
==
'"'
)
{
searchQuote
=
true
;
cur
+=
2
;
len
+=
2
;
}
while
(
*
cur
!=
'\0'
)
{
while
(
*
cur
!=
'\0'
)
{
if
(
*
cur
==
' '
)
{
if
(
*
cur
==
' '
)
{
if
(
*
cur
==
' '
)
{
if
(
searchQuote
==
true
)
{
if
(
*
(
cur
-
1
)
==
'"'
&&
len
!=
1
&&
len
!=
2
)
{
searchQuote
=
false
;
}
else
{
cur
++
;
len
++
;
continue
;
}
}
if
(
*
(
cur
+
1
)
!=
' '
)
{
if
(
*
(
cur
+
1
)
!=
' '
)
{
break
;
break
;
}
else
{
}
else
{
...
@@ -153,7 +174,6 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
...
@@ -153,7 +174,6 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
continue
;
continue
;
}
}
}
}
}
cur
++
;
cur
++
;
len
++
;
len
++
;
}
}
...
...
src/client/src/tscPrepare.c
浏览文件 @
65b415d8
...
@@ -78,6 +78,8 @@ typedef struct STscStmt {
...
@@ -78,6 +78,8 @@ typedef struct STscStmt {
SSqlObj
*
pSql
;
SSqlObj
*
pSql
;
SMultiTbStmt
mtb
;
SMultiTbStmt
mtb
;
SNormalStmt
normal
;
SNormalStmt
normal
;
int
numOfRows
;
}
STscStmt
;
}
STscStmt
;
#define STMT_RET(c) do { \
#define STMT_RET(c) do { \
...
@@ -1212,6 +1214,8 @@ static int insertStmtExecute(STscStmt* stmt) {
...
@@ -1212,6 +1214,8 @@ static int insertStmtExecute(STscStmt* stmt) {
// wait for the callback function to post the semaphore
// wait for the callback function to post the semaphore
tsem_wait
(
&
pSql
->
rspSem
);
tsem_wait
(
&
pSql
->
rspSem
);
stmt
->
numOfRows
+=
pSql
->
res
.
numOfRows
;
// data block reset
// data block reset
pCmd
->
batchSize
=
0
;
pCmd
->
batchSize
=
0
;
for
(
int32_t
i
=
0
;
i
<
pCmd
->
insertParam
.
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCmd
->
insertParam
.
numOfTables
;
++
i
)
{
...
@@ -1285,6 +1289,8 @@ static int insertBatchStmtExecute(STscStmt* pStmt) {
...
@@ -1285,6 +1289,8 @@ static int insertBatchStmtExecute(STscStmt* pStmt) {
code
=
pStmt
->
pSql
->
res
.
code
;
code
=
pStmt
->
pSql
->
res
.
code
;
pStmt
->
numOfRows
+=
pStmt
->
pSql
->
res
.
numOfRows
;
insertBatchClean
(
pStmt
);
insertBatchClean
(
pStmt
);
return
code
;
return
code
;
...
@@ -1521,6 +1527,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
...
@@ -1521,6 +1527,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
pSql
->
maxRetry
=
TSDB_MAX_REPLICA
;
pSql
->
maxRetry
=
TSDB_MAX_REPLICA
;
pStmt
->
pSql
=
pSql
;
pStmt
->
pSql
=
pSql
;
pStmt
->
last
=
STMT_INIT
;
pStmt
->
last
=
STMT_INIT
;
pStmt
->
numOfRows
=
0
;
registerSqlObj
(
pSql
);
registerSqlObj
(
pSql
);
return
pStmt
;
return
pStmt
;
...
@@ -1564,9 +1571,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
...
@@ -1564,9 +1571,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
}
}
pRes
->
qId
=
0
;
pRes
->
qId
=
0
;
pRes
->
numOfRows
=
1
;
pRes
->
numOfRows
=
0
;
registerSqlObj
(
pSql
);
strtolower
(
pSql
->
sqlstr
,
sql
);
strtolower
(
pSql
->
sqlstr
,
sql
);
tscDebugL
(
"0x%"
PRIx64
" SQL: %s"
,
pSql
->
self
,
pSql
->
sqlstr
);
tscDebugL
(
"0x%"
PRIx64
" SQL: %s"
,
pSql
->
self
,
pSql
->
sqlstr
);
...
@@ -1981,6 +1986,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
...
@@ -1981,6 +1986,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
}
else
{
}
else
{
taosReleaseRef
(
tscObjRef
,
pStmt
->
pSql
->
self
);
taosReleaseRef
(
tscObjRef
,
pStmt
->
pSql
->
self
);
pStmt
->
pSql
=
taos_query
((
TAOS
*
)
pStmt
->
taos
,
sql
);
pStmt
->
pSql
=
taos_query
((
TAOS
*
)
pStmt
->
taos
,
sql
);
pStmt
->
numOfRows
+=
taos_affected_rows
(
pStmt
->
pSql
);
ret
=
taos_errno
(
pStmt
->
pSql
);
ret
=
taos_errno
(
pStmt
->
pSql
);
free
(
sql
);
free
(
sql
);
}
}
...
@@ -1989,6 +1995,17 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
...
@@ -1989,6 +1995,17 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
STMT_RET
(
ret
);
STMT_RET
(
ret
);
}
}
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
pStmt
==
NULL
)
{
tscError
(
"statement is invalid"
);
return
0
;
}
return
pStmt
->
numOfRows
;
}
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"statement is invalid."
);
tscError
(
"statement is invalid."
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractStatement.java
浏览文件 @
65b415d8
...
@@ -9,6 +9,7 @@ public abstract class AbstractStatement extends WrapperImpl implements Statement
...
@@ -9,6 +9,7 @@ public abstract class AbstractStatement extends WrapperImpl implements Statement
protected
List
<
String
>
batchedArgs
;
protected
List
<
String
>
batchedArgs
;
private
int
fetchSize
;
private
int
fetchSize
;
protected
int
affectedRows
=
-
1
;
@Override
@Override
public
abstract
ResultSet
executeQuery
(
String
sql
)
throws
SQLException
;
public
abstract
ResultSet
executeQuery
(
String
sql
)
throws
SQLException
;
...
@@ -247,6 +248,7 @@ public abstract class AbstractStatement extends WrapperImpl implements Statement
...
@@ -247,6 +248,7 @@ public abstract class AbstractStatement extends WrapperImpl implements Statement
public
boolean
getMoreResults
(
int
current
)
throws
SQLException
{
public
boolean
getMoreResults
(
int
current
)
throws
SQLException
{
if
(
isClosed
())
if
(
isClosed
())
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
this
.
affectedRows
=
-
1
;
switch
(
current
)
{
switch
(
current
)
{
case
Statement
.
CLOSE_CURRENT_RESULT
:
case
Statement
.
CLOSE_CURRENT_RESULT
:
return
false
;
return
false
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
65b415d8
...
@@ -23,7 +23,6 @@ public class TSDBStatement extends AbstractStatement {
...
@@ -23,7 +23,6 @@ public class TSDBStatement extends AbstractStatement {
* Status of current statement
* Status of current statement
*/
*/
private
boolean
isClosed
;
private
boolean
isClosed
;
private
int
affectedRows
=
-
1
;
private
TSDBConnection
connection
;
private
TSDBConnection
connection
;
private
TSDBResultSet
resultSet
;
private
TSDBResultSet
resultSet
;
...
@@ -85,7 +84,8 @@ public class TSDBStatement extends AbstractStatement {
...
@@ -85,7 +84,8 @@ public class TSDBStatement extends AbstractStatement {
long
pSql
=
this
.
connection
.
getConnector
().
executeQuery
(
sql
);
long
pSql
=
this
.
connection
.
getConnector
().
executeQuery
(
sql
);
// if pSql is create/insert/update/delete/alter SQL
// if pSql is create/insert/update/delete/alter SQL
if
(
this
.
connection
.
getConnector
().
isUpdateQuery
(
pSql
))
{
if
(
this
.
connection
.
getConnector
().
isUpdateQuery
(
pSql
))
{
this
.
affectedRows
=
this
.
connection
.
getConnector
().
getAffectedRows
(
pSql
);
int
rows
=
this
.
connection
.
getConnector
().
getAffectedRows
(
pSql
);
this
.
affectedRows
=
rows
==
0
?
-
1
:
this
.
connection
.
getConnector
().
getAffectedRows
(
pSql
);
this
.
connection
.
getConnector
().
freeResultSet
(
pSql
);
this
.
connection
.
getConnector
().
freeResultSet
(
pSql
);
return
false
;
return
false
;
}
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
浏览文件 @
65b415d8
...
@@ -22,7 +22,6 @@ public class RestfulStatement extends AbstractStatement {
...
@@ -22,7 +22,6 @@ public class RestfulStatement extends AbstractStatement {
private
final
RestfulConnection
conn
;
private
final
RestfulConnection
conn
;
private
volatile
RestfulResultSet
resultSet
;
private
volatile
RestfulResultSet
resultSet
;
private
volatile
int
affectedRows
;
public
RestfulStatement
(
RestfulConnection
conn
,
String
database
)
{
public
RestfulStatement
(
RestfulConnection
conn
,
String
database
)
{
this
.
conn
=
conn
;
this
.
conn
=
conn
;
...
@@ -118,7 +117,7 @@ public class RestfulStatement extends AbstractStatement {
...
@@ -118,7 +117,7 @@ public class RestfulStatement extends AbstractStatement {
throw
TSDBError
.
createSQLException
(
resultJson
.
getInteger
(
"code"
),
resultJson
.
getString
(
"desc"
));
throw
TSDBError
.
createSQLException
(
resultJson
.
getInteger
(
"code"
),
resultJson
.
getString
(
"desc"
));
}
}
this
.
resultSet
=
new
RestfulResultSet
(
database
,
this
,
resultJson
);
this
.
resultSet
=
new
RestfulResultSet
(
database
,
this
,
resultJson
);
this
.
affectedRows
=
0
;
this
.
affectedRows
=
-
1
;
return
resultSet
;
return
resultSet
;
}
}
...
@@ -140,9 +139,10 @@ public class RestfulStatement extends AbstractStatement {
...
@@ -140,9 +139,10 @@ public class RestfulStatement extends AbstractStatement {
if
(
head
.
size
()
!=
1
||
!
"affected_rows"
.
equals
(
head
.
getString
(
0
)))
if
(
head
.
size
()
!=
1
||
!
"affected_rows"
.
equals
(
head
.
getString
(
0
)))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_VARIABLE
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_VARIABLE
);
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
if
(
data
!=
null
)
if
(
data
!=
null
)
{
return
data
.
getJSONArray
(
0
).
getInteger
(
0
);
int
rows
=
data
.
getJSONArray
(
0
).
getInteger
(
0
);
return
rows
==
0
?
-
1
:
data
.
getJSONArray
(
0
).
getInteger
(
0
);
}
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_VARIABLE
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_VARIABLE
);
}
}
...
...
src/inc/taos.h
浏览文件 @
65b415d8
...
@@ -141,6 +141,7 @@ DLL_EXPORT int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIN
...
@@ -141,6 +141,7 @@ DLL_EXPORT int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIN
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
65b415d8
此差异已折叠。
点击以展开。
src/kit/taosdump/taosdump.c
浏览文件 @
65b415d8
...
@@ -3005,8 +3005,14 @@ int main(int argc, char *argv[]) {
...
@@ -3005,8 +3005,14 @@ int main(int argc, char *argv[]) {
printf
(
"debug_print: %d
\n
"
,
g_args
.
debug_print
);
printf
(
"debug_print: %d
\n
"
,
g_args
.
debug_print
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
if
(
g_args
.
databases
||
g_args
.
all_databases
)
{
errorPrint
(
"%s is an invalid input if database(s) be already specified.
\n
"
,
g_args
.
arg_list
[
i
]);
exit
(
EXIT_FAILURE
);
}
else
{
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
}
}
printf
(
"==============================
\n
"
);
printf
(
"==============================
\n
"
);
if
(
checkParam
(
&
g_args
)
<
0
)
{
if
(
checkParam
(
&
g_args
)
<
0
)
{
...
...
blm3
@
c67fcc11
比较
4bfae86d
...
c67fcc11
Subproject commit
4bfae86dcabea0d5a40ff81a72be7c822737269b
Subproject commit
c67fcc11bc5e82e3d7aea8db855a8cbf8b109239
src/plugins/monitor/src/monMain.c
浏览文件 @
65b415d8
...
@@ -204,6 +204,7 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
...
@@ -204,6 +204,7 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
", disk_used float, disk_total int"
", disk_used float, disk_total int"
", band_speed float"
", band_speed float"
", io_read float, io_write float"
", io_read float, io_write float"
", io_read_rate float, io_write_rate float"
", req_http int, req_select int, req_insert int"
", req_http int, req_select int, req_insert int"
") tags (dnodeid int, fqdn binary(%d))"
,
") tags (dnodeid int, fqdn binary(%d))"
,
tsMonitorDbName
,
TSDB_FQDN_LEN
);
tsMonitorDbName
,
TSDB_FQDN_LEN
);
...
@@ -325,7 +326,10 @@ static int32_t monBuildIoSql(char *sql) {
...
@@ -325,7 +326,10 @@ static int32_t monBuildIoSql(char *sql) {
monDebug
(
"failed to get io info"
);
monDebug
(
"failed to get io info"
);
}
}
return
sprintf
(
sql
,
", %f, %f"
,
readKB
,
writeKB
);
float
readRate
=
readKB
/
tsMonitorInterval
;
float
writeRate
=
writeKB
/
tsMonitorInterval
;
return
sprintf
(
sql
,
", %f, %f, %f, %f"
,
readKB
,
writeKB
,
readRate
,
writeRate
);
}
}
static
void
monSaveSystemInfo
()
{
static
void
monSaveSystemInfo
()
{
...
...
src/query/src/qExecutor.c
浏览文件 @
65b415d8
...
@@ -365,7 +365,8 @@ int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int3
...
@@ -365,7 +365,8 @@ int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int3
* ts, tag, tagprj function can not decide the output number of current query
* ts, tag, tagprj function can not decide the output number of current query
* the number of output result is decided by main output
* the number of output result is decided by main output
*/
*/
if
(
hasMainFunction
&&
(
id
==
TSDB_FUNC_TS
||
id
==
TSDB_FUNC_TAG
||
id
==
TSDB_FUNC_TAGPRJ
))
{
if
(
hasMainFunction
&&
(
id
==
TSDB_FUNC_TS
||
id
==
TSDB_FUNC_TAG
||
id
==
TSDB_FUNC_TAGPRJ
||
id
==
TSDB_FUNC_TS_DUMMY
||
id
==
TSDB_FUNC_TAG_DUMMY
))
{
continue
;
continue
;
}
}
...
...
src/tsdb/src/tsdbCompact.c
浏览文件 @
65b415d8
...
@@ -441,6 +441,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
...
@@ -441,6 +441,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
if
((
tdInitDataCols
(
pComph
->
pDataCols
,
pSchema
)
<
0
)
||
(
tdInitDataCols
(
pReadh
->
pDCols
[
0
],
pSchema
)
<
0
)
||
if
((
tdInitDataCols
(
pComph
->
pDataCols
,
pSchema
)
<
0
)
||
(
tdInitDataCols
(
pReadh
->
pDCols
[
0
],
pSchema
)
<
0
)
||
(
tdInitDataCols
(
pReadh
->
pDCols
[
1
],
pSchema
)
<
0
))
{
(
tdInitDataCols
(
pReadh
->
pDCols
[
1
],
pSchema
)
<
0
))
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
tdFreeSchema
(
pSchema
);
return
-
1
;
return
-
1
;
}
}
tdFreeSchema
(
pSchema
);
tdFreeSchema
(
pSchema
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
65b415d8
...
@@ -1620,7 +1620,7 @@ static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
...
@@ -1620,7 +1620,7 @@ static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
SColIdx
*
pColIdx
=
kvRowColIdxAt
(
rowBody
,
chosen_itr
);
SColIdx
*
pColIdx
=
kvRowColIdxAt
(
rowBody
,
chosen_itr
);
colId
=
pColIdx
->
colId
;
colId
=
pColIdx
->
colId
;
offset
=
pColIdx
->
offset
;
offset
=
pColIdx
->
offset
;
value
=
tdGetKvRowDataOfCol
(
rowBody
,
pColIdx
->
offset
);
value
=
tdGetKvRowDataOfCol
(
rowBody
,
offset
);
}
}
...
...
tests/examples/c/prepare.c
浏览文件 @
65b415d8
...
@@ -184,6 +184,10 @@ void verify_prepare(TAOS* taos) {
...
@@ -184,6 +184,10 @@ void verify_prepare(TAOS* taos) {
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
printf
(
"sucessfully inserted %d rows
\n
"
,
affectedRows
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
// query the records
// query the records
...
@@ -400,6 +404,9 @@ void verify_prepare2(TAOS* taos) {
...
@@ -400,6 +404,9 @@ void verify_prepare2(TAOS* taos) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
printf
(
"sucessfully inserted %d rows
\n
"
,
affectedRows
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
// query the records
// query the records
...
@@ -784,6 +791,10 @@ void verify_prepare3(TAOS* taos) {
...
@@ -784,6 +791,10 @@ void verify_prepare3(TAOS* taos) {
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
printf
(
"successfully inserted %d rows
\n
"
,
affectedRows
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
// query the records
// query the records
...
...
tests/pytest/fulltest.sh
浏览文件 @
65b415d8
...
@@ -391,6 +391,7 @@ python3 ./test.py -f tag_lite/alter_tag.py
...
@@ -391,6 +391,7 @@ python3 ./test.py -f tag_lite/alter_tag.py
python3 test.py
-f
tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py
-f
tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py
-f
tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py
-f
tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py
-f
tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
python3 test.py
-f
tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
python3 test.py
-f
tools/taosdemoAllTest/TD-10539/create_taosdemo.py
python3 ./test.py
-f
tag_lite/drop_auto_create.py
python3 ./test.py
-f
tag_lite/drop_auto_create.py
python3 test.py
-f
insert/insert_before_use_db.py
python3 test.py
-f
insert/insert_before_use_db.py
python3 test.py
-f
alter/alter_keep.py
python3 test.py
-f
alter/alter_keep.py
...
...
tests/pytest/insert/insertTelnetLines.py
浏览文件 @
65b415d8
...
@@ -29,7 +29,6 @@ class TDTestCase:
...
@@ -29,7 +29,6 @@ class TDTestCase:
tdSql
.
execute
(
"create database if not exists test precision 'us'"
)
tdSql
.
execute
(
"create database if not exists test precision 'us'"
)
tdSql
.
execute
(
'use test'
)
tdSql
.
execute
(
'use test'
)
### metric ###
### metric ###
print
(
"============= step1 : test metric ================"
)
print
(
"============= step1 : test metric ================"
)
lines0
=
[
lines0
=
[
...
@@ -215,7 +214,7 @@ class TDTestCase:
...
@@ -215,7 +214,7 @@ class TDTestCase:
#binary
#binary
lines2_7
=
[
lines2_7
=
[
"stb2_7 1626006833610ms
\"
binary_val.!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833610ms
\"
binary_val .!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
"stb2_7 1626006833630ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
]
]
...
@@ -232,7 +231,7 @@ class TDTestCase:
...
@@ -232,7 +231,7 @@ class TDTestCase:
#nchar
#nchar
lines2_8
=
[
lines2_8
=
[
"stb2_8 1626006833610ms L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833610ms L
\"
nchar_val 数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
]
]
...
...
tests/pytest/insert/line_insert.py
浏览文件 @
65b415d8
...
@@ -31,9 +31,9 @@ class TDTestCase:
...
@@ -31,9 +31,9 @@ class TDTestCase:
tdSql
.
execute
(
'create stable ste(ts timestamp, f int) tags(t1 bigint)'
)
tdSql
.
execute
(
'create stable ste(ts timestamp, f int) tags(t1 bigint)'
)
lines
=
[
"st,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
lines
=
[
"st,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
\"\"
a pa,
\"
s si,t
\"\"
\"
,c2=false,c4=4f64 1626006833639000000"
,
"st,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833640000000"
,
"st,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833640000000"
,
"ste,t2=5f64,t3=L
\"
ste
\"
c1=true,c2=4i64,c3=
\"
iam
\"
1626056811823316532"
,
"ste,t2=5f64,t3=L
\"
ste
\"
c1=true,c2=4i64,c3=
\"
i,
\"
a
\"
m,
\"\"
\"
1626056811823316532"
,
"stf,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000"
,
"stf,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000"
,
"st,t1=4i64,t2=5f64,t3=
\"
t4
\"
c1=3i64,c3=L
\"
passitagain
\"
,c2=true,c4=5f64 1626006833642000000"
,
"st,t1=4i64,t2=5f64,t3=
\"
t4
\"
c1=3i64,c3=L
\"
passitagain
\"
,c2=true,c4=5f64 1626006833642000000"
,
"ste,t2=5f64,t3=L
\"
ste2
\"
c3=
\"
iamszhou
\"
,c4=false 1626056811843316532"
,
"ste,t2=5f64,t3=L
\"
ste2
\"
c3=
\"
iamszhou
\"
,c4=false 1626056811843316532"
,
...
...
tests/pytest/table/create.py
浏览文件 @
65b415d8
...
@@ -298,7 +298,6 @@ class TDTestCase:
...
@@ -298,7 +298,6 @@ class TDTestCase:
print
(
"==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table"
)
print
(
"==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table"
)
self
.
regular_table
=
"regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self
.
regular_table
=
"regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
#self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql
.
execute
(
"create table `%s` (ts timestamp,i int) ;"
%
self
.
regular_table
)
tdSql
.
execute
(
"create table `%s` (ts timestamp,i int) ;"
%
self
.
regular_table
)
tdSql
.
query
(
"describe `%s` ; "
%
self
.
regular_table
)
tdSql
.
query
(
"describe `%s` ; "
%
self
.
regular_table
)
...
@@ -328,9 +327,9 @@ class TDTestCase:
...
@@ -328,9 +327,9 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
self
.
crr_tb
=
"create_r_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self
.
crr_tb
=
"create_r_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
#
tdSql.execute("create table `%s` as select * from `%s` ;" %(self.crr_tb,self.regular_table))
tdSql
.
execute
(
"create table `%s` as select * from `%s` ;"
%
(
self
.
crr_tb
,
self
.
regular_table
))
# tdSql.query("show db
.tables like 'create_r_table%' ")
tdSql
.
query
(
"show db2
.tables like 'create_r_table%' "
)
#
tdSql.checkRows(1)
tdSql
.
checkRows
(
1
)
print
(
"==============drop table\stable"
)
print
(
"==============drop table\stable"
)
try
:
try
:
...
@@ -341,15 +340,6 @@ class TDTestCase:
...
@@ -341,15 +340,6 @@ class TDTestCase:
tdSql
.
error
(
"select * from `%s`"
%
self
.
regular_table
)
tdSql
.
error
(
"select * from `%s`"
%
self
.
regular_table
)
#表名:192个字符,还要包含前面的数据库名
#taosdemo 建数据库表 # 单独放
# self.tsdemo = "tsdemo~!@#$%^&*()-_+=[]{}"
# os.system("%staosdemo -d test -m `%s` -t 10 -n 100 -l 10 -y " % (binPath,self.tsdemo))
# tdSql.execute("use #!#!#!")
# tdSql.query("select count (tbname) from #!#!#!")
# tdSql.checkData(0, 0, 1000)
def
stop
(
self
):
def
stop
(
self
):
...
...
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
0 → 100644
浏览文件 @
65b415d8
###################################################################
# 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
import
taos
import
time
import
os
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-10539/create_taosdemo.py.sql"
)
tdSql
.
prepare
()
#print("==============taosdemo,#create stable,table; insert table; show table; select table; drop table")
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os
.
system
(
"%staosdemo -d test -E -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
execute
(
"use test ;"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"show test.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
13
)
tdSql
.
query
(
"show create table test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"CREATE TABLE `%s1` USING `meters` TAGS (1,
\"
beijing
\"
)"
%
self
.
tsdemo
)
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table test.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
try
:
tdSql
.
execute
(
"drop table test.meters "
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.meters "
)
tdSql
.
error
(
"select * from test.`%s2` ; "
%
self
.
tsdemo
)
# Exception
os
.
system
(
"%staosdemo -d test -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
query
(
"show test.tables "
)
tdSql
.
checkRows
(
0
)
#print("==============taosdemo,#create regular table; insert table; show table; select table; drop table")
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os
.
system
(
"%staosdemo -N -E -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
execute
(
"use test ;"
)
tdSql
.
query
(
"select count(*) from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"show test.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
11
)
tdSql
.
query
(
"show create table test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"create table `%s1` (ts TIMESTAMP,c0 FLOAT,c1 INT,c2 INT,c3 INT,c4 INT,c5 INT,c6 INT,c7 INT,c8 INT,c9 INT)"
%
self
.
tsdemo
)
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table test.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
# Exception
os
.
system
(
"%staosdemo -N -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
query
(
"show test.tables "
)
tdSql
.
checkRows
(
0
)
#print("==============taosdemo——json_yes,#create stable,table; insert table; show table; select table; drop table")
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbyes"
)
self
.
tsdemo_stable
=
"tsdemo_stable~!.@#$%^*[]-_=+{,?.}"
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
tdSql
.
query
(
"select count(*) from dbyes.`%s`"
%
self
.
tsdemo_stable
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"show dbyes.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show dbyes.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
13
)
tdSql
.
query
(
"show create table dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"CREATE TABLE `%s1` USING `%s` TAGS (1,1)"
%
(
self
.
tsdemo
,
self
.
tsdemo_stable
))
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table dbyes.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show dbyes.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
try
:
tdSql
.
execute
(
"drop table dbyes.`%s` ; "
%
self
.
tsdemo_stable
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from dbyes.`%s` ; "
%
self
.
tsdemo_stable
)
tdSql
.
error
(
"select * from dbyes.`%s2` ; "
%
self
.
tsdemo
)
#print("==============taosdemo——json_no,#create stable,table; insert table; show table; select table; drop table")
assert
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json -y "
%
binPath
)
==
0
tdSql
.
query
(
"show dbno.tables "
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
0 → 100644
浏览文件 @
65b415d8
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
10
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
10
,
"num_of_records_per_req"
:
1
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"dbno"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"meters"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
10
,
"childtable_prefix"
:
"tsdemo~!.@#$%^*[]-_=+{,?.}"
,
"escape_character"
:
"no"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
1
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_limit"
:
0
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"interlace_rows"
:
0
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
,
"count"
:
9
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"INT"
,
"count"
:
2
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
0 → 100644
浏览文件 @
65b415d8
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
5
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
10
,
"num_of_records_per_req"
:
1
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"dbyes"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"tsdemo_stable~!.@#$%^*[]-_=+{,?.}"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
10
,
"childtable_prefix"
:
"tsdemo~!.@#$%^*[]-_=+{,?.}"
,
"escape_character"
:
"yes"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
1
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_limit"
:
0
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"interlace_rows"
:
0
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
,
"count"
:
9
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"INT"
,
"count"
:
2
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json
→
tests/pytest/tools/taosdemoAllTest/stmt/
i
nsertColumnsAndTagNumLarge4096-stmt.json
浏览文件 @
65b415d8
文件已移动
tests/pytest/tools/taosdumpTest3.py
浏览文件 @
65b415d8
...
@@ -62,8 +62,12 @@ class TDTestCase:
...
@@ -62,8 +62,12 @@ class TDTestCase:
os
.
makedirs
(
"./taosdumptest/tmp3"
)
os
.
makedirs
(
"./taosdumptest/tmp3"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp4"
):
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp4"
):
os
.
makedirs
(
"./taosdumptest/tmp4"
)
os
.
makedirs
(
"./taosdumptest/tmp4"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp5"
):
os
.
makedirs
(
"./taosdumptest/tmp5"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp6"
):
os
.
makedirs
(
"./taosdumptest/tmp6"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp7"
):
os
.
makedirs
(
"./taosdumptest/tmp7"
)
buildPath
=
self
.
getBuildPath
()
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
tdLog
.
exit
(
"taosdump not found!"
)
...
@@ -72,6 +76,8 @@ class TDTestCase:
...
@@ -72,6 +76,8 @@ class TDTestCase:
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# create db1 , one stables and one table ; create general tables
# create db1 , one stables and one table ; create general tables
tdSql
.
execute
(
"drop database if exists dp1"
)
tdSql
.
execute
(
"drop database if exists dp2"
)
tdSql
.
execute
(
"create database if not exists dp1"
)
tdSql
.
execute
(
"create database if not exists dp1"
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int)"
)
...
@@ -82,9 +88,10 @@ class TDTestCase:
...
@@ -82,9 +88,10 @@ class TDTestCase:
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c0 int, c1 double) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c0 int, c1 double) "
)
tdSql
.
execute
(
"insert into gt0 values(1614218412000,637,8.861)"
)
tdSql
.
execute
(
"insert into gt0 values(1614218412000,637,8.861)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413000,638,8.862)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413000,638,8.862)"
)
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# \stb3,include ctables stb3_0 and stb3_1
# \stb3,include ctables stb3_0 and stb3_1
#
;
create general three tables gt0 gt1 gt2
# create general three tables gt0 gt1 gt2
tdSql
.
execute
(
"create database if not exists dp2"
)
tdSql
.
execute
(
"create database if not exists dp2"
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
...
@@ -102,94 +109,188 @@ class TDTestCase:
...
@@ -102,94 +109,188 @@ class TDTestCase:
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c00 int, c01 float) "
)
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c00 int, c01 float) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c10 int, c11 double) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c10 int, c11 double) "
)
tdSql
.
execute
(
"create table if not exists gt2 (ts timestamp, c20 int, c21 float) "
)
tdSql
.
execute
(
"create table if not exists gt2 (ts timestamp, c20 int, c21 float) "
)
tdSql
.
execute
(
"insert into gt0 values(1614218412000,8637,78.86155)"
)
tdSql
.
execute
(
"insert into gt0 values(1614218412700,8637,78.86155)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413000,8638,78.862020199)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413800,8638,78.862020199)"
)
tdSql
.
execute
(
"insert into gt2 values(1614218413000,8639,78.863)"
)
tdSql
.
execute
(
"insert into gt2 values(1614218413900,8639,78.863)"
)
# create
tdSql
.
execute
(
"create database if not exists dp3 precision 'ns'"
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000000001,8600,'R')(1614218422000000002,8600,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000000001,8601,'A')(1614218423000000002,8601,'D')"
)
# tdSql.execute("insert into t0 values(1614218422000,8638,'R')")
# tdSql.execute("insert into t0 values(1614218422000,8638,'R')")
os
.
system
(
"rm -rf ./taosdumptest/tmp1/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp1/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp2/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp2/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp3/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp3/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp4/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp4/*"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp5/*"
)
# # taosdump stable and general table
# # taosdump stable and general table
# os.system("%staosdump -o ./taosdumptest/tmp1 -D dp1 dp2 " % binPath)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp1 -D dp1,dp2 "
%
binPath
)
# os.system("%staosdump -o ./taosdumptest/tmp2 dp1 st0 gt0 " % binPath)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp2 dp1 st0 gt0 "
%
binPath
)
# os.system("%staosdump -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0" % binPath)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0"
%
binPath
)
# os.system("%staosdump -o ./taosdumptest/tmp4 dp2 st0 st2 gt0 gt2" % binPath)、
os
.
system
(
"%staosdump -o ./taosdumptest/tmp4 dp2 st0 st2 gt0 gt2"
%
binPath
)
# verify ns
os
.
system
(
"%staosdump -o ./taosdumptest/tmp6 dp3 st0_0"
%
binPath
)
assert
os
.
system
(
"%staosdump -o ./taosdumptest/tmp6 dp3 st0_0 -C ns "
%
binPath
)
!=
0
# verify -D:--database
# verify -D:--database
# os.system("%staosdump --databases dp1 -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0" % binPath)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp5 --databases dp1,dp2 "
%
binPath
)
# os.system("%staosdump --databases dp1,dp2 -o ./taosdumptest/tmp3 " % binPath)
# verify mixed -D:--database and dbname tbname
assert
os
.
system
(
"%staosdump --databases dp1 -o ./taosdumptest/tmp5 dp2 st0 st1_0 gt0"
%
binPath
)
!=
0
# #check taosdumptest/tmp1
# tdSql.execute("drop database dp1")
#check taosdumptest/tmp1
# tdSql.execute("drop database dp2")
tdSql
.
execute
(
"drop database dp1"
)
# os.system("%staosdump -i ./taosdumptest/tmp1 -T 2 " % binPath)
tdSql
.
execute
(
"drop database dp2"
)
# tdSql.execute("use dp1")
os
.
system
(
"%staosdump -i ./taosdumptest/tmp1 -T 2 "
%
binPath
)
# tdSql.query("show stables")
tdSql
.
execute
(
"use dp1"
)
# tdSql.checkRows(1)
tdSql
.
query
(
"show stables"
)
# tdSql.query("show tables")
tdSql
.
checkRows
(
1
)
# tdSql.checkRows(4)
tdSql
.
query
(
"show tables"
)
# tdSql.execute("use dp2")
tdSql
.
checkRows
(
4
)
# tdSql.query("show stables")
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
# tdSql.checkRows(3)
tdSql
.
checkData
(
0
,
0
,
8537
)
# tdSql.query("show tables")
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
# tdSql.checkRows(9)
tdSql
.
checkData
(
1
,
0
,
"D"
)
# tdSql.query("select c01 from gt0")
tdSql
.
query
(
"select * from gt0"
)
# tdSql.checkData(0,0,78.86155)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
# tdSql.query("select c11 from gt1")
tdSql
.
checkData
(
0
,
1
,
637
)
# tdSql.checkData(0, 0, 78.862020199)
tdSql
.
execute
(
"use dp2"
)
# tdSql.query("select c21 from gt2")
tdSql
.
query
(
"show stables"
)
# tdSql.checkData(0, 0, 78.86300)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"show tables"
)
# #check taosdumptest/tmp2
tdSql
.
checkRows
(
9
)
# tdSql.execute("drop database dp1")
tdSql
.
query
(
"select ts from gt0"
)
# tdSql.execute("drop database dp2")
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
# os.system("%staosdump -i ./taosdumptest/tmp2 -T 2 " % binPath)
tdSql
.
query
(
"select c10 from gt1"
)
# tdSql.execute("use dp1")
tdSql
.
checkData
(
0
,
0
,
8638
)
# tdSql.query("show stables")
tdSql
.
query
(
"select c20 from gt2"
)
# tdSql.checkRows(1)
tdSql
.
checkData
(
0
,
0
,
8639
)
# tdSql.query("show tables")
# tdSql.checkRows(3)
# tdSql.error("use dp2")
#check taosdumptest/tmp2
# tdSql.query("select c01 from gt0")
tdSql
.
execute
(
"drop database dp1"
)
# tdSql.checkData(0,0,78.86155)
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%staosdump -i ./taosdumptest/tmp2 -T 2 "
%
binPath
)
# #check taosdumptest/tmp3
tdSql
.
execute
(
"use dp1"
)
# tdSql.execute("drop database dp1")
tdSql
.
query
(
"show stables"
)
# os.system("%staosdump -i ./taosdumptest/tmp3 -T 2 " % binPath)
tdSql
.
checkRows
(
1
)
# tdSql.execute("use dp2")
tdSql
.
query
(
"show tables"
)
# tdSql.query("show stables")
tdSql
.
checkRows
(
3
)
# tdSql.checkRows(2)
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
# tdSql.query("show tables")
tdSql
.
checkData
(
0
,
0
,
8537
)
# tdSql.checkRows(4)
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
# tdSql.query("select count(*) from st1_0")
tdSql
.
checkData
(
1
,
0
,
"D"
)
# tdSql.query("select c01 from gt0")
tdSql
.
query
(
"select * from gt0"
)
# tdSql.checkData(0,0,78.86155)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
# tdSql.error("use dp1")
tdSql
.
checkData
(
0
,
1
,
637
)
# tdSql.error("select count(*) from st2_0")
tdSql
.
error
(
"select count(*) from gt1"
)
# tdSql.error("select count(*) from gt2")
tdSql
.
error
(
"use dp2"
)
# #check taosdumptest/tmp4
# tdSql.execute("drop database dp2")
#check taosdumptest/tmp3
# os.system("%staosdump -i ./taosdumptest/tmp4 -T 2 " % binPath)
tdSql
.
execute
(
"drop database dp1"
)
# tdSql.execute("use dp2")
os
.
system
(
"%staosdump -i ./taosdumptest/tmp3 -T 2 "
%
binPath
)
# tdSql.query("show stables")
tdSql
.
execute
(
"use dp2"
)
# tdSql.checkRows(2)
tdSql
.
query
(
"show stables"
)
# tdSql.query("show tables")
tdSql
.
checkRows
(
2
)
# tdSql.checkRows(6)
tdSql
.
query
(
"show tables"
)
# tdSql.query("select c21 from gt2")
tdSql
.
checkRows
(
4
)
# tdSql.checkData(0, 0, 78.86300)
tdSql
.
query
(
"select count(*) from st1_0"
)
# tdSql.query("select count(*) from st2_0")
tdSql
.
checkData
(
0
,
0
,
2
)
# tdSql.error("use dp1")
tdSql
.
query
(
"select ts from gt0"
)
# tdSql.error("select count(*) from st1_0")
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
# tdSql.error("select count(*) from gt3")
tdSql
.
error
(
"use dp1"
)
# tdSql.execute("drop database dp2")
tdSql
.
error
(
"select count(*) from st2_0"
)
tdSql
.
error
(
"select count(*) from gt2"
)
# os.system("rm -rf ./taosdumptest/tmp1")
#check taosdumptest/tmp4
# os.system("rm -rf ./taosdumptest/tmp2")
tdSql
.
execute
(
"drop database dp2"
)
# os.system("rm -rf ./dump_result.txt")
os
.
system
(
"%staosdump -i ./taosdumptest/tmp4 -T 2 "
%
binPath
)
# os.system("rm -rf ./db.csv")
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
6
)
tdSql
.
query
(
"select c20 from gt2"
)
tdSql
.
checkData
(
0
,
0
,
8639
)
tdSql
.
query
(
"select count(*) from st0_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st0_1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st2_1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st2_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
error
(
"use dp1"
)
tdSql
.
error
(
"select count(*) from st1_0"
)
tdSql
.
error
(
"select count(*) from st1_1"
)
tdSql
.
error
(
"select count(*) from gt3"
)
#check taosdumptest/tmp5
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%staosdump -i ./taosdumptest/tmp5 -T 2 "
%
binPath
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select c20 from gt2"
)
tdSql
.
checkData
(
0
,
0
,
8639
)
tdSql
.
query
(
"select count(*) from st0_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st0_1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st2_1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st2_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st1_1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from st1_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
query
(
"select * from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
#check taosdumptest/tmp6
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
tdSql
.
execute
(
"drop database dp3"
)
os
.
system
(
"%staosdump -i ./taosdumptest/tmp6 -T 2 "
%
binPath
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from st0_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select * from st0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000000001'
)
tdSql
.
checkData
(
0
,
1
,
8600
)
os
.
system
(
"rm -rf ./taosdumptest/tmp1"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp2"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp3"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp4"
)
os
.
system
(
"rm -rf ./taosdumptest/tmp5"
)
os
.
system
(
"rm -rf ./dump_result.txt"
)
os
.
system
(
"rm -rf ./db.csv"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/script/api/batchprepare.c
浏览文件 @
65b415d8
...
@@ -120,6 +120,10 @@ int stmt_scol_func1(TAOS_STMT *stmt) {
...
@@ -120,6 +120,10 @@ int stmt_scol_func1(TAOS_STMT *stmt) {
exit
(
1
);
exit
(
1
);
}
}
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
if
(
affectedRows
!=
100
)
{
printf
(
"failed to insert 100 rows"
);
}
return
0
;
return
0
;
}
}
...
...
tests/script/api/stmt.c
浏览文件 @
65b415d8
...
@@ -46,6 +46,7 @@ void taos_stmt_init_test() {
...
@@ -46,6 +46,7 @@ void taos_stmt_init_test() {
}
}
stmt
=
taos_stmt_init
(
taos
);
stmt
=
taos_stmt_init
(
taos
);
assert
(
stmt
!=
NULL
);
assert
(
stmt
!=
NULL
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_init test
\n
"
);
printf
(
"finish taos_stmt_init test
\n
"
);
}
}
...
@@ -127,6 +128,7 @@ void taos_stmt_set_tbname_test() {
...
@@ -127,6 +128,7 @@ void taos_stmt_set_tbname_test() {
assert
(
taos_stmt_set_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
name
)
==
0
);
free
(
name
);
free
(
name
);
free
(
stmt_sql
);
free
(
stmt_sql
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
printf
(
"finish taos_stmt_set_tbname test
\n
"
);
printf
(
"finish taos_stmt_set_tbname test
\n
"
);
}
}
...
@@ -166,6 +168,7 @@ void taos_stmt_set_tbname_tags_test() {
...
@@ -166,6 +168,7 @@ void taos_stmt_set_tbname_tags_test() {
free
(
stmt_sql
);
free
(
stmt_sql
);
free
(
name
);
free
(
name
);
free
(
tags
);
free
(
tags
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
printf
(
"finish taos_stmt_set_tbname_tags test
\n
"
);
printf
(
"finish taos_stmt_set_tbname_tags test
\n
"
);
}
}
...
@@ -194,8 +197,10 @@ void taos_stmt_set_sub_tbname_test() {
...
@@ -194,8 +197,10 @@ void taos_stmt_set_sub_tbname_test() {
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
!=
0
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
!=
0
);
sprintf
(
name
,
"tb"
);
sprintf
(
name
,
"tb"
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_load_table_info
(
taos
,
"super, tb"
)
==
0
);
assert
(
taos_load_table_info
(
taos
,
"super, tb"
)
==
0
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
name
);
free
(
name
);
free
(
stmt_sql
);
free
(
stmt_sql
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
...
@@ -238,6 +243,7 @@ void taos_stmt_bind_param_test() {
...
@@ -238,6 +243,7 @@ void taos_stmt_bind_param_test() {
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
!=
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
!=
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
params
);
free
(
params
);
free
(
stmt_sql
);
free
(
stmt_sql
);
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
...
@@ -249,6 +255,7 @@ void taos_stmt_bind_single_param_batch_test() {
...
@@ -249,6 +255,7 @@ void taos_stmt_bind_single_param_batch_test() {
TAOS_STMT
*
stmt
=
NULL
;
TAOS_STMT
*
stmt
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
assert
(
taos_stmt_bind_single_param_batch
(
stmt
,
bind
,
0
)
!=
0
);
assert
(
taos_stmt_bind_single_param_batch
(
stmt
,
bind
,
0
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_bind_single_param_batch test
\n
"
);
printf
(
"finish taos_stmt_bind_single_param_batch test
\n
"
);
}
}
...
@@ -257,6 +264,7 @@ void taos_stmt_bind_param_batch_test() {
...
@@ -257,6 +264,7 @@ void taos_stmt_bind_param_batch_test() {
TAOS_STMT
*
stmt
=
NULL
;
TAOS_STMT
*
stmt
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
assert
(
taos_stmt_bind_param_batch
(
stmt
,
bind
)
!=
0
);
assert
(
taos_stmt_bind_param_batch
(
stmt
,
bind
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_bind_param_batch test
\n
"
);
printf
(
"finish taos_stmt_bind_param_batch test
\n
"
);
}
}
...
@@ -293,10 +301,14 @@ void taos_stmt_add_batch_test() {
...
@@ -293,10 +301,14 @@ void taos_stmt_add_batch_test() {
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
is_null
=
NULL
;
params
[
1
].
is_null
=
NULL
;
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
params
);
free
(
params
);
free
(
stmt_sql
);
free
(
stmt_sql
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_add_batch test
\n
"
);
printf
(
"finish taos_stmt_add_batch test
\n
"
);
}
}
...
@@ -317,10 +329,13 @@ void taos_stmt_execute_test() {
...
@@ -317,10 +329,13 @@ void taos_stmt_execute_test() {
stmt
=
taos_stmt_init
(
taos
);
stmt
=
taos_stmt_init
(
taos
);
assert
(
stmt
!=
NULL
);
assert
(
stmt
!=
NULL
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
char
*
stmt_sql
=
calloc
(
1
,
1000
);
char
*
stmt_sql
=
calloc
(
1
,
1000
);
sprintf
(
stmt_sql
,
"insert into ? values (?,?)"
);
sprintf
(
stmt_sql
,
"insert into ? values (?,?)"
);
assert
(
taos_stmt_prepare
(
stmt
,
stmt_sql
,
0
)
==
0
);
assert
(
taos_stmt_prepare
(
stmt
,
stmt_sql
,
0
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
TAOS_BIND
*
params
=
calloc
(
2
,
sizeof
(
TAOS_BIND
));
TAOS_BIND
*
params
=
calloc
(
2
,
sizeof
(
TAOS_BIND
));
int64_t
ts
=
(
int64_t
)
1591060628000
;
int64_t
ts
=
(
int64_t
)
1591060628000
;
params
[
0
].
buffer_type
=
TSDB_DATA_TYPE_TIMESTAMP
;
params
[
0
].
buffer_type
=
TSDB_DATA_TYPE_TIMESTAMP
;
...
@@ -335,11 +350,17 @@ void taos_stmt_execute_test() {
...
@@ -335,11 +350,17 @@ void taos_stmt_execute_test() {
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
is_null
=
NULL
;
params
[
1
].
is_null
=
NULL
;
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
1
);
free
(
params
);
free
(
params
);
free
(
stmt_sql
);
free
(
stmt_sql
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
...
...
tests/script/api/stmtTest.c
浏览文件 @
65b415d8
...
@@ -229,6 +229,14 @@ int main(int argc, char *argv[]) {
...
@@ -229,6 +229,14 @@ int main(int argc, char *argv[]) {
PRINT_SUCCESS
PRINT_SUCCESS
printf
(
"Successfully execute insert statement.
\n
"
);
printf
(
"Successfully execute insert statement.
\n
"
);
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
printf
(
"Successfully inserted %d rows
\n
"
,
affectedRows
);
if
(
affectedRows
!=
10
)
{
PRINT_ERROR
printf
(
"failed to insert 10 rows
\n
"
);
exit
(
EXIT_FAILURE
);
}
taos_stmt_close
(
stmt
);
taos_stmt_close
(
stmt
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
check_result
(
taos
,
i
,
1
);
check_result
(
taos
,
i
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录