tname.h 2.2 KB
Newer Older
H
hjxilinx 已提交
1 2 3
#ifndef TDENGINE_NAME_H
#define TDENGINE_NAME_H

4 5
#include "os.h"
#include "taosmsg.h"
H
Haojun Liao 已提交
6
#include "tstoken.h"
7
#include "tvariant.h"
8 9 10 11 12 13 14 15 16 17 18

typedef struct SDataStatis {
  int16_t colId;
  int64_t sum;
  int64_t max;
  int64_t min;
  int16_t maxIndex;
  int16_t minIndex;
  int16_t numOfNull;
} SDataStatis;

H
hjxilinx 已提交
19
typedef struct SColumnInfoData {
20 21
  SColumnInfo info;
  void* pData;    // the corresponding block data in memory
H
hjxilinx 已提交
22
} SColumnInfoData;
23

24 25 26 27 28 29 30 31 32 33 34 35 36 37
#define TSDB_DB_NAME_T     1
#define TSDB_TABLE_NAME_T  2

#define T_NAME_ACCT     0x1u
#define T_NAME_DB       0x2u
#define T_NAME_TABLE    0x4u

typedef struct SName {
  uint8_t type;  //db_name_t, table_name_t
  char acctId[TSDB_ACCT_ID_LEN];
  char dbname[TSDB_DB_NAME_LEN];
  char tname[TSDB_TABLE_NAME_LEN];
} SName;

38
void extractTableName(const char *tableId, char *name);
H
hjxilinx 已提交
39 40 41

char* extractDBName(const char *tableId, char *name);

42
size_t tableIdPrefix(const char* name, char* prefix, int32_t len);
43

H
Haojun Liao 已提交
44
void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable);
H
Haojun Liao 已提交
45

H
Haojun Liao 已提交
46 47
SSchema tGetTableNameColumnSchema();

H
Haojun Liao 已提交
48
SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const char* name);
H
Haojun Liao 已提交
49

H
Haojun Liao 已提交
50
bool tscValidateTableNameLength(size_t len);
51

52
SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFilters);
H
Haojun Liao 已提交
53

54
SSchema tGetTbnameColumnSchema();
H
Haojun Liao 已提交
55

H
Haojun Liao 已提交
56 57 58 59 60 61 62 63 64 65 66 67
/**
 * check if the schema is valid or not, including following aspects:
 * 1. number of columns
 * 2. column types
 * 3. column length
 * 4. column names
 * 5. total length
 *
 * @param pSchema
 * @param numOfCols
 * @return
 */
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);

int32_t tNameExtractFullName(const SName* name, char* dst);
int32_t tNameLen(const SName* name);

SName* tNameDup(const SName* name);

bool tIsValidName(const SName* name);

const char* tNameGetTableName(const SName* name);

int32_t tNameGetDbName(const SName* name, char* dst);
int32_t tNameGetFullDbName(const SName* name, char* dst);

bool tNameIsEmpty(const SName* name);

void tNameAssign(SName* dst, const SName* src);

int32_t tNameFromString(SName* dst, const char* str, uint32_t type);

int32_t tNameSetAcctId(SName* dst, const char* acct);

int32_t tNameSetDbName(SName* dst, const char* acct, SStrToken* dbToken);
H
Haojun Liao 已提交
91

H
hjxilinx 已提交
92
#endif  // TDENGINE_NAME_H