未验证 提交 f0fea88d 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Feature/sangshuduo/td 4068 taosdemo stmt (#6274)

* merge with develop branch.

change query/tests/CMakeLists.txt to allow unused function and variable.

* refactor data generating.

* refactor.

* refactor.

* refactor.

* refactor.

* refactor

* add prepare stmt function.

* refactor get rand timestamp.

* fix windows compile error.

* copy logic of generate data for stmt.

* insert data basically works now.

* fix windows compile issue.

* [TD-4068]<feature>: taosdemo stmt interface.

stb batch insert works.

* [TD-4068]<feature>: taosdemo support stmt.

normal table insert works.

* [TD-4068]<feature>: taosdemo support stmt.

interlace write works.

* add compile macro to make taosdemo same with master branch.

* fix clang compile error.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 a8e97be5
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#include "taoserror.h" #include "taoserror.h"
#include "tutil.h" #include "tutil.h"
#define STMT_IFACE_ENABLED 1
#define REQ_EXTRA_BUF_LEN 1024 #define REQ_EXTRA_BUF_LEN 1024
#define RESP_BUF_LEN 4096 #define RESP_BUF_LEN 4096
...@@ -5259,6 +5261,7 @@ static int64_t generateInterlaceDataWithoutStb( ...@@ -5259,6 +5261,7 @@ static int64_t generateInterlaceDataWithoutStb(
return k; return k;
} }
#if STMT_IFACE_ENABLED == 1
static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
char *dataType, int32_t dataLen, char **ptr) char *dataType, int32_t dataLen, char **ptr)
{ {
...@@ -5551,6 +5554,7 @@ static int32_t prepareStbStmt(SSuperTable *stbInfo, ...@@ -5551,6 +5554,7 @@ static int32_t prepareStbStmt(SSuperTable *stbInfo,
return k; return k;
} }
#endif
static int32_t generateStbProgressiveData( static int32_t generateStbProgressiveData(
SSuperTable *superTblInfo, SSuperTable *superTblInfo,
...@@ -5738,6 +5742,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5738,6 +5742,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
int32_t generated; int32_t generated;
if (superTblInfo) { if (superTblInfo) {
if (superTblInfo->iface == STMT_IFACE) { if (superTblInfo->iface == STMT_IFACE) {
#if STMT_IFACE_ENABLED == 1
generated = prepareStbStmt(superTblInfo, generated = prepareStbStmt(superTblInfo,
pThreadInfo->stmt, pThreadInfo->stmt,
tableName, tableName,
...@@ -5745,6 +5750,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5745,6 +5750,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
insertRows, i, insertRows, i,
startTime, startTime,
pThreadInfo->buffer); pThreadInfo->buffer);
#else
generated = -1;
#endif
} else { } else {
generated = generateStbInterlaceData( generated = generateStbInterlaceData(
superTblInfo, superTblInfo,
...@@ -5762,11 +5770,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5762,11 +5770,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo->threadID, pThreadInfo->threadID,
__func__, __LINE__, __func__, __LINE__,
tableName, batchPerTbl, startTime); tableName, batchPerTbl, startTime);
#if STMT_IFACE_ENABLED == 1
generated = prepareStmtWithoutStb( generated = prepareStmtWithoutStb(
pThreadInfo->stmt, tableName, pThreadInfo->stmt, tableName,
batchPerTbl, batchPerTbl,
insertRows, i, insertRows, i,
startTime); startTime);
#else
generated = -1;
#endif
} else { } else {
generated = generateInterlaceDataWithoutStb( generated = generateInterlaceDataWithoutStb(
tableName, batchPerTbl, tableName, batchPerTbl,
...@@ -5947,12 +5959,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { ...@@ -5947,12 +5959,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
int32_t generated; int32_t generated;
if (superTblInfo) { if (superTblInfo) {
if (superTblInfo->iface == STMT_IFACE) { if (superTblInfo->iface == STMT_IFACE) {
#if STMT_IFACE_ENABLED == 1
generated = prepareStbStmt( generated = prepareStbStmt(
superTblInfo, superTblInfo,
pThreadInfo->stmt, pThreadInfo->stmt,
tableName, tableName,
g_args.num_of_RPR, g_args.num_of_RPR,
insertRows, i, start_time, pstr); insertRows, i, start_time, pstr);
#else
generated = -1;
#endif
} else { } else {
generated = generateStbProgressiveData( generated = generateStbProgressiveData(
superTblInfo, superTblInfo,
...@@ -5963,12 +5979,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { ...@@ -5963,12 +5979,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
} }
} else { } else {
if (g_args.iface == STMT_IFACE) { if (g_args.iface == STMT_IFACE) {
#if STMT_IFACE_ENABLED == 1
generated = prepareStmtWithoutStb( generated = prepareStmtWithoutStb(
pThreadInfo->stmt, pThreadInfo->stmt,
tableName, tableName,
g_args.num_of_RPR, g_args.num_of_RPR,
insertRows, i, insertRows, i,
start_time); start_time);
#else
generated = -1;
#endif
} else { } else {
generated = generateProgressiveDataWithoutStb( generated = generateProgressiveDataWithoutStb(
tableName, tableName,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册