aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-05-28 09:15:53 +0000
committerBibiko <bibiko@eva.mpg.de>2009-05-28 09:15:53 +0000
commit297086a539bc69bf389979e68e3d8dcfc64f56d4 (patch)
tree167dea172c1f7dac7780a91b3f0608a3154eac98 /Source/SPTableData.m
parent1f708a13801b64299effcf6cf3df7b2224ba2e6e (diff)
downloadsequelpro-297086a539bc69bf389979e68e3d8dcfc64f56d4.tar.gz
sequelpro-297086a539bc69bf389979e68e3d8dcfc64f56d4.tar.bz2
sequelpro-297086a539bc69bf389979e68e3d8dcfc64f56d4.zip
• Table Info
- show create syntax for views - fixed editing behaviour of the Comments field (esp. for views)
Diffstat (limited to 'Source/SPTableData.m')
-rw-r--r--Source/SPTableData.m25
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index bedc9dc1..e1467c2d 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -585,8 +585,31 @@
// Catch unselected views and return nil
if ([viewName isEqualToString:@""] || !viewName) return nil;
+ // Retrieve the CREATE TABLE syntax for the table
+ CMMCPResult *theResult = [mySQLConnection queryString: [NSString stringWithFormat: @"SHOW CREATE TABLE %@",
+ [viewName backtickQuotedString]
+ ]];
+
+ // Check for any errors, but only display them if a connection still exists
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ if ([mySQLConnection isConnected]) {
+ NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while retrieving table information:\n\n%@", [mySQLConnection getLastErrorMessage]], @"OK", nil, nil);
+ }
+ return nil;
+ }
+
+ // Retrieve the table syntax string
+ NSArray *syntaxResult = [theResult fetchRowAsArray];
+
+ if ([[syntaxResult objectAtIndex:1] isKindOfClass:[NSData class]]) {
+ tableCreateSyntax = [[NSString alloc] initWithData:[syntaxResult objectAtIndex:1] encoding:[mySQLConnection encoding]];
+ } else {
+ tableCreateSyntax = [[NSString alloc] initWithString:[syntaxResult objectAtIndex:1]];
+ }
+
+
// Retrieve the SHOW COLUMNS syntax for the table
- CMMCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [viewName backtickQuotedString]]];
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [viewName backtickQuotedString]]];
// Check for any errors, but only display them if a connection still exists
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {