Hotfix/sangshuduo/td 4892 taosdemo sub fetch for develop (#6635)

* fix crash if no result file.

* make taosdemo same as master branch.
This commit is contained in:
Shuduo Sang 2021-06-26 22:34:50 +08:00 committed by GitHub
parent 43e84f8bf0
commit 09ae4a83f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -1204,12 +1204,12 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) {
return ; return ;
} }
int totalLen = 0; int64_t totalLen = 0;
// fetch the records row by row // fetch the records row by row
while((row = taos_fetch_row(res))) { while((row = taos_fetch_row(res))) {
if ((strlen(pThreadInfo->filePath) > 0) if (totalLen >= 100*1024*1024 - 32000) {
&& (totalLen >= 100*1024*1024 - 32000)) { if (strlen(pThreadInfo->filePath) > 0)
appendResultBufToFile(databuf, pThreadInfo); appendResultBufToFile(databuf, pThreadInfo);
totalLen = 0; totalLen = 0;
memset(databuf, 0, 100*1024*1024); memset(databuf, 0, 100*1024*1024);
@ -1221,6 +1221,7 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) {
//printf("query result:%s\n", temp); //printf("query result:%s\n", temp);
memcpy(databuf + totalLen, temp, len); memcpy(databuf + totalLen, temp, len);
totalLen += len; totalLen += len;
debugPrint("totalLen: %"PRId64"\n", totalLen);
} }
verbosePrint("%s() LN%d, databuf=%s resultFile=%s\n", verbosePrint("%s() LN%d, databuf=%s resultFile=%s\n",