Merge pull request #32 from NanXiao/master

Check NULL value of result.
This commit is contained in:
Pedro Flemming 2017-04-07 15:33:48 +02:00 committed by GitHub
commit b843fe020e
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,10 @@ int main(int argc, char *argv[]) {
hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query); hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query);
// check whether the parsing was successful // check whether the parsing was successful
if (!result) {
return -1;
}
if (result->isValid()) { if (result->isValid()) {
printf("Parsed successfully!\n"); printf("Parsed successfully!\n");
printf("Number of statements: %lu\n", result->size()); printf("Number of statements: %lu\n", result->size());