diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-05-11 21:12:09 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-05-11 21:12:09 +0000 |
commit | 838faafed7af37723e8f900a6cba846a29507db2 (patch) | |
tree | b9ffcc98212fe77dc14ee2eb5cab2baff2a15512 /Source | |
parent | 51a8cb29f1fae1e2f4fd69f724d9b7ed5ef3a7ff (diff) | |
download | sequelpro-838faafed7af37723e8f900a6cba846a29507db2.tar.gz sequelpro-838faafed7af37723e8f900a6cba846a29507db2.tar.bz2 sequelpro-838faafed7af37723e8f900a6cba846a29507db2.zip |
• added URL scheme command sequelpro://SP_PROCESS_ID@passToDoc/RunQueryInQueryEditor/ which executes a passed SQL query and displays the result if any in the data table of the query editor
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDatabaseDocument.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index d93d5a14..8f63f163 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4905,6 +4905,20 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; return; } + if([command isEqualToString:@"RunQueryInQueryEditor"]) { + 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]) { + [customQueryInstance performQueries:[NSArray arrayWithObject:query] withCallback:NULL]; + } + } + return; + } if([command isEqualToString:@"CreateSyntaxForTables"]) { |