schema.h 853 字节
Newer Older
H
more  
Hongze Cheng 已提交
1 2 3 4 5
#if !defined(_TD_SCHEMA_H_)
#define _TD_SCHEMA_H_

#include <stdint.h>

H
more  
Hongze Cheng 已提交
6
#include "tstring.h"
H
more  
Hongze Cheng 已提交
7 8 9
#include "type.h"

typedef struct _scolumn {
H
more  
Hongze Cheng 已提交
10 11 12
  tstring_t colName;      // column name
  td_datatype_t type;     // data type
  int32_t bytes;          // number of bytes
H
more  
Hongze Cheng 已提交
13 14 15 16 17 18 19
} SColumn;

typedef struct SSchema {
  int32_t numOfCols;
  SColumn *columns;
} SSchema;

H
more  
Hongze Cheng 已提交
20 21
// Column with version
typedef struct {
H
more  
Hongze Cheng 已提交
22
  tstring_t colName;
H
more  
Hongze Cheng 已提交
23 24 25 26 27 28 29 30 31
  td_datatype_t type;
  int32_t colId;
  int32_t bytes;
} SVColumn;

// Schema with version
typedef struct {
  int32_t version;      // Schema with version
  int32_t numOfCols;
H
more  
Hongze Cheng 已提交
32
  int32_t numOfTags;
H
more  
Hongze Cheng 已提交
33 34 35 36 37 38 39 40 41
  SVColumn *columns;
} SVSchema;

int32_t tdAddColumnToSchema(tstring_t pSchema, SColumn col);

td_datatype_t tdGetTypeOfCol(SSchema *pSchema, int32_t col);
int32_t tdGetLengthOfCol(SSchema *pSchema, int32_t col);


H
more  
Hongze Cheng 已提交
42
#endif  // _TD_SCHEMA_H_