aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-10-29 12:49:22 +0000
committerBibiko <bibiko@eva.mpg.de>2009-10-29 12:49:22 +0000
commita6c30d2c54b270b95b1abc59efef42b97174ed12 (patch)
tree3d51d875b539d0041c88f43639d3c197698e1d94 /Source
parente92cd4a8912a2f0fefe695bf389596e315a0643b (diff)
downloadsequelpro-a6c30d2c54b270b95b1abc59efef42b97174ed12.tar.gz
sequelpro-a6c30d2c54b270b95b1abc59efef42b97174ed12.tar.bz2
sequelpro-a6c30d2c54b270b95b1abc59efef42b97174ed12.zip
• fixed issue: avoid executing of the last query of a set of queries in the Query Editor if the last query is empty or it is a "DELIMITER" statement to come up with the result of the last valid query or to avoid an unnecessary error message
Diffstat (limited to 'Source')
-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;
}