MCPcopy Create free account
hub / github.com/activeloopai/deeplake / parse

Method parse

cpp/3rd_party/sql-parser/src/SQLParser.cpp:13–35  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

11
12// static
13bool SQLParser::parse(const std::string& sql, SQLParserResult* result) {
14 yyscan_t scanner;
15 YY_BUFFER_STATE state;
16
17 if (hsql_lex_init(&scanner)) {
18 // Couldn't initialize the lexer.
19 fprintf(stderr, "SQLParser: Error when initializing lexer!\n");
20 return false;
21 }
22 const char* text = sql.c_str();
23 state = hsql__scan_string(text, scanner);
24
25 // Parse the tokens.
26 // If parsing fails, the result will contain an error object.
27 int ret = hsql_parse(result, scanner);
28 bool success = (ret == 0);
29 result->setIsValid(success);
30
31 hsql__delete_buffer(state, scanner);
32 hsql_lex_destroy(scanner);
33
34 return true;
35}
36
37// static
38bool SQLParser::parseSQLString(const char* sql, SQLParserResult* result) { return parse(sql, result); }

Callers 1

Calls 1

setIsValidMethod · 0.80

Tested by

no test coverage detected