2016-02-27 14:24:23 +01:00
|
|
|
#ifndef __SQLPARSERRESULT__
|
|
|
|
#define __SQLPARSERRESULT__
|
|
|
|
|
|
|
|
#include "sql/SQLStatement.h"
|
|
|
|
|
|
|
|
namespace hsql {
|
2017-02-08 02:33:42 +01:00
|
|
|
// Represents the result of the SQLParser.
|
|
|
|
// If parsing was successful it contains a list of SQLStatement.
|
2017-02-08 02:06:15 +01:00
|
|
|
class SQLParserResult {
|
|
|
|
public:
|
2017-02-08 02:33:42 +01:00
|
|
|
// Initialize with empty statement list.
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLParserResult();
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Initialize with a single statement.
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLParserResult(SQLStatement* stmt);
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Deletes all statements in the resul.
|
2017-02-08 02:06:15 +01:00
|
|
|
virtual ~SQLParserResult();
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:33:42 +01:00
|
|
|
// Returns the number of statements in the result.
|
|
|
|
size_t size();
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:33:42 +01:00
|
|
|
// Gets the SQL statement with the given index.
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLStatement* getStatement(int id);
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:33:42 +01:00
|
|
|
// Adds a statement to the result list of statements.
|
|
|
|
void addStatement(SQLStatement* stmt);
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:33:42 +01:00
|
|
|
// List of statements within the result.
|
2017-02-08 02:06:15 +01:00
|
|
|
std::vector<SQLStatement*> statements;
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Flag indicating the parsing was successful.
|
2017-02-08 02:06:15 +01:00
|
|
|
bool isValid;
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 02:33:42 +01:00
|
|
|
// Error message, if an error occurred.
|
2017-02-08 02:06:15 +01:00
|
|
|
const char* errorMsg;
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Line number of the occurrance of the error in the query.
|
2017-02-08 02:06:15 +01:00
|
|
|
int errorLine;
|
2017-02-08 02:33:42 +01:00
|
|
|
|
|
|
|
// Column number of the occurrance of the error in the query.
|
2017-02-08 02:06:15 +01:00
|
|
|
int errorColumn;
|
|
|
|
};
|
2016-02-27 14:24:23 +01:00
|
|
|
|
2016-02-27 14:45:59 +01:00
|
|
|
} // namespace hsql
|
2016-02-27 14:24:23 +01:00
|
|
|
|
|
|
|
#endif // __SQLPARSERRESULT__
|