aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.h6
-rw-r--r--Source/SPDatabaseDocument.m5
-rw-r--r--Source/SPTablesList.h11
-rw-r--r--Source/SPTablesList.m298
4 files changed, 127 insertions, 193 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 614f66ed..b1d19600 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -350,11 +350,10 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS
- (IBAction)focusOnTableContentFilter:(id)sender;
- (IBAction)focusOnTableListFilter:(id)sender;
- (IBAction)export:(id)sender;
-
- (IBAction)exportSelectedTablesAs:(id)sender;
// Other methods
-- (void) setQueryMode:(NSInteger)theQueryMode;
+- (void)setQueryMode:(NSInteger)theQueryMode;
- (IBAction)closeSheet:(id)sender;
- (IBAction)closePanelSheet:(id)sender;
- (void)doPerformQueryService:(NSString *)query;
@@ -376,7 +375,6 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS
- (void)setIsSavedInBundle:(BOOL)savedInBundle;
- (void)setFileURL:(NSURL *)fileURL;
- (void)connect;
-
- (void)showConsole:(id)sender;
- (IBAction)showNavigator:(id)sender;
- (IBAction)toggleNavigator:(id)sender;
@@ -456,7 +454,7 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS
- (NSDictionary*)shellVariables;
// State saving and setting
-- (NSDictionary *) stateIncludingDetails:(NSDictionary *)detailsToReturn;
+- (NSDictionary *)stateIncludingDetails:(NSDictionary *)detailsToReturn;
- (BOOL)setState:(NSDictionary *)stateDetails;
- (void)setStateFromConnectionFile:(NSString *)path;
- (void)restoreSession;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 37cae9ac..a0545fbc 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -1302,7 +1302,6 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
*/
- (void) endTask
{
-
// Ensure a call on the main thread
if (![NSThread isMainThread]) return [[self onMainThread] endTask];
@@ -5897,7 +5896,6 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
// that's why we can run this on main thread
[databaseStructureRetrieval queryDbStructureWithUserInfo:nil];
- // Delete was successful
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
[self setDatabases:self];
@@ -5905,9 +5903,10 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
-#ifndef SP_REFACTOR
+#ifndef SP_REFACTOR /* ui */
[self updateWindowTitle:self];
#endif
+
#ifdef SP_REFACTOR /* glue */
if ( delegate && [delegate respondsToSelector:@selector(refreshDatabasePopup)] )
[delegate performSelector:@selector(refreshDatabasePopup) withObject:nil];
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index efc724f9..897fb6b3 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -139,10 +139,10 @@
// IBAction methods
- (IBAction)updateTables:(id)sender;
-
- (IBAction)addTable:(id)sender;
- (IBAction)closeSheet:(id)sender;
- (IBAction)removeTable:(id)sender;
+
#ifndef SP_REFACTOR /* method decls */
- (IBAction)copyTable:(id)sender;
- (IBAction)renameTable:(id)sender;
@@ -150,9 +150,11 @@
- (IBAction)openTableInNewTab:(id)sender;
- (IBAction)togglePaneCollapse:(id)sender;
#endif
+
// Additional methods
- (void)setConnection:(SPMySQLConnection *)theConnection;
- (void)setSelectionState:(NSDictionary *)selectionDetails;
+
#ifndef SP_REFACTOR /* method decls */
- (void)selectTableAtIndex:(NSNumber *)row;
- (void)makeTableListFilterHaveFocus;
@@ -183,9 +185,9 @@
- (BOOL)selectItemsWithNames:(NSArray *)theNames;
// Table list filter interaction
-- (void) showFilter;
-- (void) hideFilter;
-- (void) clearFilter;
+- (void)showFilter;
+- (void)hideFilter;
+- (void)clearFilter;
#endif
- (IBAction) updateFilter:(id)sender;
@@ -214,5 +216,6 @@
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView;
- (void)setDatabaseDocument:(SPDatabaseDocument*)val;
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
+
#endif
@end
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index f09e27fb..690b30d9 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -98,6 +98,83 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
#endif
#pragma mark -
+#pragma mark Initialisation
+
+/**
+ * Standard init method. Performs various ivar initialisations.
+ */
+- (id)init
+{
+ if ((self = [super init])) {
+ tables = [[NSMutableArray alloc] init];
+ filteredTables = tables;
+ tableTypes = [[NSMutableArray alloc] init];
+ filteredTableTypes = tableTypes;
+ isTableListFiltered = NO;
+ tableListIsSelectable = YES;
+ tableListContainsViews = NO;
+ selectedTableType = SPTableTypeNone;
+ selectedTableName = nil;
+#ifndef SP_REFACTOR
+ [tables addObject:NSLocalizedString(@"TABLES", @"header for table list")];
+
+ smallSystemFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
+#endif
+ }
+
+ return self;
+}
+
+/**
+ * Standard awakeFromNib method for interface loading.
+ */
+- (void)awakeFromNib
+{
+#ifndef SP_REFACTOR
+ // Collapse the table information pane if preference to do so is set
+ if ([[[NSUserDefaults standardUserDefaults] objectForKey:SPTableInformationPanelCollapsed] boolValue]
+ && [tableListSplitView collapsibleSubview]) {
+ [tableInfoCollapseButton setNextState];
+ [tableInfoCollapseButton setToolTip:NSLocalizedString(@"Show Table Information",@"Show Table Information")];
+ [tableListSplitView setValue:[NSNumber numberWithFloat:[tableListSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
+ [[tableListSplitView collapsibleSubview] setAutoresizesSubviews:NO];
+ [[tableListSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListSplitView collapsibleSubview].frame.size.width, 0)];
+ [tableListSplitView setCollapsibleSubviewCollapsed:YES];
+ [[tableListSplitView collapsibleSubview] setAutoresizesSubviews:YES];
+ }
+ else {
+ [tableInfoCollapseButton setToolTip:NSLocalizedString(@"Hide Table Information",@"Hide Table Information")];
+ }
+
+ // Start the table filter list collapsed
+ if ([tableListFilterSplitView collapsibleSubview]) {
+ [tableListFilterSplitView setValue:[NSNumber numberWithFloat:[tableListFilterSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
+ // Set search bar view to the height of 1 instead of 0 to ensure that the view will be visible
+ // after opening a next connection window which has more than 20 tables
+ [[tableListFilterSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListFilterSplitView collapsibleSubview].frame.size.width, 1)];
+ [tableListFilterSplitView setCollapsibleSubviewCollapsed:YES];
+ }
+
+ // Disable tab edit behaviour in the tables list
+ [tablesListView setTabEditingDisabled:YES];
+#endif
+
+ // Add observers for document task activity
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(startDocumentTaskForTab:)
+ name:SPDocumentTaskStartNotification
+ object:tableDocumentInstance];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(endDocumentTaskForTab:)
+ name:SPDocumentTaskEndNotification
+ object:tableDocumentInstance];
+
+#ifndef SP_REFACTOR
+ [tablesListView registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, nil]];
+#endif
+}
+
+#pragma mark -
#pragma mark IBAction methods
/**
@@ -215,58 +292,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
}
}
-#endif /*
- BOOL addedPFHeader = FALSE;
- NSString *pQuery = [NSString stringWithFormat:@"SHOW PROCEDURE STATUS WHERE db = '%@'",[tableDocumentInstance database]];
- theResult = [mySQLConnection queryString:pQuery];
-
- if( [theResult numOfRows] ) {
- // add the header row
- [tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeNone]];
- addedPFHeader = TRUE;
- [theResult dataSeek:0];
-
- if( [theResult numOfFields] == 1 ) {
- for( i = 0; i < [theResult numOfRows]; i++ ) {
- [tables addObject:[[theResult fetchRowAsArray] objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeProc]];
- }
- } else {
- for( i = 0; i < [theResult numOfRows]; i++ ) {
- resultRow = [theResult fetchRowAsArray];
- [tables addObject:[resultRow objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeProc]];
- }
- }
- }
-
- pQuery = [NSString stringWithFormat:@"SHOW FUNCTION STATUS WHERE db = '%@'",[tableDocumentInstance database]];
- theResult = [mySQLConnection queryString:pQuery];
-
- if( [theResult numOfRows] ) {
- if( !addedPFHeader ) {
- // add the header row
- [tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeNone]];
- }
- [theResult dataSeek:0];
-
- if( [theResult numOfFields] == 1 ) {
- for( i = 0; i < [theResult numOfRows]; i++ ) {
- [tables addObject:[[theResult fetchRowAsArray] objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeFunc]];
- }
- } else {
- for( i = 0; i < [theResult numOfRows]; i++ ) {
- resultRow = [theResult fetchRowAsArray];
- [tables addObject:[resultRow objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeFunc]];
- }
- }
- }
- */
-
+#endif
+
// Restore encoding if appropriate
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
@@ -570,38 +597,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if (![[self tableName] length]) return;
[tablesListView editColumn:0 row:[tablesListView selectedRow] withEvent:nil select:YES];
-
- /*
-
- [tableRenameField setStringValue:[self tableName]];
- [renameTableButton setEnabled:NO];
-
- NSString *tableType;
-
- switch([self tableType]){
- case SPTableTypeTable:
- tableType = NSLocalizedString(@"table",@"table");
- break;
- case SPTableTypeView:
- tableType = NSLocalizedString(@"view",@"view");
- break;
- case SPTableTypeProc:
- tableType = NSLocalizedString(@"procedure",@"procedure");
- break;
- case SPTableTypeFunc:
- tableType = NSLocalizedString(@"function",@"function");
- break;
- }
-
- [tableRenameText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Rename %@ '%@' to:",@"rename item name to:"), tableType, [self tableName]]];
-
-
- [NSApp beginSheet:tableRenameSheet
- modalForWindow:[tableDocumentInstance parentWindow]
- modalDelegate:self
- didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
- contextInfo:@"renameTable"];
- */
}
/**
@@ -689,10 +684,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Order out current sheet to suppress overlapping of sheets
- if ([sheet respondsToSelector:@selector(orderOut:)])
+ if ([sheet respondsToSelector:@selector(orderOut:)]) {
[sheet orderOut:nil];
- else if ([sheet respondsToSelector:@selector(window)])
+ }
+ else if ([sheet respondsToSelector:@selector(window)]) {
[[sheet window] orderOut:nil];
+ }
if ([contextInfo isEqualToString:SPAddRow]) {
alertSheetOpened = NO;
@@ -733,6 +730,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
- (void)setConnection:(SPMySQLConnection *)theConnection
{
mySQLConnection = theConnection;
+
[self updateTables:self];
}
@@ -1113,11 +1111,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
#endif
}
-
#pragma mark -
#pragma mark Getter methods
-
- (NSArray *)selectedTableNames
{
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
@@ -1201,6 +1197,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
return returnArray;
}
+
- (NSArray *)allTableNames
{
NSMutableArray *returnArray = [NSMutableArray array];
@@ -1212,6 +1209,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
return returnArray;
}
+
- (NSArray *)allViewNames
{
NSMutableArray *returnArray = [NSMutableArray array];
@@ -1224,6 +1222,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[returnArray sortUsingSelector:@selector(compare:)];
return returnArray;
}
+
- (NSArray *)allProcedureNames
{
NSMutableArray *returnArray = [NSMutableArray array];
@@ -1276,11 +1275,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
return tableTypes;
}
-
#pragma mark -
#pragma mark Setter methods
-
/**
* Select an item using the provided name; returns YES if the
* supplied name could be selected, or NO if not.
@@ -1459,7 +1456,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
*/
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
-
// During imports the table view sometimes appears to request items beyond the end of the array.
// Using a hinted noteNumberOfRowsChanged after dropping tables fixes this but then seems to stick
// even after override, so check here for the time being and display empty rows during import.
@@ -1721,7 +1717,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[aCell setFont:smallSystemFont];
}
- } else {
+ }
+ else {
[aCell setImage:nil];
[aCell setIndentationLevel:0];
}
@@ -1849,7 +1846,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
*/
- (IBAction) updateFilter:(id)sender
{
-
// Don't try and maintain selections of multiple rows through filtering
if ([tablesListView numberOfSelectedRows] > 1) {
[tablesListView deselectAll:self];
@@ -1918,7 +1914,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
isTableListFiltered = YES;
- } else if (isTableListFiltered) {
+ }
+ else if (isTableListFiltered) {
isTableListFiltered = NO;
[filteredTables release];
#endif
@@ -1961,7 +1958,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
/**
* Disable all table list interactive elements during an ongoing task.
*/
-- (void) startDocumentTaskForTab:(NSNotification *)aNotification
+- (void)startDocumentTaskForTab:(NSNotification *)aNotification
{
tableListIsSelectable = NO;
[toolbarAddButton setEnabled:NO];
@@ -1974,7 +1971,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
/**
* Enable all table list interactive elements after an ongoing task.
*/
-- (void) endDocumentTaskForTab:(NSNotification *)aNotification
+- (void)endDocumentTaskForTab:(NSNotification *)aNotification
{
tableListIsSelectable = YES;
[toolbarAddButton setEnabled:YES];
@@ -1987,7 +1984,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
/**
* Set the table list to selectable or not during the task process.
*/
-- (void) setTableListSelectability:(BOOL)isSelectable
+- (void)setTableListSelectability:(BOOL)isSelectable
{
tableListIsSelectable = isSelectable;
}
@@ -2006,77 +2003,14 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
#pragma mark -
#pragma mark Other
-/**
- * Standard init method. Performs various ivar initialisations.
- */
-- (id)init
+#ifdef SP_REFACTOR /* glue */
+- (void)setDatabaseDocument:(SPDatabaseDocument*)val
{
- if ((self = [super init])) {
- tables = [[NSMutableArray alloc] init];
- filteredTables = tables;
- tableTypes = [[NSMutableArray alloc] init];
- filteredTableTypes = tableTypes;
- isTableListFiltered = NO;
- tableListIsSelectable = YES;
- tableListContainsViews = NO;
- selectedTableType = SPTableTypeNone;
- selectedTableName = nil;
-#ifndef SP_REFACTOR
- [tables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
- smallSystemFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
-#endif
- }
-
- return self;
+ tableDocumentInstance = val;
}
-
-/**
- * Standard awakeFromNib method for interface loading.
- */
-- (void)awakeFromNib
-{
-#ifndef SP_REFACTOR
- // Collapse the table information pane if preference to do so is set
- if ([[[NSUserDefaults standardUserDefaults] objectForKey:SPTableInformationPanelCollapsed] boolValue]
- && [tableListSplitView collapsibleSubview]) {
- [tableInfoCollapseButton setNextState];
- [tableInfoCollapseButton setToolTip:NSLocalizedString(@"Show Table Information",@"Show Table Information")];
- [tableListSplitView setValue:[NSNumber numberWithFloat:[tableListSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
- [[tableListSplitView collapsibleSubview] setAutoresizesSubviews:NO];
- [[tableListSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListSplitView collapsibleSubview].frame.size.width, 0)];
- [tableListSplitView setCollapsibleSubviewCollapsed:YES];
- [[tableListSplitView collapsibleSubview] setAutoresizesSubviews:YES];
- } else {
- [tableInfoCollapseButton setToolTip:NSLocalizedString(@"Hide Table Information",@"Hide Table Information")];
- }
-
- // Start the table filter list collapsed
- if ([tableListFilterSplitView collapsibleSubview]) {
- [tableListFilterSplitView setValue:[NSNumber numberWithFloat:[tableListFilterSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
- // Set search bar view to the height of 1 instead of 0 to ensure that the view will be visible
- // after opening a next connection window which has more than 20 tables
- [[tableListFilterSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListFilterSplitView collapsibleSubview].frame.size.width, 1)];
- [tableListFilterSplitView setCollapsibleSubviewCollapsed:YES];
- }
-
- // Disable tab edit behaviour in the tables list
- [tablesListView setTabEditingDisabled:YES];
#endif
- // Add observers for document task activity
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(startDocumentTaskForTab:)
- name:SPDocumentTaskStartNotification
- object:tableDocumentInstance];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(endDocumentTaskForTab:)
- name:SPDocumentTaskEndNotification
- object:tableDocumentInstance];
-
-#ifndef SP_REFACTOR
- [tablesListView registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, nil]];
-#endif
-}
+#pragma mark -
/**
* Standard dealloc method.
@@ -2096,14 +2030,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[super dealloc];
}
-
-#ifdef SP_REFACTOR /* glue */
-- (void)setDatabaseDocument:(SPDatabaseDocument*)val
-{
- tableDocumentInstance = val;
-}
-#endif
-
+#pragma mark -
+#pragma mark Private API
/**
* Removes the selected object (table, view, procedure, function, etc.) from the database and tableView.
@@ -2229,12 +2157,11 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[filteredTables objectAtIndex:currentIndex], [mySQLConnection lastErrorMessage]]];
[alert setAlertStyle:NSCriticalAlertStyle];
- // NSArray *buttons = [alert buttons];
- // // Change the alert's cancel button to have the key equivalent of return
- // [[buttons objectAtIndex:0] setKeyEquivalent:@"t"];
- // [[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
- // [[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];
- [alert beginSheetModalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"truncateTableError"];
+
+ [alert beginSheetModalForWindow:[tableDocumentInstance parentWindow]
+ modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo:@"truncateTableError"];
}
// Get next index (beginning from the end)
@@ -2258,7 +2185,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[NSThread detachNewThreadSelector:@selector(_addTable) toTarget:self withObject:nil];
return;
}
+
NSAutoreleasePool *tableAdditionPool = [[NSAutoreleasePool alloc] init];
+
[tableDocumentInstance startTaskWithDescription:[NSString stringWithFormat:NSLocalizedString(@"Creating %@...", @"Creating table task string"), [tableNameField stringValue]]];
NSString *charSetStatement = @"";
@@ -2269,6 +2198,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Ensure the use of UTF8 when creating new tables
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
+
if (changeEncoding) {
[mySQLConnection storeEncodingForRestoration];
[mySQLConnection setEncoding:@"utf8"];
@@ -2277,7 +2207,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// If there is an encoding selected other than the default we must specify it in CREATE TABLE statement
if ([tableEncodingButton indexOfSelectedItem] > 0) {
NSString *encodingName = [[tableEncodingButton title] stringByMatching:@"\\((.*)\\)" capture:1L];
+
if (!encodingName) encodingName = @"utf8";
+
charSetStatement = [NSString stringWithFormat:@"DEFAULT CHARACTER SET %@", [encodingName backtickQuotedString]];
}
@@ -2341,8 +2273,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
#endif
// Query the structure of all databases in the background (mainly for completion)
- [NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:[tableDocumentInstance databaseStructureRetrieval] withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", nil]];
-
+ [NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:)
+ toTarget:[tableDocumentInstance databaseStructureRetrieval]
+ withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", nil]];
}
else {
// Error while creating new table
@@ -2352,14 +2285,15 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self,
@selector(sheetDidEnd:returnCode:contextInfo:), SPAddRow,
[NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to add the new table '%@'.\n\nMySQL said: %@", @"error adding new table informative message"), tableName, [mySQLConnection lastErrorMessage]]);
-
+
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
+
[[tablesListView onMainThread] reloadData];
}
// Clear table name
[[tableNameField onMainThread] setStringValue:@""];
-
+
[tableDocumentInstance endTask];
[tableAdditionPool release];
}