aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-05-11 21:12:09 +0000
committerBibiko <bibiko@eva.mpg.de>2011-05-11 21:12:09 +0000
commit838faafed7af37723e8f900a6cba846a29507db2 (patch)
treeb9ffcc98212fe77dc14ee2eb5cab2baff2a15512 /Source/SPDatabaseDocument.m
parent51a8cb29f1fae1e2f4fd69f724d9b7ed5ef3a7ff (diff)
downloadsequelpro-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/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m14
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"]) {