diff options
author | rowanbeentje <rowan@beent.je> | 2009-03-19 23:44:06 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-03-19 23:44:06 +0000 |
commit | ddf7d62d20614111acdd420075ef762d6deaa8d7 (patch) | |
tree | cf5ce70dde9c25d1b21da1cded5cee9f3e562704 /Source/SPSQLParser.h | |
parent | 4a8d0f731bbb03b9ace041d421800e5c6470326a (diff) | |
download | sequelpro-ddf7d62d20614111acdd420075ef762d6deaa8d7.tar.gz sequelpro-ddf7d62d20614111acdd420075ef762d6deaa8d7.tar.bz2 sequelpro-ddf7d62d20614111acdd420075ef762d6deaa8d7.zip |
SPSQLParser changes:
- Use method caches for oft-called functions, and support caching of chunks of the underlying string for string walking, resulting in an overall 1.3x-1.4x parsing speedup.
- Improve handling of multi-character comment starts (eg / or -) at the very end of strings
- When running splitString... methods return even empty strings for consistency.
- Update TableDump and TableData to match new usage
SPStringAddition changes:
- Add a formatter for time intervals.
CMMCPConnection changes:
- Add support for timing queries
CustomQuery and nib changes:
- Change the "Run Queries" button to "Run All".
- Add a "Run Current" button, which runs the query the text caret is currently positioned inside; if text is actually selected, this changes to "Run Selection". This addresses Issue #43.
- Amend the "rows affected" string to better reflect the actual number of rows altered by several queries, show the query count if > 1, and display the overall execution time of the queries. This addresses Issue #142.
- No longer execute blank strings as part of the custom query, preventing errors.
Diffstat (limited to 'Source/SPSQLParser.h')
-rw-r--r-- | Source/SPSQLParser.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/SPSQLParser.h b/Source/SPSQLParser.h index 14ac6f9d..3e68501c 100644 --- a/Source/SPSQLParser.h +++ b/Source/SPSQLParser.h @@ -23,6 +23,12 @@ #import <Cocoa/Cocoa.h> +/* + * Define the length of the character cache to use when parsing instead of accessing + * via characterAtIndex:. There is a balance here between updating the cache very + * often and access penalties; 1500 appears a reasonable compromise. + */ +#define CHARACTER_CACHE_LENGTH 1500 /* * This class provides a string class intended for SQL parsing. It extends NSMutableString, @@ -53,6 +59,9 @@ @interface SPSQLParser : NSMutableString { id string; + unichar *stringCharCache; + long charCacheStart; + long charCacheEnd; } @@ -210,6 +219,15 @@ typedef enum _SPCommentTypes { - (long) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(long)index; - (long) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(long)index; +/* + * Cacheing methods to enable a faster alternative to characterAtIndex: when walking strings, and overrides to update. + */ +- (unichar) charAtIndex:(long)index; +- (void) clearCharCache; +- (void) deleteCharactersInRange:(NSRange)aRange; +- (void) insertString:(NSString *)aString atIndex:(NSUInteger)anIndex; + + /* Required and primitive methods to allow subclassing class cluster */ #pragma mark - |