fix TD-33419 and some CI problem
This commit is contained in:
parent
412c2efd33
commit
f1de713205
|
@ -853,7 +853,7 @@ static int stmtSetDbName2(TAOS_STMT2* stmt, const char* dbName) {
|
||||||
|
|
||||||
// The SQL statement specifies a database name, overriding the previously specified database
|
// The SQL statement specifies a database name, overriding the previously specified database
|
||||||
taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
|
taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
|
||||||
pStmt->exec.pRequest->pDb = taosStrdup(dbName);
|
pStmt->exec.pRequest->pDb = taosStrdup(pStmt->db);
|
||||||
if (pStmt->exec.pRequest->pDb == NULL) {
|
if (pStmt->exec.pRequest->pDb == NULL) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,10 +114,10 @@ void do_query(TAOS* taos, const char* sql) {
|
||||||
|
|
||||||
void do_stmt(TAOS* taos, TAOS_STMT2_OPTION* option, const char* sql, int CTB_NUMS, int ROW_NUMS, int CYC_NUMS,
|
void do_stmt(TAOS* taos, TAOS_STMT2_OPTION* option, const char* sql, int CTB_NUMS, int ROW_NUMS, int CYC_NUMS,
|
||||||
bool hastags, bool createTable) {
|
bool hastags, bool createTable) {
|
||||||
|
printf("%s\n", sql);
|
||||||
do_query(taos, "drop database if exists db");
|
do_query(taos, "drop database if exists db");
|
||||||
do_query(taos, "create database db");
|
do_query(taos, "create database db");
|
||||||
do_query(taos, "create table db.stb (ts timestamp, b binary(10)) tags(t1 int, t2 binary(10))");
|
do_query(taos, "create table db.stb (ts timestamp, b binary(10)) tags(t1 int, t2 binary(10))");
|
||||||
do_query(taos, "use db");
|
|
||||||
|
|
||||||
TAOS_STMT2* stmt = taos_stmt2_init(taos, option);
|
TAOS_STMT2* stmt = taos_stmt2_init(taos, option);
|
||||||
ASSERT_NE(stmt, nullptr);
|
ASSERT_NE(stmt, nullptr);
|
||||||
|
@ -818,14 +818,21 @@ TEST(stmt2Case, stmt2_init_prepare_Test) {
|
||||||
TEST(stmt2Case, stmt2_stb_insert) {
|
TEST(stmt2Case, stmt2_stb_insert) {
|
||||||
TAOS* taos = taos_connect("localhost", "root", "taosdata", "", 0);
|
TAOS* taos = taos_connect("localhost", "root", "taosdata", "", 0);
|
||||||
ASSERT_NE(taos, nullptr);
|
ASSERT_NE(taos, nullptr);
|
||||||
|
// normal insert into stb
|
||||||
TAOS_STMT2_OPTION option = {0, true, true, NULL, NULL};
|
TAOS_STMT2_OPTION option = {0, true, true, NULL, NULL};
|
||||||
{ do_stmt(taos, &option, "insert into db.stb (tbname,ts,b,t1,t2) values(?,?,?,?,?)", 3, 3, 3, true, true); }
|
{ do_stmt(taos, &option, "insert into db.stb (tbname,ts,b,t1,t2) values(?,?,?,?,?)", 3, 3, 3, true, true); }
|
||||||
|
// normal using
|
||||||
option = {0, true, true, stmtAsyncQueryCb, NULL};
|
option = {0, true, true, stmtAsyncQueryCb, NULL};
|
||||||
{ do_stmt(taos, &option, "insert into db.? using db.stb tags(?,?) values(?,?)", 3, 3, 3, true, true); }
|
{ do_stmt(taos, &option, "insert into db.? using db.stb tags(?,?) values(?,?)", 3, 3, 3, true, true); }
|
||||||
option = {0, false, false, NULL, NULL};
|
// `db`.`stb` is not a super table
|
||||||
|
option = {0, true, true, NULL, NULL};
|
||||||
|
{ do_stmt(taos, &option, "insert into `db`.`stb` (tbname,ts,b) values(?,?,?)", 3, 3, 3, false, true); }
|
||||||
|
// use db
|
||||||
|
do_query(taos, "use db");
|
||||||
|
option = {0, true, true, stmtAsyncQueryCb, NULL};
|
||||||
{ do_stmt(taos, &option, "insert into stb (tbname,ts,b,t1,t2) values(?,?,?,?,?)", 3, 3, 3, true, false); }
|
{ do_stmt(taos, &option, "insert into stb (tbname,ts,b,t1,t2) values(?,?,?,?,?)", 3, 3, 3, true, false); }
|
||||||
option = {0, true, true, NULL, NULL};
|
option = {0, true, true, NULL, NULL};
|
||||||
{ do_stmt(taos, &option, "insert into db.stb (tbname,ts,b) values(?,?,?)", 3, 3, 3, false, true); }
|
{ do_stmt(taos, &option, "insert into ? using stb (t1,t2)tags(?,?) (ts,b)values(?,?)", 3, 3, 3, true, false); }
|
||||||
|
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
}
|
}
|
||||||
|
@ -933,7 +940,7 @@ TEST(stmt2Case, stmt2_insert_non_statndard) {
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TD-33419
|
// TD-33419
|
||||||
TEST(stmt2Case, stmt2_insert_db) {
|
TEST(stmt2Case, stmt2_insert_db) {
|
||||||
TAOS* taos = taos_connect("localhost", "root", "taosdata", "", 0);
|
TAOS* taos = taos_connect("localhost", "root", "taosdata", "", 0);
|
||||||
ASSERT_NE(taos, nullptr);
|
ASSERT_NE(taos, nullptr);
|
||||||
|
@ -997,7 +1004,6 @@ TEST(stmt2Case, stmt2_query) {
|
||||||
do_query(taos,
|
do_query(taos,
|
||||||
"insert into db.tb2 using db.stb tags(2,'xyz') values(1591060628000, "
|
"insert into db.tb2 using db.stb tags(2,'xyz') values(1591060628000, "
|
||||||
"'abc'),(1591060628001,'def'),(1591060628002, 'hij')");
|
"'abc'),(1591060628001,'def'),(1591060628002, 'hij')");
|
||||||
do_query(taos, "use db");
|
|
||||||
|
|
||||||
TAOS_STMT2_OPTION option = {0, true, true, NULL, NULL};
|
TAOS_STMT2_OPTION option = {0, true, true, NULL, NULL};
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ int32_t insInitColValues(STableMeta *pTableMeta, SArray *aColValues);
|
||||||
void insCheckTableDataOrder(STableDataCxt *pTableCxt, SRowKey *rowKey);
|
void insCheckTableDataOrder(STableDataCxt *pTableCxt, SRowKey *rowKey);
|
||||||
int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta,
|
int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta,
|
||||||
SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode, bool ignoreColVals);
|
SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode, bool ignoreColVals);
|
||||||
int32_t initTableColSubmitDataWithBoundInfo(STableDataCxt *pTableCxt, SBoundColInfo pBoundColsInfo);
|
|
||||||
int32_t initTableColSubmitData(STableDataCxt *pTableCxt);
|
int32_t initTableColSubmitData(STableDataCxt *pTableCxt);
|
||||||
int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks, bool isRebuild);
|
int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks, bool isRebuild);
|
||||||
//int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, SArray** pVgDataBlocks, bool isRebuild, int32_t tbNum);
|
//int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, SArray** pVgDataBlocks, bool isRebuild, int32_t tbNum);
|
||||||
|
|
|
@ -1449,12 +1449,12 @@ int32_t initTableColSubmitData(STableDataCxt* pTableCxt) {
|
||||||
int32_t initTableColSubmitDataWithBoundInfo(STableDataCxt* pTableCxt, SBoundColInfo pBoundColsInfo) {
|
int32_t initTableColSubmitDataWithBoundInfo(STableDataCxt* pTableCxt, SBoundColInfo pBoundColsInfo) {
|
||||||
insDestroyBoundColInfo(&(pTableCxt->boundColsInfo));
|
insDestroyBoundColInfo(&(pTableCxt->boundColsInfo));
|
||||||
pTableCxt->boundColsInfo = pBoundColsInfo;
|
pTableCxt->boundColsInfo = pBoundColsInfo;
|
||||||
pTableCxt->boundColsInfo.pColIndex = taosMemoryCalloc(pBoundColsInfo.numOfBound - 1, sizeof(int16_t));
|
pTableCxt->boundColsInfo.pColIndex = taosMemoryCalloc(pBoundColsInfo.numOfBound, sizeof(int16_t));
|
||||||
if (NULL == pTableCxt->boundColsInfo.pColIndex) {
|
if (NULL == pTableCxt->boundColsInfo.pColIndex) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
(void)memcpy(pTableCxt->boundColsInfo.pColIndex, pBoundColsInfo.pColIndex,
|
(void)memcpy(pTableCxt->boundColsInfo.pColIndex, pBoundColsInfo.pColIndex,
|
||||||
sizeof(int16_t) * pBoundColsInfo.numOfBound - 1);
|
sizeof(int16_t) * pBoundColsInfo.numOfBound);
|
||||||
for (int32_t i = 0; i < pBoundColsInfo.numOfBound; ++i) {
|
for (int32_t i = 0; i < pBoundColsInfo.numOfBound; ++i) {
|
||||||
SSchema* pSchema = &pTableCxt->pMeta->schema[pTableCxt->boundColsInfo.pColIndex[i]];
|
SSchema* pSchema = &pTableCxt->pMeta->schema[pTableCxt->boundColsInfo.pColIndex[i]];
|
||||||
SColData* pCol = taosArrayReserve(pTableCxt->pData->aCol, 1);
|
SColData* pCol = taosArrayReserve(pTableCxt->pData->aCol, 1);
|
||||||
|
|
Loading…
Reference in New Issue