From a6c30d2c54b270b95b1abc59efef42b97174ed12 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 29 Oct 2009 12:49:22 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20issue:=20avoid=20executing=20of=20t?= =?UTF-8?q?he=20last=20query=20of=20a=20set=20of=20queries=20in=20the=20Qu?= =?UTF-8?q?ery=20Editor=20if=20the=20last=20query=20is=20empty=20or=20it?= =?UTF-8?q?=20is=20a=20"DELIMITER"=20statement=20to=20come=20up=20with=20t?= =?UTF-8?q?he=20result=20of=20the=20last=20valid=20query=20or=20to=20avoid?= =?UTF-8?q?=20an=20unnecessary=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPSQLParser.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Source') 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; } -- cgit v1.2.3