aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-11 17:48:49 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-11 17:48:49 +0000
commit967136fd591a7f13185a0b353827bf8946883fc8 (patch)
tree16fe5d71b6591af1d05711fd0856e771759fb832 /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
parentc89861651e5505652446daad6861156986683370 (diff)
downloadsequelpro-967136fd591a7f13185a0b353827bf8946883fc8.tar.gz
sequelpro-967136fd591a7f13185a0b353827bf8946883fc8.tar.bz2
sequelpro-967136fd591a7f13185a0b353827bf8946883fc8.zip
• further preparations to F5 completion
Note: not yet active - only querying the data in background will be performed for testing
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m22
1 files changed, 17 insertions, 5 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 11f9cfec..a8655375 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1867,7 +1867,15 @@ void performThreadedKeepAlive(void *ptr)
}
// Query the desired data
- NSString *queryDbString = @"SELECT TABLE_SCHEMA AS `databases`, TABLE_NAME AS `tables`, COLUMN_NAME AS `fields`, COLUMN_TYPE AS `type`, CHARACTER_SET_NAME AS `charset` FROM `information_schema`.`COLUMNS`";
+ NSString *queryDbString = @""
+ @"SELECT TABLE_SCHEMA AS `databases`, TABLE_NAME AS `tables`, COLUMN_NAME AS `fields`, COLUMN_TYPE AS `type`, CHARACTER_SET_NAME AS `charset`, '0' AS `structtype` FROM `information_schema`.`COLUMNS`"
+ @"UNION "
+ @"SELECT c.TABLE_SCHEMA AS `databases`, c.TABLE_NAME AS `tables`, c.COLUMN_NAME AS `fields`, c.COLUMN_TYPE AS `type`, c.CHARACTER_SET_NAME AS `charset`, '1' AS `structtype` FROM `information_schema`.`COLUMNS` AS c, `information_schema`.`VIEWS` AS v WHERE c.TABLE_SCHEMA = v.TABLE_SCHEMA AND c.TABLE_NAME = v.TABLE_NAME "
+ @"UNION "
+ @"SELECT ROUTINE_SCHEMA AS `databases`, ROUTINE_NAME AS `tables`, ROUTINE_NAME AS `fields`, '' AS `type`, '' AS `charset`, '2' AS `structtype` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'PROCEDURE' "
+ @"UNION "
+ @"SELECT ROUTINE_SCHEMA AS `databases`, ROUTINE_NAME AS `tables`, ROUTINE_NAME AS `fields`, '' AS `type`, '' AS `charset`, '3' AS `structtype` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'FUNCTION' "
+ @"ORDER BY `databases`,`tables`,`fields`";
NSData *encodedQueryData = NSStringDataUsingLossyEncoding(queryDbString, theConnectionEncoding, 1);
const char *queryCString = [encodedQueryData bytes];
unsigned long queryCStringLength = [encodedQueryData length];
@@ -1882,14 +1890,18 @@ void performThreadedKeepAlive(void *ptr)
NSString *field = [self stringWithUTF8CString:row[2]];
NSString *type = [self stringWithUTF8CString:row[3]];
NSString *charset = (row[4]) ? [self stringWithUTF8CString:row[4]] : @"";
+ NSString *structtype = [self stringWithUTF8CString:row[5]];
- if(![structure valueForKey:db])
+ if(![structure valueForKey:db]) {
[structure setObject:[NSMutableDictionary dictionary] forKey:db];
+ }
- if(![[structure valueForKey:db] valueForKey:table])
+ if(![[structure valueForKey:db] valueForKey:table]) {
[[structure valueForKey:db] setObject:[NSMutableDictionary dictionary] forKey:table];
+ }
- [[[structure valueForKey:db] valueForKey:table] setObject:[NSArray arrayWithObjects:type,charset,nil] forKey:field];
+ [[[structure valueForKey:db] valueForKey:table] setObject:[NSString stringWithFormat:@"%@ %@", type, charset] forKey:field];
+ [[[structure valueForKey:db] valueForKey:table] setObject:structtype forKey:@" struct_type "];
}
@@ -1919,7 +1931,7 @@ void performThreadedKeepAlive(void *ptr)
*/
- (NSDictionary *)getDbStructure
{
- return [theDbStructure retain];
+ return theDbStructure;
}
#pragma mark -