Merge pull request #29205 from taosdata/fix/main/TD-33219
fix:[TD-33219]
This commit is contained in:
commit
7c9a60f713
|
@ -2201,6 +2201,11 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
||||||
if (code) {
|
if (code) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
code = stmtSetTbTags2(stmt, NULL);
|
||||||
|
if (code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindv->bind_cols && bindv->bind_cols[i]) {
|
if (bindv->bind_cols && bindv->bind_cols[i]) {
|
||||||
|
|
|
@ -1012,10 +1012,10 @@ int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags;
|
SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags;
|
||||||
if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
// if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
||||||
tscWarn("no tags or cols bound in sql, will not bound tags");
|
// tscWarn("no tags or cols bound in sql, will not bound tags");
|
||||||
return TSDB_CODE_SUCCESS;
|
// return TSDB_CODE_SUCCESS;
|
||||||
}
|
// }
|
||||||
|
|
||||||
STableDataCxt** pDataBlock =
|
STableDataCxt** pDataBlock =
|
||||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "taos.h"
|
#include "taos.h"
|
||||||
|
|
||||||
int CTB_NUMS = 1000;
|
int CTB_NUMS = 2;
|
||||||
int ROW_NUMS = 10;
|
int ROW_NUMS = 2;
|
||||||
int CYC_NUMS = 5;
|
int CYC_NUMS = 2;
|
||||||
|
|
||||||
void do_query(TAOS* taos, const char* sql) {
|
void do_query(TAOS* taos, const char* sql) {
|
||||||
TAOS_RES* result = taos_query(taos, sql);
|
TAOS_RES* result = taos_query(taos, sql);
|
||||||
|
@ -57,7 +57,7 @@ void do_stmt(TAOS* taos, const char* sql) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int fieldNum = 0;
|
int fieldNum = 0;
|
||||||
TAOS_FIELD_STB* pFields = NULL;
|
TAOS_FIELD_ALL* pFields = NULL;
|
||||||
// code = taos_stmt2_get_stb_fields(stmt, &fieldNum, &pFields);
|
// code = taos_stmt2_get_stb_fields(stmt, &fieldNum, &pFields);
|
||||||
// if (code != 0) {
|
// if (code != 0) {
|
||||||
// printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt));
|
// printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt));
|
||||||
|
@ -74,7 +74,7 @@ void do_stmt(TAOS* taos, const char* sql) {
|
||||||
for (int i = 0; i < CTB_NUMS; i++) {
|
for (int i = 0; i < CTB_NUMS; i++) {
|
||||||
tbs[i] = (char*)malloc(sizeof(char) * 20);
|
tbs[i] = (char*)malloc(sizeof(char) * 20);
|
||||||
sprintf(tbs[i], "ctb_%d", i);
|
sprintf(tbs[i], "ctb_%d", i);
|
||||||
createCtb(taos, tbs[i]);
|
// createCtb(taos, tbs[i]);
|
||||||
}
|
}
|
||||||
for (int r = 0; r < CYC_NUMS; r++) {
|
for (int r = 0; r < CYC_NUMS; r++) {
|
||||||
// col params
|
// col params
|
||||||
|
@ -138,7 +138,24 @@ void do_stmt(TAOS* taos, const char* sql) {
|
||||||
end = clock();
|
end = clock();
|
||||||
cpu_time_used = ((double)(end - start)) / CLOCKS_PER_SEC;
|
cpu_time_used = ((double)(end - start)) / CLOCKS_PER_SEC;
|
||||||
printf("stmt2-exec [%s] insert Time used: %f seconds\n", sql, cpu_time_used);
|
printf("stmt2-exec [%s] insert Time used: %f seconds\n", sql, cpu_time_used);
|
||||||
|
|
||||||
|
for (int i = 0; i < CTB_NUMS; i++) {
|
||||||
|
free(tags[i]);
|
||||||
|
free(paramv[i]);
|
||||||
|
free(ts[i]);
|
||||||
|
free(b[i]);
|
||||||
}
|
}
|
||||||
|
free(ts);
|
||||||
|
free(b);
|
||||||
|
free(ts_len);
|
||||||
|
free(b_len);
|
||||||
|
free(paramv);
|
||||||
|
free(tags);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < CTB_NUMS; i++) {
|
||||||
|
free(tbs[i]);
|
||||||
|
}
|
||||||
|
free(tbs);
|
||||||
|
|
||||||
// taos_stmt2_free_fields(stmt, pFields);
|
// taos_stmt2_free_fields(stmt, pFields);
|
||||||
taos_stmt2_close(stmt);
|
taos_stmt2_close(stmt);
|
||||||
|
@ -200,10 +217,9 @@ int main() {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(3);
|
|
||||||
do_stmt(taos, "insert into db.stb(tbname,ts,b,t1,t2) values(?,?,?,?,?)");
|
do_stmt(taos, "insert into db.stb(tbname,ts,b,t1,t2) values(?,?,?,?,?)");
|
||||||
// do_stmt(taos, "insert into db.? using db.stb tags(?,?)values(?,?)");
|
// do_stmt(taos, "insert into db.? using db.stb tags(?,?)values(?,?)");
|
||||||
do_taosc(taos);
|
// do_taosc(taos);
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue