aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-31 00:34:03 +0000
committerrowanbeentje <rowan@beent.je>2010-03-31 00:34:03 +0000
commitb9f5c468900eca5748392d61a603b425492706f6 (patch)
treebee5f4c2ca46d39ec2e76972f089fba9e802be15 /Source/TableDocument.m
parentd060c9f395f938d1d1adeec0ce8a9444267bdebf (diff)
downloadsequelpro-b9f5c468900eca5748392d61a603b425492706f6.tar.gz
sequelpro-b9f5c468900eca5748392d61a603b425492706f6.tar.bz2
sequelpro-b9f5c468900eca5748392d61a603b425492706f6.zip
- Improve error checking for various actions, particularly permissions errors (NULL data returned) for views and stored procedures. This should fix http://log.sequelpro.com/view/27 , http://log.sequelpro.com/view/57 , and the last of http://log.sequelpro.com/view/53
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 936792b2..4ef781e3 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1672,6 +1672,17 @@
NSString *tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:colOffs];
+ // A NULL value indicates that the user does not have permission to view the syntax
+ if ([tableSyntax isNSNull]) {
+ [[NSAlert alertWithMessageText:NSLocalizedString(@"Permission Denied", @"Permission Denied")
+ defaultButton:NSLocalizedString(@"OK", @"OK")
+ alternateButton:nil otherButton:nil
+ informativeTextWithFormat:NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail")]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self didEndSelector:NULL contextInfo:NULL];
+ return;
+ }
+
[createTableSyntaxTextField setStringValue:[NSString stringWithFormat:@"Create syntax for %@ '%@'", typeString, [self table]]];
[createTableSyntaxTextView setEditable:YES];
@@ -1730,6 +1741,17 @@
NSString *tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:colOffs];
+ // A NULL value indicates that the user does not have permission to view the syntax
+ if ([tableSyntax isNSNull]) {
+ [[NSAlert alertWithMessageText:NSLocalizedString(@"Permission Denied", @"Permission Denied")
+ defaultButton:NSLocalizedString(@"OK", @"OK")
+ alternateButton:nil otherButton:nil
+ informativeTextWithFormat:NSLocalizedString(@"The creation syntax could not be retrieved due to a permissions error.\n\nPlease check your user permissions with an administrator.", @"Create syntax permission denied detail")]
+ beginSheetModalForWindow:tableWindow
+ modalDelegate:self didEndSelector:NULL contextInfo:NULL];
+ return;
+ }
+
// copy to the clipboard
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];