2016-02-27 14:24:23 +01:00
|
|
|
|
2016-02-27 14:45:59 +01:00
|
|
|
#include "SQLParserResult.h"
|
|
|
|
|
|
|
|
namespace hsql {
|
|
|
|
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLParserResult::SQLParserResult() :
|
2017-02-08 02:59:07 +01:00
|
|
|
isValid_(true),
|
|
|
|
errorMsg_(NULL) {};
|
2016-02-27 14:45:59 +01:00
|
|
|
|
2017-02-08 02:06:15 +01:00
|
|
|
SQLParserResult::SQLParserResult(SQLStatement* stmt) :
|
2017-02-08 02:59:07 +01:00
|
|
|
isValid_(true),
|
|
|
|
errorMsg_(NULL) {
|
2017-02-08 02:06:15 +01:00
|
|
|
addStatement(stmt);
|
|
|
|
};
|
2016-02-27 14:45:59 +01:00
|
|
|
|
2017-02-08 02:06:15 +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 04:56:07 +01:00
|
|
|
free(errorMsg_);
|
2017-02-08 02:06:15 +01:00
|
|
|
}
|
2016-02-27 14:45:59 +01:00
|
|
|
|
2017-02-08 02:06:15 +01:00
|
|
|
void SQLParserResult::addStatement(SQLStatement* stmt) {
|
2017-02-08 02:59:07 +01:00
|
|
|
statements_.push_back(stmt);
|
2017-02-08 02:06:15 +01:00
|
|
|
}
|
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];
|
2017-02-08 02:06:15 +01:00
|
|
|
}
|
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_;
|
2017-02-08 02:06:15 +01:00
|
|
|
}
|
2016-02-27 15:01:06 +01:00
|
|
|
|
2017-02-08 03:07:51 +01:00
|
|
|
void SQLParserResult::setIsValid(bool isValid) {
|
|
|
|
isValid_ = isValid;
|
|
|
|
}
|
|
|
|
|
2017-02-08 04:56:07 +01:00
|
|
|
void SQLParserResult::setErrorDetails(char* errorMsg, int errorLine, int errorColumn) {
|
2017-02-08 03:07:51 +01:00
|
|
|
errorMsg_ = errorMsg;
|
|
|
|
errorLine_ = errorLine;
|
|
|
|
errorColumn_ = errorColumn;
|
|
|
|
}
|
|
|
|
|
2016-02-27 14:45:59 +01:00
|
|
|
} // namespace hsql
|