From 151ef11fca8f5d95d0383188b7f5cc3b67461be6 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 22 Nov 2010 13:01:45 +0000 Subject: =?UTF-8?q?=E2=80=A2=20sequelpro=20url=20scheme=20support=20?= =?UTF-8?q?=E2=80=A2=C2=A0added=20commands:=20SelectDocumentView,=20Reload?= =?UTF-8?q?ContentTableWithWHEREClause=20=E2=80=A2=20fixed=20typos=20?= =?UTF-8?q?=E2=80=A2=20tried=20to=20queue=20incoming=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 46 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'Source/SPDatabaseDocument.m') 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; -- cgit v1.2.3