HyriseSQLParser/src/SQLParserResult.cpp

66 lines
1.3 KiB
C++
Raw Normal View History

2016-02-27 14:45:59 +01:00
#include "SQLParserResult.h"
namespace hsql {
SQLParserResult::SQLParserResult() :
2017-02-08 02:59:07 +01:00
isValid_(true),
errorMsg_(NULL) {};
2016-02-27 14:45:59 +01:00
SQLParserResult::SQLParserResult(SQLStatement* stmt) :
2017-02-08 02:59:07 +01:00
isValid_(true),
errorMsg_(NULL) {
addStatement(stmt);
};
2016-02-27 14:45:59 +01:00
SQLParserResult::~SQLParserResult() {
2017-02-08 02:59:07 +01:00
for (SQLStatement* statement : statements_) {
delete statement;
2016-02-27 15:01:06 +01:00
}
2016-02-27 14:45:59 +01:00
2017-02-08 02:59:07 +01:00
delete errorMsg_;
}
2016-02-27 14:45:59 +01:00
void SQLParserResult::addStatement(SQLStatement* stmt) {
2017-02-08 02:59:07 +01:00
statements_.push_back(stmt);
}
2016-02-27 14:45:59 +01:00
2017-02-08 02:59:07 +01:00
const SQLStatement* SQLParserResult::getStatement(int index) const {
return statements_[index];
}
2016-02-27 14:45:59 +01:00
2017-02-08 02:59:07 +01:00
SQLStatement* SQLParserResult::getMutableStatement(int index) {
return statements_[index];
}
size_t SQLParserResult::size() const {
return statements_.size();
}
bool SQLParserResult::isValid() const {
return isValid_;
}
const char* SQLParserResult::errorMsg() const {
return errorMsg_;
}
int SQLParserResult::errorLine() const {
return errorLine_;
}
int SQLParserResult::errorColumn() const {
return errorColumn_;
}
2016-02-27 15:01:06 +01:00
void SQLParserResult::setIsValid(bool isValid) {
isValid_ = isValid;
}
void SQLParserResult::setErrorDetails(const char* errorMsg, int errorLine, int errorColumn) {
errorMsg_ = errorMsg;
errorLine_ = errorLine;
errorColumn_ = errorColumn;
}
2016-02-27 14:45:59 +01:00
} // namespace hsql