diff options
author | rowanbeentje <rowan@beent.je> | 2012-03-14 01:16:18 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-03-14 01:16:18 +0000 |
commit | 79eff5bf42154da8d7730e0e0159160f68ec4e16 (patch) | |
tree | 38db570f7c36fbe2995774fefa627f1b467a9371 /Source/SPTextView.m | |
parent | d5e20720cf7f991a691d9a03e7f895211b7c98ad (diff) | |
download | sequelpro-79eff5bf42154da8d7730e0e0159160f68ec4e16.tar.gz sequelpro-79eff5bf42154da8d7730e0e0159160f68ec4e16.tar.bz2 sequelpro-79eff5bf42154da8d7730e0e0159160f68ec4e16.zip |
Final feature work on the SPMySQL branch before merging:
- Add a ping keepalive managing object to prevent retain cycles from the NSTimer
- Add -[SPMySQLConnection copy] support
- Refactor Hans-Jörg Bibiko's database structure retrieval, moving it out of the MySQL framework and building it around a copy of the connection. This reduces the amount of connections-over-time used by Sequel Pro to two constant connections (addressing Issue #1097) and improves robustness.
- Use the database structure retrieval connection for faster query cancellation without an extra connection required, if possible
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r-- | Source/SPTextView.m | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m index b3db1b30..73e45c88 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -37,6 +37,7 @@ #import "SPDatabaseViewController.h" #import "SPAppController.h" #import "SPMySQL.h" +#import "SPDatabaseStructure.h" #pragma mark - #pragma mark lex init @@ -825,7 +826,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) NSString *theDb = (dbName == nil) ? [NSString stringWithString:currentDb] : [NSString stringWithString:dbName]; NSString *connectionID = [tableDocumentInstance connectionID]; NSString *conID = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, theDb]; - NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[mySQLConnection getDbStructure] objectForKey:connectionID]]; + NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[[tableDocumentInstance databaseStructureRetrieval] structure] objectForKey:connectionID]]; if(theDb && dbs != nil && [dbs count] && [dbs objectForKey:conID] && [[dbs objectForKey:conID] isKindOfClass:[NSDictionary class]]) { NSArray *allTables = [[dbs objectForKey:conID] allKeys]; // Check if found table name is known, if not parse for aliases @@ -887,7 +888,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) autoComplete:autoCompleteMode oneColumn:isDictMode alias:alias - isQueryingDBStructure:[mySQLConnection isQueryingDatabaseStructure]]; + withDBStructureRetriever:[tableDocumentInstance databaseStructureRetrieval]]; completionParseRangeLocation = parseRange.location; @@ -1452,7 +1453,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) if (tablesListInstance && [tablesListInstance tableName]) currentTable = [tablesListInstance tableName]; - NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[mySQLConnection getDbStructure] objectForKey:connectionID]]; + NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[[tableDocumentInstance databaseStructureRetrieval] structure] objectForKey:connectionID]]; if(currentDb != nil && currentTable != nil && dbs != nil && [dbs count] && [dbs objectForKey:currentDb] && [[dbs objectForKey:currentDb] objectForKey:currentTable]) { NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:currentTable]; NSArray *allFields = [theTable allKeys]; @@ -1524,7 +1525,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) autoComplete:NO oneColumn:NO alias:nil - isQueryingDBStructure:NO]; + withDBStructureRetriever:nil]; //Get the NSPoint of the first character of the current word NSRange glyphRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(aRange.location,1) actualCharacterRange:NULL]; @@ -1681,7 +1682,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) autoComplete:NO oneColumn:YES alias:nil - isQueryingDBStructure:NO]; + withDBStructureRetriever:nil]; //Get the NSPoint of the first character of the current word NSRange glyphRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(r2.location,1) actualCharacterRange:NULL]; |