aboutsummaryrefslogtreecommitdiffstats
path: root/TableDocument.m
diff options
context:
space:
mode:
authorabhibeckert <abhi@abhibeckert.com>2008-04-30 12:36:33 +0000
committerabhibeckert <abhi@abhibeckert.com>2008-04-30 12:36:33 +0000
commit6fefa167eb04635e7e329389ad584605cc0e9ce1 (patch)
tree1fd475403e2b8963e69c616032897337045352bc /TableDocument.m
parent65f2a8f2257c2c737b204e110c25ca443debca29 (diff)
downloadsequelpro-6fefa167eb04635e7e329389ad584605cc0e9ce1.tar.gz
sequelpro-6fefa167eb04635e7e329389ad584605cc0e9ce1.tar.bz2
sequelpro-6fefa167eb04635e7e329389ad584605cc0e9ce1.zip
change create table syntax panel to a HID window
Diffstat (limited to 'TableDocument.m')
-rw-r--r--TableDocument.m41
1 files changed, 15 insertions, 26 deletions
diff --git a/TableDocument.m b/TableDocument.m
index 3b3fba38..9b97c7fb 100644
--- a/TableDocument.m
+++ b/TableDocument.m
@@ -750,35 +750,24 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (IBAction)createTableSyntax:(id)sender
{
- NSString *query;
- CMMCPResult *theResult;
- id tableSyntax;
-
//Create the query and get results
- query = [NSString stringWithFormat:@"SHOW CREATE TABLE `%@`", [self table]];
- theResult = [mySQLConnection queryString:query];
+ NSString *query = [NSString stringWithFormat:@"SHOW CREATE TABLE `%@`", [self table]];
+ CMMCPResult *theResult = [mySQLConnection queryString:query];
// Check for no errors
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:1];
-
- if ( [tableSyntax isKindOfClass:[NSData class]] )
- {
- tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
- }
-
- [syntaxViewContent setString:tableSyntax];
- [syntaxViewContent selectAll:self];
-
- NSAlert* alert = [NSAlert new];
- [alert setMessageText:@"Table Syntax"];
- [alert setInformativeText:[NSString stringWithFormat:@"Syntax for '%@' table:", [self table]]];
- [alert setAccessoryView:syntaxView];
- [alert runModal];
- } else {
- // If there was an error
- NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while creating table syntax.\n\n: %@",[mySQLConnection getLastErrorMessage]], @"OK", nil, nil);
- }
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while creating table syntax.\n\n: %@",[mySQLConnection getLastErrorMessage]], @"OK", nil, nil);
+ return;
+ }
+
+ id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:1];
+
+ if ([tableSyntax isKindOfClass:[NSData class]])
+ tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
+
+ [syntaxViewContent setString:tableSyntax];
+ [syntaxViewContent selectAll:self];
+ [createTableSyntaxWindow makeKeyAndOrderFront:self];
}
- (IBAction)checkTable:(id)sender