aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMTextView.m2
-rw-r--r--Source/TableDocument.h2
-rw-r--r--Source/TableDocument.m369
-rw-r--r--Source/TablesList.m17
4 files changed, 301 insertions, 89 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 7d140ccb..4a226ef5 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -1190,7 +1190,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if([selTables count])
[theHintString replaceCharactersInRange:r withString:[selTables componentsJoinedAndBacktickQuoted]];
else
- [theHintString replaceCharactersInRange:r withString:@"<tables>"];
+ [theHintString replaceCharactersInRange:r withString:@"$SP_SELECTED_TABLE"];
}
[theHintString flushCachedRegexData];
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 74aa3402..e897ed36 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -52,6 +52,7 @@
IBOutlet id statusTableAccessoryView;
IBOutlet id statusTableView;
+ IBOutlet id statusTableCopyChecksum;
IBOutlet SPUserManager *userManagerInstance;
@@ -243,6 +244,7 @@
- (IBAction)closePasswordSheet:(id)sender;
- (IBAction)backForwardInHistory:(id)sender;
- (IBAction)showUserManager:(id)sender;
+- (IBAction)copyChecksumFromSheet:(id)sender;
- (void)showConsole:(id)sender;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index d940e39a..69e3a337 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1929,8 +1929,6 @@
[alert setAccessoryView:statusTableAccessoryView];
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
}
-
-
}
/**
@@ -1938,17 +1936,26 @@
*/
- (IBAction)analyzeTable:(id)sender
{
- MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"ANALYZE TABLE %@", [[self table] backtickQuotedString]]];
+
+ NSArray *selectedItems = [tablesListInstance selectedTableItems];
+ id message = nil;
+
+ if([selectedItems count] == 0) return;
+
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"ANALYZE TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]];
+
+ NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]];
// Check for errors, only displaying if the connection hasn't been terminated
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to analyze selected items", @"unable to analyze selected items message") : NSLocalizedString(@"Unable to analyze table", @"unable to analyze table message");
if ([mySQLConnection isConnected]) {
- [[NSAlert alertWithMessageText:@"Unable to analyze table"
+ [[NSAlert alertWithMessageText:mText
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to analyze the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]]
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while analyzing the %@.\n\nMySQL said:%@",@"an error occurred while analyzing the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]]
beginSheetModalForWindow:tableWindow
modalDelegate:self
didEndSelector:NULL
@@ -1958,24 +1965,47 @@
return;
}
- // Process result
- NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
+ NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary];
+ BOOL statusOK = YES;
+ for(id res in result) {
+ if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) {
+ statusOK = NO;
+ break;
+ }
+ }
- NSString *message = @"";
+ // Process result
+ if([selectedItems count] == 1) {
+ message = @"";
- message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully analyzed table" : @"Analyze table failed.";
+ NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]];
+ message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully analyzed table.",@"analyze table successfully passed message") : NSLocalizedString(@"Analyze table failed.", @"analyze table failed message");
- [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Analyze table '%@'", [self table]]
- defaultButton:@"OK"
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:message]
- beginSheetModalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:NULL
- contextInfo:NULL];
+ message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]];
+ } else if(statusOK) {
+ message = NSLocalizedString(@"Successfully analyzed all selected items.",@"successfully analyzed all selected items message");
+ }
+
+ if(message) {
+ [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Analyze %@", what]
+ defaultButton:@"OK"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:message]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:NULL
+ contextInfo:NULL];
+ } else {
+ message = NSLocalizedString(@"MySQL said:",@"mysql said message");
+ statusValues = [result retain];
+ NSAlert *alert = [[NSAlert new] autorelease];
+ [alert setInformativeText:message];
+ [alert setMessageText:NSLocalizedString(@"Error while analyzing selected items", @"error while analyzing selected items message")];
+ [alert setAccessoryView:statusTableAccessoryView];
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
+ }
}
/**
@@ -1983,17 +2013,26 @@
*/
- (IBAction)optimizeTable:(id)sender
{
- MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"OPTIMIZE TABLE %@", [[self table] backtickQuotedString]]];
+
+ NSArray *selectedItems = [tablesListInstance selectedTableItems];
+ id message = nil;
+
+ if([selectedItems count] == 0) return;
+
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"OPTIMIZE TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]];
+
+ NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]];
// Check for errors, only displaying if the connection hasn't been terminated
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to optimze selected items", @"unable to optimze selected items message") : NSLocalizedString(@"Unable to optimze table", @"unable to optimze table message");
if ([mySQLConnection isConnected]) {
- [[NSAlert alertWithMessageText:@"Unable to optimize table"
+ [[NSAlert alertWithMessageText:mText
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to optimize the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]]
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while optimzing the %@.\n\nMySQL said:%@",@"an error occurred while trying to optimze the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]]
beginSheetModalForWindow:tableWindow
modalDelegate:self
didEndSelector:NULL
@@ -2003,24 +2042,47 @@
return;
}
+ NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary];
+ BOOL statusOK = YES;
+ for(id res in result) {
+ if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) {
+ statusOK = NO;
+ break;
+ }
+ }
+
// Process result
- NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
+ if([selectedItems count] == 1) {
+ message = @"";
- NSString *message = @"";
+ NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully optimized table" : @"Optimize table failed.";
+ message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully optimized table.",@"optimize table successfully passed message") : NSLocalizedString(@"Optimize table failed.", @"optimize table failed message");
- message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]];
+ message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]];
+ } else if(statusOK) {
+ message = NSLocalizedString(@"Successfully optimized all selected items.",@"successfully optimized all selected items message");
+ }
- [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Optimize table '%@'", [self table]]
- defaultButton:@"OK"
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:message]
- beginSheetModalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:NULL
- contextInfo:NULL];
+ if(message) {
+ [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Optimize %@", what]
+ defaultButton:@"OK"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:message]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:NULL
+ contextInfo:NULL];
+ } else {
+ message = NSLocalizedString(@"MySQL said:",@"mysql said message");
+ statusValues = [result retain];
+ NSAlert *alert = [[NSAlert new] autorelease];
+ [alert setInformativeText:message];
+ [alert setMessageText:NSLocalizedString(@"Error while optimizing selected items", @"error while optimizing selected items message")];
+ [alert setAccessoryView:statusTableAccessoryView];
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
+ }
}
/**
@@ -2028,17 +2090,25 @@
*/
- (IBAction)repairTable:(id)sender
{
- MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"REPAIR TABLE %@", [[self table] backtickQuotedString]]];
+ NSArray *selectedItems = [tablesListInstance selectedTableItems];
+ id message = nil;
+
+ if([selectedItems count] == 0) return;
+
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"REPAIR TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]];
+
+ NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]];
// Check for errors, only displaying if the connection hasn't been terminated
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to repair selected items", @"unable to repair selected items message") : NSLocalizedString(@"Unable to repair table", @"unable to repair table message");
if ([mySQLConnection isConnected]) {
- [[NSAlert alertWithMessageText:@"Unable to repair table"
+ [[NSAlert alertWithMessageText:mText
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to repair the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]]
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while repairing the %@.\n\nMySQL said:%@",@"an error occurred while trying to repair the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]]
beginSheetModalForWindow:tableWindow
modalDelegate:self
didEndSelector:NULL
@@ -2048,24 +2118,47 @@
return;
}
+ NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary];
+ BOOL statusOK = YES;
+ for(id res in result) {
+ if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) {
+ statusOK = NO;
+ break;
+ }
+ }
+
// Process result
- NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
+ if([selectedItems count] == 1) {
+ message = @"";
- NSString *message = @"";
+ NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully repaired table" : @"Repair table failed.";
+ message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully repaired table.",@"repair table successfully passed message") : NSLocalizedString(@"Repair table failed.", @"repair table failed message");
- message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]];
+ message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]];
+ } else if(statusOK) {
+ message = NSLocalizedString(@"Successfully repaired all selected items.",@"successfully repaired all selected items message");
+ }
- [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Repair table '%@'", [self table]]
- defaultButton:@"OK"
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:message]
- beginSheetModalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:NULL
- contextInfo:NULL];
+ if(message) {
+ [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Repair %@", what]
+ defaultButton:@"OK"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:message]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:NULL
+ contextInfo:NULL];
+ } else {
+ message = NSLocalizedString(@"MySQL said:",@"mysql said message");
+ statusValues = [result retain];
+ NSAlert *alert = [[NSAlert new] autorelease];
+ [alert setInformativeText:message];
+ [alert setMessageText:NSLocalizedString(@"Error while repairing selected items", @"error while repairing selected items message")];
+ [alert setAccessoryView:statusTableAccessoryView];
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
+ }
}
/**
@@ -2073,35 +2166,75 @@
*/
- (IBAction)flushTable:(id)sender
{
- [mySQLConnection queryString:[NSString stringWithFormat:@"FLUSH TABLE %@", [[self table] backtickQuotedString]]];
+ NSArray *selectedItems = [tablesListInstance selectedTableItems];
+ id message = nil;
+
+ if([selectedItems count] == 0) return;
+
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"FLUSH TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]];
+
+ NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]];
// Check for errors, only displaying if the connection hasn't been terminated
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to flush selected items", @"unable to flush selected items message") : NSLocalizedString(@"Unable to flush table", @"unable to flush table message");
if ([mySQLConnection isConnected]) {
- [[NSAlert alertWithMessageText:@"Unable to flush table"
+ [[NSAlert alertWithMessageText:mText
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to flush the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]]
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while flushing the %@.\n\nMySQL said:%@",@"an error occurred while trying to flush the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]]
beginSheetModalForWindow:tableWindow
modalDelegate:self
didEndSelector:NULL
- contextInfo:NULL];
+ contextInfo:NULL];
}
return;
}
- [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Flush table '%@'", [self table]]
- defaultButton:@"OK"
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:@"Table was successfully flushed"]
- beginSheetModalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:NULL
- contextInfo:NULL];
+ NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary];
+ BOOL statusOK = YES;
+ for(id res in result) {
+ if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) {
+ statusOK = NO;
+ break;
+ }
+ }
+
+ // Process result
+ if([selectedItems count] == 1) {
+ message = @"";
+
+ NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
+
+ message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully flushed table.",@"flush table successfully passed message") : NSLocalizedString(@"Flush table failed.", @"flush table failed message");
+
+ message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]];
+ } else if(statusOK) {
+ message = NSLocalizedString(@"Successfully flushed all selected items.",@"successfully flushed all selected items message");
+ }
+
+ if(message) {
+ [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Flush %@", what]
+ defaultButton:@"OK"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:message]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:NULL
+ contextInfo:NULL];
+ } else {
+ message = NSLocalizedString(@"MySQL said:",@"mysql said message");
+ statusValues = [result retain];
+ NSAlert *alert = [[NSAlert new] autorelease];
+ [alert setInformativeText:message];
+ [alert setMessageText:NSLocalizedString(@"Error while flushing selected items", @"error while flushing selected items message")];
+ [alert setAccessoryView:statusTableAccessoryView];
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
+ }
}
/**
@@ -2109,37 +2242,54 @@
*/
- (IBAction)checksumTable:(id)sender
{
- MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"CHECKSUM TABLE %@", [[self table] backtickQuotedString]]];
+ NSArray *selectedItems = [tablesListInstance selectedTableItems];
+ id message = nil;
+
+ if([selectedItems count] == 0) return;
+
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"CHECKSUM TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]];
+
+ NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]];
// Check for errors, only displaying if the connection hasn't been terminated
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
- [[NSAlert alertWithMessageText:@"Unable to perform checksum"
+ [[NSAlert alertWithMessageText:NSLocalizedString(@"Unable to perform the checksum", @"unable to perform the checksum")
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while performing the checksum on table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]]
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while performing the checksum on %@.\n\nMySQL said:%@",@"an error occurred while performing the checksum on the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]]
beginSheetModalForWindow:tableWindow
modalDelegate:self
didEndSelector:NULL
contextInfo:NULL];
}
+
return;
}
// Process result
- NSString *result = [[[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject] objectForKey:@"Checksum"];
-
- [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Checksum table '%@'", [self table]]
- defaultButton:@"OK"
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:@"Table checksum: %@", result]]
- beginSheetModalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:NULL
- contextInfo:NULL];
+ if([selectedItems count] == 1) {
+ message = [[[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject] objectForKey:@"Checksum"];
+ [[NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Checksum %@",@"checksum %@ message"), what]
+ defaultButton:@"OK"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Table checksum: %@",@"table checksum: %@"), message]]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:NULL
+ contextInfo:NULL];
+ } else {
+ NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary];
+ statusValues = [result retain];
+ NSAlert *alert = [[NSAlert new] autorelease];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Checksums of %@",@"Checksums of %@ message"), what]];
+ [alert setMessageText:NSLocalizedString(@"Table checksum",@"table checksum message")];
+ [alert setAccessoryView:statusTableAccessoryView];
+ [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"];
+ }
}
/**
@@ -2984,17 +3134,18 @@
// table menu items
if ([menuItem action] == @selector(showCreateTableSyntax:) ||
- [menuItem action] == @selector(copyCreateTableSyntax:) ||
- [menuItem action] == @selector(analyzeTable:) ||
- [menuItem action] == @selector(optimizeTable:) ||
- [menuItem action] == @selector(repairTable:) ||
- [menuItem action] == @selector(flushTable:) ||
- [menuItem action] == @selector(checksumTable:))
+ [menuItem action] == @selector(copyCreateTableSyntax:))
{
return ([self table] != nil && [[self table] isNotEqualTo:@""]);
}
- if ([menuItem action] == @selector(checkTable:)) {
+ if ([menuItem action] == @selector(analyzeTable:) ||
+ [menuItem action] == @selector(optimizeTable:) ||
+ [menuItem action] == @selector(repairTable:) ||
+ [menuItem action] == @selector(flushTable:) ||
+ [menuItem action] == @selector(checkTable:) ||
+ [menuItem action] == @selector(checksumTable:))
+ {
return ([[[tablesListInstance valueForKeyPath:@"tablesListView"] selectedRowIndexes] count]) ? YES:NO;
}
@@ -3745,13 +3896,27 @@
{
if(statusTableView && aTableView == statusTableView && rowIndex < [statusValues count]) {
if ([[aTableColumn identifier] isEqualToString:@"table_name"]) {
- return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"];
+ if([[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"])
+ return [[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"];
+ else if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"])
+ return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"];
+ return @"";
}
else if ([[aTableColumn identifier] isEqualToString:@"msg_status"]) {
- return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"];
+ if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"])
+ return [[[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"] capitalizedString];
+ return @"";
}
else if ([[aTableColumn identifier] isEqualToString:@"msg_text"]) {
- return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"];
+ if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"]) {
+ [[aTableColumn headerCell] setStringValue:NSLocalizedString(@"Message",@"message column title")];
+ return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"];
+ }
+ else if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Checksum"]) {
+ [[aTableColumn headerCell] setStringValue:@"Checksum"];
+ return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Checksum"];
+ }
+ return @"";
}
}
return nil;
@@ -3762,6 +3927,34 @@
return NO;
}
+
+#pragma mark -
+#pragma mark status accessory view
+
+- (IBAction)copyChecksumFromSheet:(id)sender
+{
+ NSMutableString *tmp = [NSMutableString string];
+ for(id row in statusValues)
+ if([row objectForKey:@"Msg_type"])
+ [tmp appendFormat:@"%@\t%@\t%@\n", [[row objectForKey:@"Table"] description],
+ [[row objectForKey:@"Msg_type"] description],
+ [[row objectForKey:@"Msg_text"] description]];
+ else
+ [tmp appendFormat:@"%@\t%@\n", [[row objectForKey:@"Table"] description],
+ [[row objectForKey:@"Checksum"] description]];
+ if ( [tmp length] )
+ {
+ NSPasteboard *pb = [NSPasteboard generalPasteboard];
+
+ [pb declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
+ NSStringPboardType, nil]
+ owner:nil];
+
+ [pb setString:tmp forType:NSStringPboardType];
+ [pb setString:tmp forType:NSTabularTextPboardType];
+ }
+}
+
#pragma mark -
/**
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 3ca55f43..e9c07510 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -824,6 +824,19 @@
NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTitle:@"Table"] submenu];
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check Selected Items", @"check selected items menu item")];
+ [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Repair Selected Items", @"repair selected items menu item")];
+ [[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Analyze Selected Items", @"analyze selected items menu item")];
+ [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Optimize Selected Items", @"optimize selected items menu item")];
+ [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Selected Items", @"flush selected items menu item")];
+ [[tableSubMenu itemAtIndex:9] setTitle:NSLocalizedString(@"Checksum Selected Items", @"checksum selected items menu item")];
+ [[tableSubMenu itemAtIndex:2] setHidden:NO];
+ [[tableSubMenu itemAtIndex:3] setHidden:NO];
+ [[tableSubMenu itemAtIndex:4] setHidden:NO];
+ [[tableSubMenu itemAtIndex:5] setHidden:NO];
+ [[tableSubMenu itemAtIndex:6] setHidden:NO];
+ [[tableSubMenu itemAtIndex:7] setHidden:NO];
+ [[tableSubMenu itemAtIndex:8] setHidden:NO];
+ [[tableSubMenu itemAtIndex:9] setHidden:NO];
// set window title
@@ -898,12 +911,16 @@
[[tableSubMenu itemAtIndex:3] setHidden:NO];
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")];
[[tableSubMenu itemAtIndex:4] setHidden:NO];
+ [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Repair Table", @"repair table menu item")];
[[tableSubMenu itemAtIndex:5] setHidden:NO]; // divider
[[tableSubMenu itemAtIndex:6] setHidden:NO];
+ [[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Analyze Table", @"analyze table menu item")];
[[tableSubMenu itemAtIndex:7] setHidden:NO];
+ [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Optimize Table", @"optimize table menu item")];
[[tableSubMenu itemAtIndex:8] setHidden:NO];
[[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")];
[[tableSubMenu itemAtIndex:9] setHidden:NO];
+ [[tableSubMenu itemAtIndex:9] setTitle:NSLocalizedString(@"Checksum Table", @"checksum table menu item")];
[renameTableMenuItem setHidden:NO];
[renameTableMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")];