aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-14 19:34:40 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-14 19:34:40 +0000
commit0612652448f32e620a96e923a44b463fa1b9e0dc (patch)
treec77ff4cd7596aed10e445d0051620ecfbe295f7e /Source/TableDocument.m
parent6686223d2c30a7b99b8de11a8659851725f6326f (diff)
downloadsequelpro-0612652448f32e620a96e923a44b463fa1b9e0dc.tar.gz
sequelpro-0612652448f32e620a96e923a44b463fa1b9e0dc.tar.bz2
sequelpro-0612652448f32e620a96e923a44b463fa1b9e0dc.zip
• fix for completion in CustomQuery editor
- now the gathering of suggestions does not query the MySQL connection, instead it uses the TableList/TableDocument tableView data as a kind of cache - this approach should improve the speed for slow server connections TODO: auto-update for TableList and Database List resp. (it could happen that an other user changed the name of a table/db meanwhile)
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m32
1 files changed, 24 insertions, 8 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index f4383535..cbcc13b7 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -70,8 +70,9 @@
[printWebView setFrameLoadDelegate:self];
prefs = [NSUserDefaults standardUserDefaults];
+
}
-
+
return self;
}
@@ -349,12 +350,19 @@
[queryResult dataSeek:0];
}
- int i;
-
- for (i = 0 ; i < [queryResult numOfRows] ; i++)
- {
- [chooseDatabaseButton addItemWithTitle:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0)];
- }
+ // if([allDatabases count])
+ // [allDatabases removeAllObjects];
+
+ if(allDatabases)
+ [allDatabases release];
+
+ allDatabases = [[NSMutableArray alloc] initWithCapacity:[queryResult numOfRows]];
+
+ for (int i = 0 ; i < [queryResult numOfRows] ; i++)
+ [allDatabases addObject:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0)];
+
+ for (id db in allDatabases)
+ [chooseDatabaseButton addItemWithTitle:db];
(![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]];
}
@@ -494,6 +502,14 @@
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removedatabase"];
}
+/*
+ * Returns an array of all available database names
+ */
+- (NSArray *)allDatabaseNames
+{
+ return allDatabases;
+}
+
/**
* alert sheets method
* invoked when alertSheet get closed
@@ -2127,7 +2143,7 @@
[selectedDatabase release];
[mySQLVersion release];
[connectionController release];
-
+ [allDatabases release];
[super dealloc];
}