aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPSQLParser.m11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m
index 4484c4c2..792d998e 100644
--- a/Source/SPSQLParser.m
+++ b/Source/SPSQLParser.m
@@ -432,9 +432,14 @@ TO_BUFFER_STATE to_scan_string (const char *);
stringIndex = nextIndex;
}
- // Add the end of the string after the previously matched character where appropriate.
- if (stringIndex + 1 < [string length])
- [resultsArray addObject:[string substringFromIndex:stringIndex + 1]];
+ // Add the end of the string after the previously matched character where appropriate
+ // if it does not contain only white space characters and if the last query is not a
+ // "delimiter" statement to avoid unnecessary error messages.
+ if (stringIndex + 1 < [string length]) {
+ NSString *lastQuery = [[string substringFromIndex:stringIndex + 1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ if([lastQuery length] && ![lastQuery isMatchedByRegex:@"(?i)^\\s*delimiter\\s+\\S+"])
+ [resultsArray addObject:lastQuery];
+ }
return resultsArray;
}