aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMCopyTable.m4
-rw-r--r--Source/SPConnectionController.h2
-rw-r--r--Source/SPConnectionController.m270
-rw-r--r--Source/SPCustomQuery.h (renamed from Source/CustomQuery.h)4
-rw-r--r--Source/SPCustomQuery.m (renamed from Source/CustomQuery.m)6
-rw-r--r--Source/SPDatabaseDocument.m4
-rw-r--r--Source/SPExportInitializer.m2
-rw-r--r--Source/SPPrintController.m2
-rw-r--r--Source/SPQueryController.m2
-rw-r--r--Source/SPTableView.m2
-rw-r--r--Source/SPTextView.h4
-rw-r--r--Source/SPTextView.m12
-rw-r--r--Source/TableDump.m2
13 files changed, 194 insertions, 122 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m
index d449190a..8ce03586 100644
--- a/Source/CMCopyTable.m
+++ b/Source/CMCopyTable.m
@@ -30,7 +30,7 @@
#import "SPTableContent.h"
#import "SPTableTriggers.h"
#import "SPTableRelations.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPNotLoaded.h"
#import "SPConstants.h"
#import "SPDataStorage.h"
@@ -461,7 +461,7 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003;
}
}
}
- if([[[[self delegate] class] description] isEqualToString:@"CustomQuery"]) {
+ if([[[[self delegate] class] description] isEqualToString:@"SPCustomQuery"]) {
id tableContentView = [[self delegate] valueForKeyPath:@"customQueryView"];
if([tableContentView numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) {
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index edf6f5fd..2f274a27 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -117,6 +117,7 @@
IBOutlet NSMenuItem *favoritesSortByMenuItem;
BOOL reverseFavoritesSort;
+ BOOL mySQLConnectionCancelled;
SPFavoritesSortItem previousSortItem, currentSortItem;
}
@@ -145,6 +146,7 @@
// Connection processes
- (IBAction)initiateConnection:(id)sender;
+- (IBAction)cancelMySQLConnection:(id)sender;
- (void)initiateSSHTunnelConnection;
- (void)sshTunnelCallback:(SPSSHTunnel *)theTunnel;
- (void)initiateMySQLConnection;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index a270a716..257eed1b 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -34,6 +34,8 @@
@interface SPConnectionController (PrivateAPI)
- (void)_sortFavorites;
+- (void)_initiateMySQLConnectionInBackground;
+- (void)_initiatedMySQLConnectionEstablished;
@end
@@ -77,6 +79,7 @@
mySQLConnection = nil;
sshTunnel = nil;
cancellingConnection = NO;
+ mySQLConnectionCancelled = NO;
favoritesPBoardType = @"FavoritesPBoardType";
// Load the connection nib, keeping references to the top-level objects for later release
@@ -221,17 +224,25 @@
// Trim whitespace and newlines from the host field before attempting to connect
[self setHost:[[self host] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
-
+
// Initiate the SSH connection process for tunnels
if ([self type] == SPSSHTunnelConnection) {
[self performSelector:@selector(initiateSSHTunnelConnection) withObject:nil afterDelay:0.0];
return;
}
-
+
// ...or start the MySQL connection process directly
[self performSelector:@selector(initiateMySQLConnection) withObject:nil afterDelay:0.0];
}
+/**
+ * Cancels (or rather marks) the current connection is to be cancelled once established.
+ */
+- (IBAction)cancelMySQLConnection:(id)sender
+{
+ mySQLConnectionCancelled = YES;
+}
+
/*
* Initiate the SSH connection process.
* This should only be called as part of initiateConnection:, and will indirectly
@@ -310,105 +321,12 @@
[progressIndicatorText display];
- // Initialise to socket if appropriate.
- if ([self type] == SPSocketConnection) {
- mySQLConnection = [[MCPConnection alloc] initToSocket:[self socket] withLogin:[self user]];
-
- // Otherwise, initialise to host, using tunnel if appropriate
- } else {
- if ([self type] == SPSSHTunnelConnection) {
- mySQLConnection = [[MCPConnection alloc] initToHost:@"127.0.0.1"
- withLogin:[self user]
- usingPort:[sshTunnel localPort]];
- [mySQLConnection setConnectionProxy:sshTunnel];
- } else {
- mySQLConnection = [[MCPConnection alloc] initToHost:[self host]
- withLogin:[self user]
- usingPort:([[self port] length]?[[self port] integerValue]:3306)];
- }
- }
-
- // Only set the password if there is no Keychain item set. The connection will ask the delegate for passwords in the Keychain.
- if (!connectionKeychainItemName && [self password]) {
- [mySQLConnection setPassword:[self password]];
- }
-
- // Connection delegate must be set before actual connection attempt is made
- [mySQLConnection setDelegate:tableDocument];
-
- // Set whether or not we should enable delegate logging according to the prefs
- [mySQLConnection setDelegateQueryLogging:[prefs boolForKey:SPConsoleEnableLogging]];
-
- // Set options from preferences
- [mySQLConnection setConnectionTimeout:[[prefs objectForKey:SPConnectionTimeoutValue] integerValue]];
- [mySQLConnection setUseKeepAlive:[[prefs objectForKey:SPUseKeepAlive] boolValue]];
- [mySQLConnection setKeepAliveInterval:[[prefs objectForKey:SPKeepAliveInterval] doubleValue]];
-
- // Connect
- [mySQLConnection connect];
-
- if (![mySQLConnection isConnected]) {
- if (sshTunnel) {
-
- // If an SSH tunnel is running, temporarily block to allow the tunnel to register changes in state
- [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
-
- // If the state is connection refused, attempt the MySQL connection again with the host using the hostfield value.
- if ([sshTunnel state] == PROXY_STATE_FORWARDING_FAILED) {
- if ([sshTunnel localPortFallback]) {
- [mySQLConnection setPort:[sshTunnel localPortFallback]];
- [mySQLConnection connect];
- if (![mySQLConnection isConnected]) {
- [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
- }
- }
- }
- }
-
- if (![mySQLConnection isConnected]) {
- NSString *errorMessage;
- if (sshTunnel && [sshTunnel state] == PROXY_STATE_FORWARDING_FAILED) {
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@ because the port connection via SSH was refused.\n\nPlease ensure that your MySQL host is set up to allow TCP/IP connections (no --skip-networking) and is configured to allow connections from the host you are tunnelling via.\n\nYou may also want to check the port is correct and that you have the necessary privileges.\n\nChecking the error detail will show the SSH debug log which may provide more details.\n\nMySQL said: %@", @"message of panel when SSH port forwarding failed"), [self host], [mySQLConnection getLastErrorMessage]];
- [self failConnectionWithTitle:NSLocalizedString(@"SSH port forwarding failed", @"title when ssh tunnel port forwarding failed") errorMessage:errorMessage detail:[sshTunnel debugMessages]];
- } else if ([mySQLConnection getLastErrorID] == 1045) { // "Access denied" error
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@ because access was denied.\n\nDouble-check your username and password and ensure that access from your current location is permitted.\n\nMySQL said: %@", @"message of panel when connection to host failed due to access denied error"), [self host], [mySQLConnection getLastErrorMessage]];
- [self failConnectionWithTitle:NSLocalizedString(@"Access denied!", @"connection failed due to access denied title") errorMessage:errorMessage detail:nil];
- } else if ([self type] == SPSocketConnection && (![self socket] || ![[self socket] length]) && ![mySQLConnection findSocketPath]) {
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The socket file could not be found in any common location. Please supply the correct socket location.\n\nMySQL said: %@", @"message of panel when connection to socket failed because optional socket could not be found"), [mySQLConnection getLastErrorMessage]];
- [self failConnectionWithTitle:NSLocalizedString(@"Socket not found!", @"socket not found title") errorMessage:errorMessage detail:nil];
- } else if ([self type] == SPSocketConnection) {
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect via the socket, or the request timed out.\n\nDouble-check that the socket path is correct and that you have the necessary privileges, and that the server is running.\n\nMySQL said: %@", @"message of panel when connection to host failed"), [mySQLConnection getLastErrorMessage]];
- [self failConnectionWithTitle:NSLocalizedString(@"Socket connection failed!", @"socket connection failed title") errorMessage:errorMessage detail:nil];
- } else {
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %ld seconds).\n\nMySQL said: %@", @"message of panel when connection to host failed"), [self host], (long)[[prefs objectForKey:SPConnectionTimeoutValue] integerValue], [mySQLConnection getLastErrorMessage]];
- [self failConnectionWithTitle:NSLocalizedString(@"Connection failed!", @"connection failed title") errorMessage:errorMessage detail:nil];
- }
-
- if (sshTunnel) [sshTunnel release], sshTunnel = nil;
- [mySQLConnection release], mySQLConnection = nil;
- return;
- }
- }
- if ([self database] && ![[self database] isEqualToString:@""]) {
- if (![mySQLConnection selectDB:[self database]]) {
- [self failConnectionWithTitle:NSLocalizedString(@"Could not select database", @"message when database selection failed") errorMessage:[NSString stringWithFormat:NSLocalizedString(@"Connected to host, but unable to connect to database %@.\n\nBe sure that the database exists and that you have the necessary privileges.\n\nMySQL said: %@", @"message of panel when connection to db failed"), [self database], [mySQLConnection getLastErrorMessage]] detail:nil];
- if (sshTunnel) [sshTunnel release], sshTunnel = nil;
- [mySQLConnection release], mySQLConnection = nil;
- return;
- }
- }
-
- // Successful connection!
- [progressIndicator stopAnimation:self];
- [progressIndicatorText setHidden:YES];
- [addToFavoritesButton setHidden:NO];
+ [connectButton setTitle:NSLocalizedString(@"Cancel", @"cancel button")];
+ [connectButton setAction:@selector(cancelMySQLConnection:)];
[connectButton setEnabled:YES];
-
- // Release the tunnel if set - will now be retained by the connection
- if (sshTunnel) [sshTunnel release], sshTunnel = nil;
-
- // Pass the connection to the document and clean up the interface
- [self addConnectionToDocument];
+ [connectButton display];
+
+ [NSThread detachNewThreadSelector:@selector(_initiateMySQLConnectionInBackground) toTarget:self withObject:nil];
}
/*
@@ -1101,6 +1019,9 @@
#pragma mark -
#pragma mark Private API
+/**
+ *
+ */
- (void)_sortFavorites
{
NSString *sortKey = @"";
@@ -1140,6 +1061,155 @@
[first release];
}
+/**
+ *
+ */
+- (void)_initiatedMySQLConnectionEstablished
+{
+ if (mySQLConnectionCancelled) {
+ [progressIndicatorText setStringValue:NSLocalizedString(@"Cancelling...", @"cancelling connection message")];
+ [progressIndicatorText display];
+
+ if ([mySQLConnection isConnected]) {
+ [mySQLConnection disconnect];
+ [mySQLConnection release], mySQLConnection = nil;
+ }
+
+ // Kill the SSH connection if present
+ [self cancelConnection];
+
+ // Reset the UI
+ [addToFavoritesButton setHidden:NO];
+ [addToFavoritesButton display];
+ [helpButton setHidden:NO];
+ [helpButton display];
+ [connectButton setTitle:NSLocalizedString(@"Connect", @"connect button")];
+ [connectButton setEnabled:YES];
+ [connectButton display];
+ [progressIndicator stopAnimation:self];
+ [progressIndicator display];
+ [progressIndicatorText setHidden:YES];
+ [progressIndicatorText display];
+
+ return;
+ }
+
+ // Successful connection!
+ [connectButton setEnabled:NO];
+ [progressIndicator stopAnimation:self];
+ [progressIndicatorText setHidden:YES];
+ [addToFavoritesButton setHidden:NO];
+
+ // Release the tunnel if set - will now be retained by the connection
+ if (sshTunnel) [sshTunnel release], sshTunnel = nil;
+
+ // Pass the connection to the document and clean up the interface
+ [self addConnectionToDocument];
+}
+
+/**
+ *
+ */
+- (void)_initiateMySQLConnectionInBackground
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ // Initialise to socket if appropriate.
+ if ([self type] == SPSocketConnection) {
+ mySQLConnection = [[MCPConnection alloc] initToSocket:[self socket] withLogin:[self user]];
+
+ // Otherwise, initialise to host, using tunnel if appropriate
+ } else {
+ if ([self type] == SPSSHTunnelConnection) {
+ mySQLConnection = [[MCPConnection alloc] initToHost:@"127.0.0.1"
+ withLogin:[self user]
+ usingPort:[sshTunnel localPort]];
+ [mySQLConnection setConnectionProxy:sshTunnel];
+ } else {
+ mySQLConnection = [[MCPConnection alloc] initToHost:[self host]
+ withLogin:[self user]
+ usingPort:([[self port] length]?[[self port] integerValue]:3306)];
+ }
+ }
+
+ // Only set the password if there is no Keychain item set. The connection will ask the delegate for passwords in the Keychain.
+ if (!connectionKeychainItemName && [self password]) {
+ [mySQLConnection setPassword:[self password]];
+ }
+
+ // Connection delegate must be set before actual connection attempt is made
+ [mySQLConnection setDelegate:tableDocument];
+
+ // Set whether or not we should enable delegate logging according to the prefs
+ [mySQLConnection setDelegateQueryLogging:[prefs boolForKey:SPConsoleEnableLogging]];
+
+ // Set options from preferences
+ [mySQLConnection setConnectionTimeout:[[prefs objectForKey:SPConnectionTimeoutValue] integerValue]];
+ [mySQLConnection setUseKeepAlive:[[prefs objectForKey:SPUseKeepAlive] boolValue]];
+ [mySQLConnection setKeepAliveInterval:[[prefs objectForKey:SPKeepAliveInterval] doubleValue]];
+
+ // Connect
+ [mySQLConnection connect];
+
+ if (![mySQLConnection isConnected]) {
+ if (sshTunnel) {
+
+ // If an SSH tunnel is running, temporarily block to allow the tunnel to register changes in state
+ [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
+
+ // If the state is connection refused, attempt the MySQL connection again with the host using the hostfield value.
+ if ([sshTunnel state] == PROXY_STATE_FORWARDING_FAILED) {
+ if ([sshTunnel localPortFallback]) {
+ [mySQLConnection setPort:[sshTunnel localPortFallback]];
+ [mySQLConnection connect];
+ if (![mySQLConnection isConnected]) {
+ [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
+ }
+ }
+ }
+ }
+
+ if (![mySQLConnection isConnected]) {
+ NSString *errorMessage = @"";
+ if (sshTunnel && [sshTunnel state] == PROXY_STATE_FORWARDING_FAILED) {
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@ because the port connection via SSH was refused.\n\nPlease ensure that your MySQL host is set up to allow TCP/IP connections (no --skip-networking) and is configured to allow connections from the host you are tunnelling via.\n\nYou may also want to check the port is correct and that you have the necessary privileges.\n\nChecking the error detail will show the SSH debug log which may provide more details.\n\nMySQL said: %@", @"message of panel when SSH port forwarding failed"), [self host], [mySQLConnection getLastErrorMessage]];
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"SSH port forwarding failed", @"title when ssh tunnel port forwarding failed") errorMessage:errorMessage detail:[sshTunnel debugMessages]];
+ } else if ([mySQLConnection getLastErrorID] == 1045) { // "Access denied" error
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@ because access was denied.\n\nDouble-check your username and password and ensure that access from your current location is permitted.\n\nMySQL said: %@", @"message of panel when connection to host failed due to access denied error"), [self host], [mySQLConnection getLastErrorMessage]];
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"Access denied!", @"connection failed due to access denied title") errorMessage:errorMessage detail:nil];
+ } else if ([self type] == SPSocketConnection && (![self socket] || ![[self socket] length]) && ![mySQLConnection findSocketPath]) {
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The socket file could not be found in any common location. Please supply the correct socket location.\n\nMySQL said: %@", @"message of panel when connection to socket failed because optional socket could not be found"), [mySQLConnection getLastErrorMessage]];
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"Socket not found!", @"socket not found title") errorMessage:errorMessage detail:nil];
+ } else if ([self type] == SPSocketConnection) {
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect via the socket, or the request timed out.\n\nDouble-check that the socket path is correct and that you have the necessary privileges, and that the server is running.\n\nMySQL said: %@", @"message of panel when connection to host failed"), [mySQLConnection getLastErrorMessage]];
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"Socket connection failed!", @"socket connection failed title") errorMessage:errorMessage detail:nil];
+ } else {
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %ld seconds).\n\nMySQL said: %@", @"message of panel when connection to host failed"), [self host], (long)[[prefs objectForKey:SPConnectionTimeoutValue] integerValue], [mySQLConnection getLastErrorMessage]];
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"Connection failed!", @"connection failed title") errorMessage:errorMessage detail:nil];
+ }
+
+ if (sshTunnel) [sshTunnel release], sshTunnel = nil;
+ [mySQLConnection release], mySQLConnection = nil;
+ [pool release];
+ return;
+ }
+ }
+
+ if ([self database] && ![[self database] isEqualToString:@""]) {
+ if (![mySQLConnection selectDB:[self database]]) {
+ [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"Could not select database", @"message when database selection failed") errorMessage:[NSString stringWithFormat:NSLocalizedString(@"Connected to host, but unable to connect to database %@.\n\nBe sure that the database exists and that you have the necessary privileges.\n\nMySQL said: %@", @"message of panel when connection to db failed"), [self database], [mySQLConnection getLastErrorMessage]] detail:nil];
+ if (sshTunnel) [sshTunnel release], sshTunnel = nil;
+ [mySQLConnection release], mySQLConnection = nil;
+ [pool release];
+ return;
+ }
+ }
+
+ [self performSelectorOnMainThread:@selector(_initiatedMySQLConnectionEstablished) withObject:nil waitUntilDone:NO];
+
+ [pool release];
+}
+
@end
#pragma mark -
diff --git a/Source/CustomQuery.h b/Source/SPCustomQuery.h
index add6be7f..5c95aeb8 100644
--- a/Source/CustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -1,7 +1,7 @@
//
// $Id$
//
-// CustomQuery.h
+// SPCustomQuery.h
// sequel-pro
//
// Created by lorenz textor (lorenz@textor.ch) on Wed May 01 2002.
@@ -49,7 +49,7 @@
@class SPQueryFavoriteManager, SPDataStorage, BWSplitView;
-@interface CustomQuery : NSObject
+@interface SPCustomQuery : NSObject
{
IBOutlet id tableDocumentInstance;
IBOutlet id tablesListInstance;
diff --git a/Source/CustomQuery.m b/Source/SPCustomQuery.m
index 88c4f61c..143e40f8 100644
--- a/Source/CustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1,7 +1,7 @@
//
// $Id$
//
-// CustomQuery.m
+// SPCustomQuery.m
// sequel-pro
//
// Created by lorenz textor (lorenz@textor.ch) on Wed May 01 2002.
@@ -23,7 +23,7 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPSQLParser.h"
#import "SPGrowlController.h"
#import "SPStringAdditions.h"
@@ -47,7 +47,7 @@
#import <BWToolkitFramework/BWToolkitFramework.h>
-@implementation CustomQuery
+@implementation SPCustomQuery
#pragma mark IBAction methods
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 028c2c30..76793e3f 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -29,7 +29,7 @@
#import "SPTablesList.h"
#import "SPTableStructure.h"
#import "SPTableContent.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "TableDump.h"
#import "ImageAndTextCell.h"
#import "SPGrowlController.h"
@@ -2346,7 +2346,7 @@
*/
- (IBAction)exportSelectedTablesAs:(id)sender
{
- [exportControllerInstance exportTables:[tablesListInstance selectedTableItems] asFormat:[sender tag] usingSource:SPTableExport];
+ [exportControllerInstance exportTables:[tablesListInstance selectedTableItems] asFormat:[sender tag]];
}
#pragma mark -
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m
index d30d3a9f..ecb61784 100644
--- a/Source/SPExportInitializer.m
+++ b/Source/SPExportInitializer.m
@@ -33,7 +33,7 @@
#import "SPGrowlController.h"
#import "SPMainThreadTrampoline.h"
#import "SPDatabaseDocument.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPFileHandle.h"
#import "SPAlertSheets.h"
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index 2bfe8715..294799b7 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -26,7 +26,7 @@
#import "SPPrintController.h"
#import "SPTableContent.h"
#import "SPTableStructure.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPConstants.h"
#import "SPTableRelations.h"
#import "SPPrintAccessory.h"
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 538e880b..c142ed3f 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -27,7 +27,7 @@
#import "SPConsoleMessage.h"
#import "SPArrayAdditions.h"
#import "SPConstants.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#define MESSAGE_TRUNCATE_CHARACTER_LENGTH 256
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index c94bc686..8255f9c1 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -90,7 +90,7 @@
// Check if ENTER or RETURN is hit and edit the column.
if([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76))
{
- if (![[[[self delegate] class] description] isEqualToString:@"CustomQuery"] &&
+ if (![[[[self delegate] class] description] isEqualToString:@"SPCustomQuery"] &&
![[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]){
// Ensure that editing is permitted
diff --git a/Source/SPTextView.h b/Source/SPTextView.h
index f074be4a..867d38f6 100644
--- a/Source/SPTextView.h
+++ b/Source/SPTextView.h
@@ -30,13 +30,13 @@
#define SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING 10000
-@class SPNarrowDownCompletion, SPDatabaseDocument, SPTablesList, CustomQuery;
+@class SPNarrowDownCompletion, SPDatabaseDocument, SPTablesList, SPCustomQuery;
@interface SPTextView : NSTextView
{
IBOutlet SPDatabaseDocument *tableDocumentInstance;
IBOutlet SPTablesList *tablesListInstance;
- IBOutlet CustomQuery *customQueryInstance;
+ IBOutlet SPCustomQuery *customQueryInstance;
BOOL autoindentEnabled;
BOOL autopairEnabled;
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index bcda54e5..cef42e87 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -23,7 +23,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPTextView.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPDatabaseDocument.h"
#import "SPStringAdditions.h"
#import "SPArrayAdditions.h"
@@ -531,7 +531,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSRange r = [self selectedRange];
- if(![self delegate] || ![[self delegate] isKindOfClass:[CustomQuery class]] || r.length || snippetControlCounter > -1) return;
+ if(![self delegate] || ![[self delegate] isKindOfClass:[SPCustomQuery class]] || r.length || snippetControlCounter > -1) return;
if(r.location) {
NSCharacterSet *ignoreCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"\"'`;,()[]{}=+/<> \t\n\r"];
@@ -2028,8 +2028,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
return;
}
- // Check for {SHIFT}TAB to try to insert query favorite via TAB trigger if SPTextView belongs to CustomQuery
- if ([theEvent keyCode] == 48 && [self isEditable] && [[self delegate] isKindOfClass:[CustomQuery class]]){
+ // Check for {SHIFT}TAB to try to insert query favorite via TAB trigger if SPTextView belongs to SPCustomQuery
+ if ([theEvent keyCode] == 48 && [self isEditable] && [[self delegate] isKindOfClass:[SPCustomQuery class]]){
NSRange targetRange = [self getRangeForCurrentWord];
NSString *tabTrigger = [[self string] substringWithRange:targetRange];
@@ -2702,7 +2702,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[[self queryEditorBackgroundColor] setFill];
NSRectFill(rect);
- if([[self delegate] isKindOfClass:[CustomQuery class]]) {
+ if([[self delegate] isKindOfClass:[SPCustomQuery class]]) {
// Highlightes the current query if set in the Pref and no snippet session
// and if nothing is selected in the text view
@@ -2892,7 +2892,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
// Validate Select Active Query
if ([menuItem action] == @selector(selectCurrentQuery)) {
- return ([self isEditable] && [[self delegate] isKindOfClass:[CustomQuery class]]);
+ return ([self isEditable] && [[self delegate] isKindOfClass:[SPCustomQuery class]]);
}
// Disable "Copy with Column Names" and "Copy as SQL INSERT"
// in the main menu
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 22e59597..feb82a43 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -28,7 +28,7 @@
#import "SPTablesList.h"
#import "SPTableStructure.h"
#import "SPTableContent.h"
-#import "CustomQuery.h"
+#import "SPCustomQuery.h"
#import "SPGrowlController.h"
#import "SPSQLParser.h"
#import "SPCSVParser.h"