From f0fea88d4f2107589f0265a3006aae36de9f92e1 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 28 May 2021 19:51:00 +0800 Subject: [PATCH] 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]: taosdemo stmt interface. stb batch insert works. * [TD-4068]: taosdemo support stmt. normal table insert works. * [TD-4068]: taosdemo support stmt. interlace write works. * add compile macro to make taosdemo same with master branch. * fix clang compile error. Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 6ad5fadf7c..b7b2fe0e52 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -53,6 +53,8 @@ #include "taoserror.h" #include "tutil.h" +#define STMT_IFACE_ENABLED 1 + #define REQ_EXTRA_BUF_LEN 1024 #define RESP_BUF_LEN 4096 @@ -5259,6 +5261,7 @@ static int64_t generateInterlaceDataWithoutStb( return k; } +#if STMT_IFACE_ENABLED == 1 static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, char *dataType, int32_t dataLen, char **ptr) { @@ -5551,6 +5554,7 @@ static int32_t prepareStbStmt(SSuperTable *stbInfo, return k; } +#endif static int32_t generateStbProgressiveData( SSuperTable *superTblInfo, @@ -5738,6 +5742,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { int32_t generated; if (superTblInfo) { if (superTblInfo->iface == STMT_IFACE) { +#if STMT_IFACE_ENABLED == 1 generated = prepareStbStmt(superTblInfo, pThreadInfo->stmt, tableName, @@ -5745,6 +5750,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { insertRows, i, startTime, pThreadInfo->buffer); +#else + generated = -1; +#endif } else { generated = generateStbInterlaceData( superTblInfo, @@ -5762,11 +5770,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { pThreadInfo->threadID, __func__, __LINE__, tableName, batchPerTbl, startTime); +#if STMT_IFACE_ENABLED == 1 generated = prepareStmtWithoutStb( pThreadInfo->stmt, tableName, batchPerTbl, insertRows, i, startTime); +#else + generated = -1; +#endif } else { generated = generateInterlaceDataWithoutStb( tableName, batchPerTbl, @@ -5947,12 +5959,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { int32_t generated; if (superTblInfo) { if (superTblInfo->iface == STMT_IFACE) { +#if STMT_IFACE_ENABLED == 1 generated = prepareStbStmt( superTblInfo, pThreadInfo->stmt, tableName, g_args.num_of_RPR, insertRows, i, start_time, pstr); +#else + generated = -1; +#endif } else { generated = generateStbProgressiveData( superTblInfo, @@ -5963,12 +5979,16 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { } } else { if (g_args.iface == STMT_IFACE) { +#if STMT_IFACE_ENABLED == 1 generated = prepareStmtWithoutStb( pThreadInfo->stmt, tableName, g_args.num_of_RPR, insertRows, i, start_time); +#else + generated = -1; +#endif } else { generated = generateProgressiveDataWithoutStb( tableName, -- GitLab