aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-25 15:24:56 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-25 15:24:56 +0000
commit8d055c6df1d1590f97bd9e7c4834c05c706f27b7 (patch)
treeffbefdfe38f18be63a294465c6a6ca8426c8a76b /Frameworks
parent74cb1152eeb0dcc83f12ea6cf040eacc4e15c551 (diff)
downloadsequelpro-8d055c6df1d1590f97bd9e7c4834c05c706f27b7.tar.gz
sequelpro-8d055c6df1d1590f97bd9e7c4834c05c706f27b7.tar.bz2
sequelpro-8d055c6df1d1590f97bd9e7c4834c05c706f27b7.zip
• Navigator
- first implementation of a search functionality, workable but tiny issues have to be improved - up to now the only search implemented is 'contains', regexp/fuzzy search will come soon - the search is only performed in the main outline view, the upper one is static - for the new search store all available schema paths uniquely in an array which will be set during queryDbStructure (this avoids re-parsing of a dict structure)
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m22
2 files changed, 24 insertions, 0 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index 5fa3fe86..af38e99c 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -109,6 +109,7 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
NSString *serverVersionString;
NSDictionary *theDbStructure;
NSDictionary *uniqueDbIdentifier;
+ NSArray *allKeysofDbStructure;
NSTimer *keepAliveTimer;
pthread_t keepAliveThread;
@@ -238,6 +239,7 @@ void performThreadedKeepAlive(void *ptr);
- (void)queryDbStructure;
- (NSDictionary *)getDbStructure;
- (NSInteger)getUniqueDbIdentifierFor:(NSString*)term;
+- (NSArray *)getAllKeysOfDbStructure;
// Server information
- (NSString *)clientInfo;
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 0685d162..82772461 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -114,6 +114,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
keepAliveInterval = 60;
theDbStructure = nil;
+ allKeysofDbStructure = nil;
uniqueDbIdentifier = nil;
isQueryingDbStructure = NO;
@@ -428,6 +429,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
if (serverVersionString) [serverVersionString release], serverVersionString = nil;
if (theDbStructure) [theDbStructure release], theDbStructure = nil;
+ if (allKeysofDbStructure) [allKeysofDbStructure release], allKeysofDbStructure = nil;
if (uniqueDbIdentifier) [uniqueDbIdentifier release], uniqueDbIdentifier = nil;
if (pingThread != NULL) pthread_cancel(pingThread), pingThread = NULL;
}
@@ -1952,6 +1954,7 @@ void performThreadedKeepAlive(void *ptr)
if (mysql_real_query(structConnection, queryCString, queryCStringLength) == 0) {
theResult = mysql_use_result(structConnection);
NSMutableDictionary *structure = [NSMutableDictionary dictionary];
+ NSMutableSet *allKeys = [[NSMutableSet alloc] initWithCapacity:20];
NSMutableSet *namesSet = [[NSMutableSet alloc] initWithCapacity:20];
NSMutableArray *allDbNames = [NSMutableArray array];
NSMutableArray *allTableNames = [NSMutableArray array];
@@ -1991,6 +1994,9 @@ void performThreadedKeepAlive(void *ptr)
[namesSet addObject:[table lowercaseString]];
[allDbNames addObject:[db lowercaseString]];
[allTableNames addObject:[table lowercaseString]];
+ [allKeys addObject:db_id];
+ [allKeys addObject:table_id];
+ [allKeys addObject:field_id];
if(![[structure valueForKey:connectionID] valueForKey:db_id]) {
[[structure valueForKey:connectionID] setObject:[NSMutableDictionary dictionary] forKey:db_id];
@@ -2015,6 +2021,13 @@ void performThreadedKeepAlive(void *ptr)
}
theDbStructure = [[NSDictionary dictionaryWithDictionary:structure] retain];
+ if(allKeysofDbStructure != nil) {
+ [allKeysofDbStructure release];
+ allKeysofDbStructure = nil;
+ }
+ allKeysofDbStructure = [[NSArray arrayWithArray:[allKeys allObjects]] retain];
+ [allKeys release];
+
NSMutableDictionary *uniqueIdentifier = [NSMutableDictionary dictionary];
for(id name in namesSet) {
if([allDbNames containsObject:name] && [allTableNames containsObject:name]) {
@@ -2071,6 +2084,14 @@ void performThreadedKeepAlive(void *ptr)
return theDbStructure;
}
+/**
+ * Returns all keys of the db structure.
+ */
+- (NSArray *)getAllKeysOfDbStructure
+{
+ return allKeysofDbStructure;
+}
+
#pragma mark -
#pragma mark Server information
@@ -2492,6 +2513,7 @@ void performThreadedKeepAlive(void *ptr)
if (connectionPassword) [connectionPassword release];
if (serverVersionString) [serverVersionString release], serverVersionString = nil;
if (theDbStructure) [theDbStructure release], theDbStructure = nil;
+ if (allKeysofDbStructure) [allKeysofDbStructure release], allKeysofDbStructure = nil;
if (uniqueDbIdentifier) [uniqueDbIdentifier release], uniqueDbIdentifier = nil;
[super dealloc];