diff options
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 32 |
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]; } |