aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableData.m4
-rw-r--r--Source/TableDump.h3
-rw-r--r--Source/TableDump.m33
-rw-r--r--Source/TableSource.m42
4 files changed, 71 insertions, 11 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 1c00758a..9dffd962 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -668,7 +668,7 @@
if ([mySQLConnection isConnected]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
nil, nil, [NSApp mainWindow], self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving view information.\nMySQL said: %@", @"message of panel when retrieving view information failed"),
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
[mySQLConnection getLastErrorMessage]]);
}
return nil;
@@ -686,7 +686,7 @@
if ([mySQLConnection isConnected]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
nil, nil, [NSApp mainWindow], self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving view information.\nMySQL said: %@", @"message of panel when retrieving view information failed"),
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
[mySQLConnection getLastErrorMessage]]);
}
return nil;
diff --git a/Source/TableDump.h b/Source/TableDump.h
index 3b89bdc5..7e1dc5cc 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -105,12 +105,15 @@
NSInteger fieldMappingCurrentRow;
NSUserDefaults *prefs;
BOOL progressCancelled;
+
+ NSInteger fieldMapperSheetStatus;
}
// IBAction methods
- (IBAction)reloadTables:(id)sender;
- (IBAction)selectTables:(id)sender;
- (IBAction)closeSheet:(id)sender;
+- (IBAction)closeFieldMapperSheet:(id)sender;
- (IBAction)stepRow:(id)sender;
- (IBAction)cancelProgressBar:(id)sender;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 15a8c344..b6f71c2c 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -103,6 +103,15 @@
[exportMultipleXMLTableView reloadData];
}
+- (IBAction)closeFieldMapperSheet:(id)sender
+{
+
+ [NSApp endSheet:fieldMappingSheet returnCode:[sender tag]];
+ // [[self window] orderOut:self];
+ //
+ // [NSApp endSheet:fieldMappingSheet];
+}
+
/**
* Common method for ending modal sessions
*/
@@ -1190,23 +1199,29 @@
// Trigger a table selection and setup
[self changeTable:self];
+ fieldMapperSheetStatus = 1;
+
// Show fieldMapping sheet
[NSApp beginSheet:fieldMappingSheet
modalForWindow:tableWindow
modalDelegate:self
- didEndSelector:nil
+ didEndSelector:@selector(fieldMapperDidEndSheet:returnCode:contextInfo:)
contextInfo:nil];
- NSInteger code = [NSApp runModalForWindow:fieldMappingSheet];
- [NSApp endSheet:fieldMappingSheet];
- [fieldMappingSheet orderOut:nil];
+ // Wait for fieldMappingSheet
+ while (fieldMapperSheetStatus == 1)
+ usleep(100000);
- // Return success or failure based on confirmation or cancellation
- if (code) {
- return TRUE;
- } else {
+ if(fieldMapperSheetStatus == 2)
+ return YES;
+ else
return FALSE;
- }
+
+}
+- (void)fieldMapperDidEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+ [sheet orderOut:self];
+ fieldMapperSheetStatus = (returnCode) ? 2 : 3;
}
/*
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 1aa6185e..819bdea7 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -99,6 +99,27 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
//perform queries and load results in array (each row as a dictionary)
tableSourceResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]] retain];
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]];
+ [tableFields removeAllObjects];
+ [indexes removeAllObjects];
+ [tableSourceView reloadData];
+ [tablesListInstance updateTables:self];
+ [indexView reloadData];
+ [addFieldButton setEnabled:NO];
+ [copyFieldButton setEnabled:NO];
+ [removeFieldButton setEnabled:NO];
+ [addIndexButton setEnabled:NO];
+ [removeIndexButton setEnabled:NO];
+ [editTableButton setEnabled:NO];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
+ errorMessage]);
+ return;
+ }
+
[tableSourceResult setReturnDataAsStrings:YES];
// listFieldsFromTable is broken in the current version of the framework (no back-ticks for table name)!
@@ -108,6 +129,27 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
[tableSourceResult release];
indexResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEX FROM %@", [selectedTable backtickQuotedString]]] retain];
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]];
+ [tableFields removeAllObjects];
+ [indexes removeAllObjects];
+ [tableSourceView reloadData];
+ [tablesListInstance updateTables:self];
+ [indexView reloadData];
+ [addFieldButton setEnabled:NO];
+ [copyFieldButton setEnabled:NO];
+ [removeFieldButton setEnabled:NO];
+ [addIndexButton setEnabled:NO];
+ [removeIndexButton setEnabled:NO];
+ [editTableButton setEnabled:NO];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
+ errorMessage]);
+
+ return;
+ }
[indexResult setReturnDataAsStrings:YES];
// [indexes setArray:[[self fetchResultAsArray:indexResult] retain]];
[indexes setArray:[self fetchResultAsArray:indexResult]];