2017-04-06 18:27:47 +02:00
|
|
|
#ifndef __SQLPARSER__SQLPARSER_H__
|
|
|
|
#define __SQLPARSER__SQLPARSER_H__
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2016-02-27 14:24:23 +01:00
|
|
|
#include "SQLParserResult.h"
|
|
|
|
#include "sql/statements.h"
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-31 18:36:02 +01:00
|
|
|
namespace hsql {
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Static methods used to parse SQL strings.
|
2017-02-08 02:06:15 +01:00
|
|
|
class SQLParser {
|
|
|
|
public:
|
2017-04-07 16:16:25 +02:00
|
|
|
// Parses a given constant character SQL string into the result object.
|
2017-04-08 02:37:30 +02:00
|
|
|
// Returns true if the lexer and parser could run without internal errors.
|
|
|
|
// This does NOT mean that the SQL string was valid SQL. To check that
|
|
|
|
// you need to check result->isValid();
|
2017-04-07 16:16:25 +02:00
|
|
|
static bool parseSQLString(const char* sql, SQLParserResult* result);
|
|
|
|
|
|
|
|
// Parses a given SQL string into the result object.
|
|
|
|
static bool parseSQLString(const std::string& sql, SQLParserResult* result);
|
|
|
|
|
2017-04-08 02:37:30 +02:00
|
|
|
// Deprecated:
|
2017-02-08 02:33:42 +01:00
|
|
|
// Parses a given constant character SQL string.
|
2017-04-07 16:16:25 +02:00
|
|
|
// Note: This is kept for legacy reasons. It is recommended to use
|
|
|
|
// the (const char*, SQLParserResult*) implementation.
|
2017-02-08 02:06:15 +01:00
|
|
|
static SQLParserResult* parseSQLString(const char* sql);
|
2017-02-08 02:33:42 +01:00
|
|
|
|
2017-04-08 02:37:30 +02:00
|
|
|
// Deprecated:
|
2017-02-08 02:33:42 +01:00
|
|
|
// Parses an SQL std::string.
|
2017-04-07 16:16:25 +02:00
|
|
|
// Note: This is kept for legacy reasons. It is recommended to use
|
|
|
|
// the (const std::string&, SQLParserResult*) implementation.
|
2017-02-08 02:06:15 +01:00
|
|
|
static SQLParserResult* parseSQLString(const std::string& sql);
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:06:15 +01:00
|
|
|
private:
|
2017-02-08 02:33:42 +01:00
|
|
|
// Static class can't be instatiated.
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLParser();
|
|
|
|
};
|
2016-02-27 14:24:23 +01:00
|
|
|
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-31 18:36:02 +01:00
|
|
|
} // namespace hsql
|
2014-10-09 01:30:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|