aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-22 13:01:45 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-22 13:01:45 +0000
commit151ef11fca8f5d95d0383188b7f5cc3b67461be6 (patch)
tree5b3f2cde4f9fd15cbebd9783d8240af675decfe0 /Source/SPDatabaseDocument.m
parente30cdeb6ee289fc4221d7b3fc5ec9e58be059675 (diff)
downloadsequelpro-151ef11fca8f5d95d0383188b7f5cc3b67461be6.tar.gz
sequelpro-151ef11fca8f5d95d0383188b7f5cc3b67461be6.tar.bz2
sequelpro-151ef11fca8f5d95d0383188b7f5cc3b67461be6.zip
• sequelpro url scheme support
• added commands: SelectDocumentView, ReloadContentTableWithWHEREClause • fixed typos • tried to queue incoming commands
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m46
1 files changed, 42 insertions, 4 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 7c838a0e..4e26a8c4 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4395,6 +4395,29 @@
// Authenticate command
if(![docProcessID isEqualToString:[commandDict objectForKey:@"id"]]) return;
+ if([command isEqualToString:@"SelectDocumentView"]) {
+ if([params count] == 2) {
+ NSString *view = [params objectAtIndex:1];
+ if([view length]) {
+ if([[view lowercaseString] hasPrefix:@"str"])
+ [self viewStructure:self];
+ else if([[view lowercaseString] hasPrefix:@"con"])
+ [self viewContent:self];
+ else if([[view lowercaseString] hasPrefix:@"que"])
+ [self viewQuery:self];
+ else if([[view lowercaseString] hasPrefix:@"tab"])
+ [self viewStatus:self];
+ else if([[view lowercaseString] hasPrefix:@"rel"])
+ [self viewRelations:self];
+ else if([[view lowercaseString] hasPrefix:@"tri"])
+ [self viewTriggers:self];
+
+ [self updateWindowTitle:self];
+ }
+ }
+ return;
+ }
+
if([command isEqualToString:@"SelectTable"]) {
if([params count] == 2) {
NSString *tableName = [params objectAtIndex:1];
@@ -4413,16 +4436,16 @@
}
if([command isEqualToString:@"ReloadContentTable"]) {
- [tablesListInstance updateTables:self];
+ [tableContentInstance reloadTable:self];
return;
}
if([command isEqualToString:@"ReloadTablesList"]) {
- [tableContentInstance reloadTable:self];
+ [tablesListInstance updateTables:self];
return;
}
- else if([command isEqualToString:@"SelectDatabase"]) {
+ if([command isEqualToString:@"SelectDatabase"]) {
if (_isWorkingLevel) return;
if([params count] > 1) {
NSString *dbName = [params objectAtIndex:1];
@@ -4437,7 +4460,22 @@
return;
}
- else if([command isEqualToString:@"ExecuteQuery"]) {
+ if([command isEqualToString:@"ReloadContentTableWithWHEREClause"]) {
+ NSString *queryFileName = [NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, docProcessID];
+ NSFileManager *fm = [NSFileManager defaultManager];
+ BOOL isDir;
+ if([fm fileExistsAtPath:queryFileName isDirectory:&isDir] && !isDir) {
+ NSError *inError = nil;
+ NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:inError];
+ [fm removeItemAtPath:queryFileName error:nil];
+ if(inError == nil && query && [query length]) {
+ [tableContentInstance filterTable:query];
+ }
+ }
+ return;
+ }
+
+ if([command isEqualToString:@"ExecuteQuery"]) {
// Bail if document is busy
if (_isWorkingLevel) return;