/* * Copyright (c) 2019 TAOS Data, Inc. * * This program is free software: you can use, redistribute, and/or modify * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #ifndef _TD_PARSER_H_ #define _TD_PARSER_H_ #ifdef __cplusplus extern "C" { #endif #include "catalog.h" #include "common.h" struct SQueryStmtInfo; struct SInsertStmtInfo; /** * True will be returned if the input sql string is insert, false otherwise. * @param pStr sql string * @param length length of the sql string * @return */ bool qIsInsertSql(const char* pStr, size_t length); /** * Parse the sql statement and then return the SQueryStmtInfo as the result of bounded AST. * @param pSql sql string * @param length length of the sql string * @param id operator id, generated by uuid generator * @param msg extended error message if exists. * @return error code */ int32_t qParseQuerySql(const char* pStr, size_t length, struct SQueryStmtInfo** pQueryInfo, int64_t id, char* msg); /** * Parse the insert sql statement. * @param pStr sql string * @param length length of the sql string * @param pInsertParam data in binary format to submit to vnode directly. * @param id operator id, generated by uuid generator. * @param msg extended error message if exists to help avoid the problem in sql statement. * @return */ int32_t qParseInsertSql(const char* pStr, size_t length, struct SInsertStmtInfo** pInsertInfo, int64_t id, char* msg); /** * Convert a normal sql statement to only query tags information to enable that the subscribe client can be aware quickly of the true vgroup ids that * involved in the subscribe procedure. * @param pSql * @param length * @param pConvertSql * @return */ int32_t qParserConvertSql(const char* pStr, size_t length, char** pConvertSql); #ifdef __cplusplus } #endif #endif /*_TD_PARSER_H_*/