diff options
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 837c5387..4ef38ef8 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4548,6 +4548,58 @@ NSLog(@"received: %@", commandDict); } +- (NSDictionary*)shellVariables +{ + NSMutableDictionary *env = [NSMutableDictionary dictionary]; + + if (tablesListInstance) { + if([tablesListInstance selectedDatabase]) + [env setObject:[tablesListInstance selectedDatabase] forKey:@"SP_SELECTED_DATABASE"]; + + if ([tablesListInstance tableName]) + [env setObject:[tablesListInstance tableName] forKey:@"SP_SELECTED_TABLE"]; + + if ([tablesListInstance selectedTableItems]) + [env setObject:[[tablesListInstance selectedTableItems] componentsJoinedByString:@"\t"] forKey:@"SP_SELECTED_TABLES"]; + + if ([tablesListInstance allDatabaseNames]) + [env setObject:[[tablesListInstance allDatabaseNames] componentsJoinedByString:@"\t"] forKey:@"SP_ALL_DATABASES"]; + + if ([tablesListInstance allTableNames]) + [env setObject:[[tablesListInstance allTableNames] componentsJoinedByString:@"\t"] forKey:@"SP_ALL_TABLES"]; + + if ([tablesListInstance allViewNames]) + [env setObject:[[tablesListInstance allViewNames] componentsJoinedByString:@"\t"] forKey:@"SP_ALL_VIEWS"]; + + if ([tablesListInstance allFunctionNames]) + [env setObject:[[tablesListInstance allFunctionNames] componentsJoinedByString:@"\t"] forKey:@"SP_ALL_FUNCTIONS"]; + + if ([tablesListInstance allProcedureNames]) + [env setObject:[[tablesListInstance allProcedureNames] componentsJoinedByString:@"\t"] forKey:@"SP_ALL_PROCEDURES"]; + + if ([self user]) + [env setObject:[self user] forKey:@"SP_CURRENT_USER"]; + + if ([self host]) + [env setObject:[self host] forKey:@"SP_CURRENT_HOST"]; + + if ([self port]) + [env setObject:[self port] forKey:@"SP_CURRENT_PORT"]; + + if ([self databaseEncoding]) + [env setObject:[self databaseEncoding] forKey:@"SP_DATABASE_ENCODING"]; + + } + + if(1) + [env setObject:@"mysql" forKey:@"SP_RDBMS_TYPE"]; + + if([self mySQLVersion]) + [env setObject:[self mySQLVersion] forKey:@"SP_RDBMS_VERSION"]; + + return (NSDictionary*)env; +} + #pragma mark - #pragma mark Text field delegate methods |