Coverage Report

Created: 2026-06-09 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tdengine/source/libs/parser/inc/parInsertUtil.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15
16
#ifndef TDENGINE_PAR_INSERT_UTIL_H
17
#define TDENGINE_PAR_INSERT_UTIL_H
18
19
#include "parUtil.h"
20
21
struct SToken;
22
23
#define NEXT_TOKEN(pSql, sToken)                      \
24
0
  do {                                                \
25
0
    int32_t index = 0;                                \
26
0
    sToken = tStrGetToken(pSql, &index, false, NULL); \
27
0
    pSql += index;                                    \
28
0
  } while (0)
29
30
#define CHECK_CODE(expr)             \
31
  do {                               \
32
    int32_t code = expr;             \
33
    if (TSDB_CODE_SUCCESS != code) { \
34
      return code;                   \
35
    }                                \
36
  } while (0)
37
38
typedef struct SVgroupDataCxt {
39
  int32_t      vgId;
40
  SSubmitReq2 *pData;
41
} SVgroupDataCxt;
42
43
int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf);
44
int32_t insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname,
45
                            SArray *tagName, uint8_t tagNum, int32_t ttl);
46
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo);
47
void    insResetBoundColsInfo(SBoundColInfo *pInfo);
48
int32_t insInitColValues(STableMeta *pTableMeta, SArray *aColValues);
49
void    insCheckTableDataOrder(STableDataCxt *pTableCxt, SRowKey *rowKey);
50
int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta,
51
                           SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode, bool ignoreColVals);
52
int32_t initTableColSubmitData(STableDataCxt *pTableCxt);
53
int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks, bool isRebuild);
54
//int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, SArray** pVgDataBlocks, bool isRebuild, int32_t tbNum);
55
int32_t insBuildVgDataBlocks(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks, bool append);
56
void    insDestroyTableDataCxtHashMap(SHashObj *pTableCxtHash);
57
void    insDestroyTableDataCxtHashMapSml(SHashObj *pTableCxtHash);
58
void    insDestroyVgroupDataCxt(SVgroupDataCxt *pVgCxt);
59
void    insDestroyVgroupDataCxtList(SArray *pVgCxtList);
60
void    insDestroyVgroupDataCxtHashMap(SHashObj *pVgCxtHash);
61
void    insDestroyTableDataCxt(STableDataCxt *pTableCxt);
62
63
0
static FORCE_INLINE int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema) {
64
0
  while (start < end) {
65
0
    if (strncmp(pColname->z, pSchema[start].name, pColname->n) == 0 && pSchema[start].name[pColname->n] == '\0') {
66
0
      return start;
67
0
    }
68
0
    ++start;
69
0
  }
70
0
  return -1;
71
0
}
Unexecuted instantiation: parser.c:insFindCol
Unexecuted instantiation: parInsertSql.c:insFindCol
Unexecuted instantiation: parInsertUtil.c:insFindCol
Unexecuted instantiation: parInsertSml.c:insFindCol
72
73
#endif  // TDENGINE_PAR_INSERT_UTIL_H