diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 5a977b22e745e65b38aa5a47247e7aeadc62735d..ee6109858001c650d8f4327bb3e5eb602b5f63ce 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -41,8 +41,8 @@ int32_t tEncodeTSRow(SEncoder *pEncoder, const STSRow2 *pRow); int32_t tDecodeTSRow(SDecoder *pDecoder, STSRow2 *pRow); // STSchema -int32_t tTSchemaCreate(STSchema **ppTSchema); -int32_t tTSchemaDestroy(STSchema *pTSchema); +int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema); +void tTSchemaDestroy(STSchema *pTSchema); // STRUCT ================= struct STColumn { @@ -54,12 +54,12 @@ struct STColumn { }; struct STSchema { - int32_t numOfCols; - schema_ver_t version; - uint16_t flen; - int32_t vlen; - int32_t tlen; - STColumn columns[]; + int32_t numOfCols; + int32_t version; + int32_t flen; + int32_t vlen; + int32_t tlen; + STColumn columns[]; }; struct STSRow2 { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 558190a8ab5ade6a222c7e05a9693cd51c404b38..3f90fa36e6ef83355caf0bf4e4a0d5b77a0b100f 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -43,6 +43,19 @@ int32_t tDecodeTSRow(SDecoder *pDecoder, STSRow2 *pRow) { return 0; } +int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema) { + *ppTSchema = (STSchema *)taosMemoryMalloc(sizeof(STSchema) + sizeof(STColumn) * ncols); + if (*ppTSchema == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + // (*ppTSchema) + return 0; +} + +void tTSchemaDestroy(STSchema *pTSchema) { taosMemoryFree(pTSchema); } + #if 1 // ==================== static void dataColSetNEleNull(SDataCol *pCol, int nEle); int tdAllocMemForCol(SDataCol *pCol, int maxPoints) {