aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableInfo.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-11-02 22:56:53 +0000
committerBibiko <bibiko@eva.mpg.de>2009-11-02 22:56:53 +0000
commit6507cae12d1e334c70e7619126d29c57e45859f0 (patch)
tree3c00cff31f2d0aaf3a517f7735044e9c868d2296 /Source/SPTableInfo.m
parent84708d14baec176b8d7bea124243e42c333bd328 (diff)
downloadsequelpro-6507cae12d1e334c70e7619126d29c57e45859f0.tar.gz
sequelpro-6507cae12d1e334c70e7619126d29c57e45859f0.tar.bz2
sequelpro-6507cae12d1e334c70e7619126d29c57e45859f0.zip
• added basic PROCEDURE and FUNCTION INFORMATION
• change "multiple tables" to "multiple selection" and header to "INFORMATION" if a multiple selection is given
Diffstat (limited to 'Source/SPTableInfo.m')
-rw-r--r--Source/SPTableInfo.m154
1 files changed, 107 insertions, 47 deletions
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index 800a87dd..4f5e3d0a 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -84,67 +84,127 @@
return;
}
- if ([tableListInstance tableType] == SP_TABLETYPE_PROC) {
- [info addObject:@"PROCEDURE INFORMATION"];
- [info addObject:@"no information available"];
+ if ([[tableListInstance tableName] isEqualToString:@""]) {
+ [info addObject:@"INFORMATION"];
+ [info addObject:@"multiple selection"];
[infoTable reloadData];
return;
- }
+ }
- if ([tableListInstance tableType] == SP_TABLETYPE_FUNC) {
- [info addObject:@"FUNCTION INFORMATION"];
- [info addObject:@"no information available"];
- [infoTable reloadData];
- return;
+ // Get TABLE information
+ if ([tableListInstance tableType] == SP_TABLETYPE_TABLE) {
+
+ [info addObject:@"TABLE INFORMATION"];
+
+ if ([tableListInstance tableName]) {
+ if ([[tableListInstance tableName] isEqualToString:@""]) {
+ [info addObject:@"multiple tables"];
+ }
+ else {
+ // Retrieve the table status information via the data cache
+ tableStatus = [tableDataInstance statusValues];
+
+ // Check for errors
+ if (![tableStatus count]) {
+ [info addObject:@"error occurred"];
+ return;
+ }
+
+ // Check for 'Create_time' == NULL
+ if (![[tableStatus objectForKey:@"Create_time"] isNSNull]) {
+
+ // Add the creation date to the infoTable
+ [info addObject:[NSString stringWithFormat:@"created: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"Create_time"]]]];
+ }
+
+ // Check for 'Update_time' == NULL - InnoDB tables don't have an update time
+ if (![[tableStatus objectForKey:@"Update_time"] isNSNull]) {
+
+ // Add the update date to the infoTable
+ [info addObject:[NSString stringWithFormat:@"updated: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"Update_time"]]]];
+ }
+
+ // Check for 'Rows' == NULL - information_schema database doesn't report row count for it's tables
+ if (![[tableStatus objectForKey:@"Rows"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:[[tableStatus objectForKey:@"RowsCountAccurate"] boolValue] ? @"rows: %@" : @"rows: ~%@",
+ [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Rows"] longLongValue]]]]];
+ }
+
+ [info addObject:[NSString stringWithFormat:@"size: %@", [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] longLongValue]]]];
+ [info addObject:[NSString stringWithFormat:@"encoding: %@", [tableDataInstance tableEncoding]]];
+
+ if (![[tableStatus objectForKey:@"Auto_increment"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:@"auto_increment: %@",
+ [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Auto_increment"] longLongValue]]]]];
+ }
+ }
+ }
}
- [info addObject:@"TABLE INFORMATION"];
-
- if ([tableListInstance tableName]) {
- if ([[tableListInstance tableName] isEqualToString:@""]) {
- [info addObject:@"multiple tables"];
- }
- else {
- // Retrieve the table status information via the data cache
- tableStatus = [tableDataInstance statusValues];
-
- // Check for errors
- if (![tableStatus count]) {
- [info addObject:@"error occurred"];
- return;
- }
+ // Get PROC/FUNC information
+ else if ([tableListInstance tableType] == SP_TABLETYPE_PROC || [tableListInstance tableType] == SP_TABLETYPE_FUNC) {
+
+ if ([tableListInstance tableType] == SP_TABLETYPE_PROC)
+ [info addObject:@"PROCEDURE INFORMATION"];
+ else
+ [info addObject:@"FUNCTION INFORMATION"];
+
+ if ([tableListInstance tableName]) {
+ if ([[tableListInstance tableName] isEqualToString:@""]) {
+ [info addObject:@"multiple tables"];
+ } else {
+ // Retrieve the table status information via the data cache
+ tableStatus = [tableDataInstance statusValues];
- // Check for 'Create_time' == NULL
- if (![[tableStatus objectForKey:@"Create_time"] isNSNull]) {
+ // Check for errors
+ if (![tableStatus count]) {
+ [info addObject:@"error occurred"];
+ return;
+ }
// Add the creation date to the infoTable
- [info addObject:[NSString stringWithFormat:@"created: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"Create_time"]]]];
- }
+ // Check for 'CREATED' == NULL
+ if (![[tableStatus objectForKey:@"CREATED"] isNSNull]) {
+
+ // Add the creation date to the infoTable
+ [info addObject:[NSString stringWithFormat:@"created: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"CREATED"]]]];
+ }
- // Check for 'Update_time' == NULL - InnoDB tables don't have an update time
- if (![[tableStatus objectForKey:@"Update_time"] isNSNull]) {
+ // Check for 'LAST_ALTERED'
+ if (![[tableStatus objectForKey:@"LAST_ALTERED"] isNSNull]) {
- // Add the update date to the infoTable
- [info addObject:[NSString stringWithFormat:@"updated: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"Update_time"]]]];
- }
-
- // Check for 'Rows' == NULL - information_schema database doesn't report row count for it's tables
- if (![[tableStatus objectForKey:@"Rows"] isNSNull]) {
- [info addObject:[NSString stringWithFormat:[[tableStatus objectForKey:@"RowsCountAccurate"] boolValue] ? @"rows: %@" : @"rows: ~%@",
- [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Rows"] longLongValue]]]]];
- }
-
- [info addObject:[NSString stringWithFormat:@"size: %@", [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] longLongValue]]]];
- [info addObject:[NSString stringWithFormat:@"encoding: %@", [tableDataInstance tableEncoding]]];
-
- if (![[tableStatus objectForKey:@"Auto_increment"] isNSNull]) {
- [info addObject:[NSString stringWithFormat:@"auto_increment: %@",
- [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Auto_increment"] longLongValue]]]]];
+ // Add the update date to the infoTable
+ [info addObject:[NSString stringWithFormat:@"updated: %@", [self _getUserDefinedDateStringFromMySQLDate:[tableStatus objectForKey:@"LAST_ALTERED"]]]];
+ }
+
+ // Check for 'SQL ACCESS' and deterministic
+ if (![[tableStatus objectForKey:@"SQL_DATA_ACCESS"] isNSNull] && ![[tableStatus objectForKey:@"IS_DETERMINISTIC"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:@"data access: %@ (%@)", [tableStatus objectForKey:@"SQL_DATA_ACCESS"], ([[tableStatus objectForKey:@"IS_DETERMINISTIC"] isEqualToString:@"YES"]) ? @"deterministic" : @"non-deterministic"]];
+ }
+
+ if ([tableListInstance tableType] == SP_TABLETYPE_FUNC) {
+ // Check for 'DTD_IDENTIFIER'
+ if (![[tableStatus objectForKey:@"DTD_IDENTIFIER"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:@"return type: %@", [tableStatus objectForKey:@"DTD_IDENTIFIER"]]];
+ }
+ }
+
+ // Check for 'SECURITY_TYPE'
+ if (![[tableStatus objectForKey:@"SECURITY_TYPE"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:@"execution privilege: %@", [tableStatus objectForKey:@"SECURITY_TYPE"]]];
+ }
+
+ // Check for 'DEFINER'
+ if (![[tableStatus objectForKey:@"DEFINER"] isNSNull]) {
+ [info addObject:[NSString stringWithFormat:@"definer: %@", [tableStatus objectForKey:@"DEFINER"]]];
+ }
+
}
}
}
-
+
[infoTable reloadData];
+
}
#pragma mark -