fix some error

This commit is contained in:
hzcheng 2020-03-04 03:14:13 +00:00
parent 532d4a26b7
commit 2b927cb78a
3 changed files with 29 additions and 29 deletions

View File

@ -3,34 +3,32 @@
#include "dataformat.h" #include "dataformat.h"
int32_t tdGetMaxDataRowSize(SSchema *pSchema) { int32_t tdGetMaxDataRowSize(SSchema *pSchema) {
int32_t nbytes = 0; int32_t nbytes = 0;
for (int32_t i = 0; i < TD_SCHEMA_NCOLS(pSchema); i++) for (int32_t i = 0; i < TD_SCHEMA_NCOLS(pSchema); i++) {
{ SColumn * pCol = TD_SCHEMA_COLUMN_AT(pSchema, i);
SColumn *pCol = TD_SCHEMA_COLUMN_AT(pSchema, i); td_datatype_t type = TD_COLUMN_TYPE(pCol);
td_datatype_t type = TD_COLUMN_TYPE(pCol);
nbytes += rowDataLen[type]; nbytes += rowDataLen[type];
switch (type) switch (type) {
{ case TD_DATATYPE_VARCHAR:
case TD_DATATYPE_VARCHAR: nbytes += TD_COLUMN_BYTES(pCol);
nbytes += TD_COLUMN_BYTES(pCol); break;
break; case TD_DATATYPE_NCHAR:
case TD_DATATYPE_NCHAR: nbytes += 4 * TD_COLUMN_BYTES(pCol);
nbytes += 4 * TD_COLUMN_BYTES(pCol); break;
break; case TD_DATATYPE_BINARY:
case TD_DATATYPE_BINARY: nbytes += TD_COLUMN_BYTES(pCol);
nbytes += TD_COLUMN_BYTES(pCol); break;
break; default:
} break;
} }
}
nbytes += TD_DATA_ROW_HEADER_SIZE; nbytes += TD_DATA_ROW_HEADER_SIZE;
return nbytes; return nbytes;
} }
SDataRow tdSDataRowDup(SDataRow rdata) { SDataRow tdSDataRowDup(SDataRow rdata) { return NULL; }
return NULL;
}

View File

@ -1,6 +1,8 @@
#include <stdlib.h>
#include "tsdbFile.h" #include "tsdbFile.h"
char *tsdbGetFileName(char *dirName, char *fname, TSDB_FILE_TYPE type){ char *tsdbGetFileName(char *dirName, char *fname, TSDB_FILE_TYPE type) {
// char *suffix = tsdbFileSuffix[type]; // TODO
// TODO return NULL;
} }

View File

@ -10,14 +10,14 @@
#define TSDB_MAX_TABLES 100000 #define TSDB_MAX_TABLES 100000
#define TSDB_DEFAULT_NSTABLES 10 #define TSDB_DEFAULT_NSTABLES 10
#define IS_VALID_MAX_TABLES(maxTables) (((maxTables) >= TSDB_MIN_TABLES) && ((maxTables) >= TSDB_MAX_TABLES)) #define IS_VALID_MAX_TABLES(maxTables) (((maxTables) >= TSDB_MIN_TABLES) && ((maxTables) <= TSDB_MAX_TABLES))
static int tsdbFreeTable(STable *pTable); static int tsdbFreeTable(STable *pTable);
static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
static STable *tsdbGetTableByUid(int64_t uid); static STable *tsdbGetTableByUid(int64_t uid);
static int tsdbAddTable(STsdbMeta *pMeta, STable *pTable); static int tsdbAddTable(STsdbMeta *pMeta, STable *pTable);
static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable); static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable);
static int tsdbAddTableIntoIndex(pMeta, pTable); static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
STsdbMeta *tsdbCreateMeta(int32_t maxTables) { STsdbMeta *tsdbCreateMeta(int32_t maxTables) {
if (!IS_VALID_MAX_TABLES(maxTables)) return NULL; if (!IS_VALID_MAX_TABLES(maxTables)) return NULL;
@ -176,7 +176,7 @@ static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable) {
// TODO: add the table to the map // TODO: add the table to the map
return 0; return 0;
} }
static int tsdbAddTableIntoIndex(pMeta, pTable) { static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) {
// TODO // TODO
return 0; return 0;
} }