diff options
author | bamse16 <marius@marius.me.uk> | 2009-08-05 20:40:01 +0000 |
---|---|---|
committer | bamse16 <marius@marius.me.uk> | 2009-08-05 20:40:01 +0000 |
commit | 493fb09f6169864726be9909907fa1b84b3d0a21 (patch) | |
tree | 45fe791b118c8282dc6bc1718ac9be9c9ebc8df5 /Source/TableDump.m | |
parent | 4772138258627d959994b6a707f6440a75c618e9 (diff) | |
download | sequelpro-493fb09f6169864726be9909907fa1b84b3d0a21.tar.gz sequelpro-493fb09f6169864726be9909907fa1b84b3d0a21.tar.bz2 sequelpro-493fb09f6169864726be9909907fa1b84b3d0a21.zip |
Fix sortorder of tables in export multiple tables as CSV/XML accesory view
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r-- | Source/TableDump.m | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m index ccdda6ee..3d742b6f 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -36,6 +36,7 @@ #import "SPArrayAdditions.h" #import "RegexKitLite.h" + @implementation TableDump //IBAction methods @@ -52,15 +53,26 @@ queryResult = (MCPResult *)[mySQLConnection listTables]; if ([queryResult numOfRows]) [queryResult dataSeek:0]; + NSMutableArray *unsortedTables = [NSMutableArray array]; for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) { - [tables addObject:[NSMutableArray arrayWithObjects: - [NSNumber numberWithBool:YES], NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0), nil]]; + [unsortedTables addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]]; } + NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; + NSArray *sortedTables = [unsortedTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + [desc release]; + + for ( i = 0 ; i < [sortedTables count]; i++ ) { + [tables addObject: + [NSMutableArray arrayWithObjects: + [NSNumber numberWithBool:YES], + [sortedTables objectAtIndex:i], + nil]]; + } + [exportDumpTableView reloadData]; [exportMultipleCSVTableView reloadData]; [exportMultipleXMLTableView reloadData]; - } - (IBAction)selectTables:(id)sender |