diff options
-rw-r--r-- | Source/SPSQLParser.m | 28 | ||||
-rw-r--r-- | Source/TableContent.m | 1 | ||||
-rw-r--r-- | Source/TableDocument.m | 1 |
3 files changed, 10 insertions, 20 deletions
diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m index a2fb2026..0b968d0a 100644 --- a/Source/SPSQLParser.m +++ b/Source/SPSQLParser.m @@ -218,9 +218,14 @@ TO_BUFFER_STATE to_scan_string (const char *); { long stringIndex; NSString *resultString; - + + if (character != parsedToChar) { + parsedToChar = character; + parsedToPosition = -1; + } + // Get the first occurrence of the specified character, returning nil if it could not be found - stringIndex = [self firstOccurrenceOfCharacter:character ignoringQuotedStrings:ignoreQuotedStrings]; + stringIndex = [self firstOccurrenceOfCharacter:character afterIndex:parsedToPosition ignoringQuotedStrings:ignoreQuotedStrings]; if (stringIndex == NSNotFound) return nil; // Select the appropriate string range, truncate the current string, and return the selected string @@ -476,11 +481,7 @@ TO_BUFFER_STATE to_scan_string (const char *); */ - (long) firstOccurrenceOfCharacter:(unichar)character ignoringQuotedStrings:(BOOL)ignoreQuotedStrings { - if (character != parsedToChar) { - parsedToChar = character; - parsedToPosition = -1; - } - return [self firstOccurrenceOfCharacter:character afterIndex:parsedToPosition skippingBrackets:NO ignoringQuotedStrings:ignoreQuotedStrings]; + return [self firstOccurrenceOfCharacter:character afterIndex:-1 skippingBrackets:NO ignoringQuotedStrings:ignoreQuotedStrings]; } @@ -489,10 +490,6 @@ TO_BUFFER_STATE to_scan_string (const char *); */ - (long) firstOccurrenceOfCharacter:(unichar)character afterIndex:(long)startIndex ignoringQuotedStrings:(BOOL)ignoreQuotedStrings { - if (character != parsedToChar) { - parsedToChar = '\0'; - parsedToPosition = -1; - } return [self firstOccurrenceOfCharacter:character afterIndex:startIndex skippingBrackets:NO ignoringQuotedStrings:ignoreQuotedStrings]; } @@ -504,11 +501,6 @@ TO_BUFFER_STATE to_scan_string (const char *); long stringLength = [string length]; int bracketingLevel = 0; - if (character != parsedToChar) { - parsedToChar = character; - parsedToPosition = -1; - } - // Cache frequently used selectors, avoiding dynamic binding overhead IMP charAtIndex = [self methodForSelector:@selector(charAtIndex:)]; IMP endIndex = [self methodForSelector:@selector(endIndexOfStringQuotedByCharacter:startingAtIndex:)]; @@ -538,7 +530,7 @@ TO_BUFFER_STATE to_scan_string (const char *); if (!ignoreQuotedStrings) break; quotedStringEndIndex = (long)(*endIndex)(self, @selector(endIndexOfStringQuotedByCharacter:startingAtIndex:), currentCharacter, currentStringIndex+1); if (quotedStringEndIndex == NSNotFound) { - parsedToPosition = currentStringIndex; + parsedToPosition = stringLength - 1; return NSNotFound; } currentStringIndex = quotedStringEndIndex; @@ -903,8 +895,8 @@ TO_BUFFER_STATE to_scan_string (const char *); } - (id) initWithContentsOfFile:(id)path { parsedToChar = '\0'; - parsedToPosition = 0; parsedToPosition = -1; + charCacheEnd = -1; return [self initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; } - (id) initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)encoding error:(NSError **)error { diff --git a/Source/TableContent.m b/Source/TableContent.m index c9d69b31..f796eca6 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -511,7 +511,6 @@ // If we are using the BETWEEN operator and either of the argument fields are empty return nil. if ([[[compareField selectedItem] title] isEqualToString:@"BETWEEN"]) { if (([firstBetweenArgument length] == 0) || ([secondBetweenArgument length] == 0)) { - NSLog(@"reached"); return nil; } } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 84aad499..fab71faf 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2812,7 +2812,6 @@ */ - (void)willQueryString:(NSString *)query connection:(id)connection { - NSLog(@"Mode is %i, bool is %@", _queryMode, [prefs boolForKey:@"ConsoleEnableImportExportLogging"]?@"on":@"off"); if ([prefs boolForKey:@"ConsoleEnableLogging"]) { if ((_queryMode == SP_QUERYMODE_INTERFACE && [prefs boolForKey:@"ConsoleEnableInterfaceLogging"]) || (_queryMode == SP_QUERYMODE_CUSTOMQUERY && [prefs boolForKey:@"ConsoleEnableCustomQueryLogging"]) |