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