aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-05 21:14:15 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-05 21:14:15 +0000
commited4617c7fc292ac15a3cb340b2247d58793d3ca4 (patch)
treecc32cc3a93ed8a8001945d85d9242aa6a8d42682 /Source/TableDocument.m
parent493fb09f6169864726be9909907fa1b84b3d0a21 (diff)
downloadsequelpro-ed4617c7fc292ac15a3cb340b2247d58793d3ca4.tar.gz
sequelpro-ed4617c7fc292ac15a3cb340b2247d58793d3ca4.tar.bz2
sequelpro-ed4617c7fc292ac15a3cb340b2247d58793d3ca4.zip
• open a SQL file via Finder or Terminal (open *.sql if SP is the default app for sql files) will insert the file content into the Custom Query editor of the current active doc
- this action starts SP and asks for a connection if it is not running - same for drag&drop a SQL file onto SP's dock icon
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 68b79a1a..668f6b46 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -79,6 +79,7 @@
[printWebView setFrameLoadDelegate:self];
prefs = [NSUserDefaults standardUserDefaults];
+ queryEditorInitString = nil;
}
@@ -203,6 +204,14 @@
[[SPGrowlController sharedGrowlController] notifyWithTitle:@"Connected"
description:[NSString stringWithFormat:NSLocalizedString(@"Connected to %@",@"description for connected growl notification"), [tableWindow title]]
notificationName:@"Connected"];
+
+ // Insert queryEditorInitString into the Query Editor if defined
+ if(queryEditorInitString && [queryEditorInitString length]) {
+ [self viewQuery:self];
+ [customQueryInstance doPerformLoadQueryService:queryEditorInitString];
+ [queryEditorInitString release];
+ queryEditorInitString = nil;
+ }
}
@@ -1276,6 +1285,16 @@
#pragma mark Other Methods
/**
+ * Set that query which will be inserted into the Query Editor
+ * after establishing the connection
+ */
+
+- (void)initQueryEditorWithString:(NSString *)query
+{
+ queryEditorInitString = [query retain];
+}
+
+/**
* Invoked when user hits the cancel button or close button in
* dialogs such as the variableSheet or the createTableSyntaxSheet
*/
@@ -1302,6 +1321,15 @@
}
/**
+ * Inserts query into the Custom Query editor
+ */
+- (void)doPerformLoadQueryService:(NSString *)query
+{
+ [self viewQuery:nil];
+ [customQueryInstance doPerformLoadQueryService:query];
+}
+
+/**
* Flushes the mysql privileges
*/
- (void)flushPrivileges:(id)sender