aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPConnectionDelegate.m2
-rw-r--r--Source/SPDatabaseViewController.h3
-rw-r--r--Source/SPDatabaseViewController.m3
-rw-r--r--Source/SPSSHTunnel.h5
-rw-r--r--Source/SPSSHTunnel.m2
-rw-r--r--Source/SPTablesList.h2
-rw-r--r--Source/SPTablesList.m21
7 files changed, 23 insertions, 15 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index 0d41a3ac..6b6a4dd1 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -123,7 +123,7 @@
*/
- (SPMySQLConnectionLostDecision)connectionLost:(id)connection
{
- NSInteger connectionErrorCode = SPMySQLConnectionLostDisconnect;
+ SPMySQLConnectionLostDecision connectionErrorCode = SPMySQLConnectionLostDisconnect;
// Only display the reconnect dialog if the window is visible
if ([self parentWindow] && [[self parentWindow] isVisible]) {
diff --git a/Source/SPDatabaseViewController.h b/Source/SPDatabaseViewController.h
index f84d81cd..b323ef9d 100644
--- a/Source/SPDatabaseViewController.h
+++ b/Source/SPDatabaseViewController.h
@@ -25,7 +25,6 @@
#import "SPDatabaseDocument.h"
-
@interface SPDatabaseDocument (SPDatabaseViewController)
// Getters
@@ -49,7 +48,7 @@
- (void)setStatusRequiresReload:(BOOL)reload;
// Table control
-- (void)loadTable:(NSString *)aTable ofType:(NSInteger)aTableType;
+- (void)loadTable:(NSString *)aTable ofType:(SPTableType)aTableType;
#ifndef SP_REFACTOR /* method decls */
- (NSView *)databaseView;
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index da20b967..485a3cfa 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -287,9 +287,8 @@
* If this method is supplied with the currently selected name, a reload rather than
* a load will be triggered.
*/
-- (void)loadTable:(NSString *)aTable ofType:(NSInteger)aTableType
+- (void)loadTable:(NSString *)aTable ofType:(SPTableType)aTableType
{
-
// Ensure a connection is still present
if (![mySQLConnection isConnected]) return;
diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h
index 0984cd43..4466e399 100644
--- a/Source/SPSSHTunnel.h
+++ b/Source/SPSSHTunnel.h
@@ -23,8 +23,7 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-#import <SPMySQL/SPMySQLConnectionProxy.h>
-#import <SPMySQL/SPMySQLConstants.h>
+#import <SPMySQL/SPMySQL.h>
@interface SPSSHTunnel : NSObject <SPMySQLConnectionProxy>
{
@@ -51,7 +50,7 @@
NSInteger remotePort;
NSUInteger localPort;
NSUInteger localPortFallback;
- NSInteger connectionState;
+ SPMySQLConnectionProxyState connectionState;
NSLock *answerAvailableLock;
NSString *currentKeyName;
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 4839c886..106f8774 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -166,11 +166,11 @@
*/
- (SPMySQLConnectionProxyState)state
{
-
// See if an auth dialog is up
if (![answerAvailableLock tryLock]) {
return SPMySQLProxyWaitingForAuth;
}
+
[answerAvailableLock unlock];
// Return the currently recorded state
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index 897fb6b3..f8043747 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -121,7 +121,7 @@
NSMutableArray *filteredTables;
NSMutableArray *tableTypes;
NSMutableArray *filteredTableTypes;
- NSInteger selectedTableType;
+ SPTableType selectedTableType;
NSString *selectedTableName;
BOOL isTableListFiltered;
BOOL tableListIsSelectable;
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 3a866bf7..844505a8 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -1318,9 +1318,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[tablesListView deselectAll:nil];
#endif
if (selectedTableName) [selectedTableName release];
+
selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemIndex]];
- selectedTableType = [[tableTypes objectAtIndex:itemIndex] integerValue];
+ selectedTableType = (SPTableType)[[tableTypes objectAtIndex:itemIndex] integerValue];
+
[self updateFilter:self];
+
[tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType];
#ifndef SP_REFACTOR /* table list filtering */
}
@@ -1569,7 +1572,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
*/
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
{
-
// Don't allow selection changes while performing a task.
if (!tableListIsSelectable) return NO;
@@ -1599,8 +1601,11 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[self setSelectionState:nil];
[tableInfoInstance tableChanged:nil];
}
+
if (selectedTableName) [selectedTableName release], selectedTableName = nil;
+
selectedTableType = SPTableTypeNone;
+
return;
}
@@ -1616,6 +1621,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Perform no action if the selected table hasn't actually changed - reselection etc
NSString *newName = [filteredTables objectAtIndex:selectedRowIndex];
SPTableType newType = (SPTableType)[[filteredTableTypes objectAtIndex:selectedRowIndex] integerValue];
+
if ([selectedTableName isEqualToString:newName] && selectedTableType == newType) {
return;
}
@@ -1628,7 +1634,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
selectedTableType = newType;
[tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType];
- if([[SPNavigatorController sharedNavigatorController] syncMode]) {
+ if ([[SPNavigatorController sharedNavigatorController] syncMode]) {
NSMutableString *schemaPath = [NSMutableString string];
[schemaPath setString:[tableDocumentInstance connectionID]];
if([tableDocumentInstance database] && [[tableDocumentInstance database] length]) {
@@ -2256,6 +2262,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Set the selected table name and type, and then update the filter list and the
// selection.
if (selectedTableName) [selectedTableName release];
+
selectedTableName = [[NSString alloc] initWithString:tableName];
selectedTableType = SPTableTypeTable;
@@ -2384,9 +2391,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
{
// get the create syntax
SPMySQLResult *theResult;
- if(selectedTableType == SPTableTypeProc)
+
+ if (selectedTableType == SPTableTypeProc)
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [selectedTableName backtickQuotedString]]];
- else if([self tableType] == SPTableTypeFunc)
+ else if ([self tableType] == SPTableTypeFunc)
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [selectedTableName backtickQuotedString]]];
else
return;
@@ -2471,9 +2479,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Set the selected table name and type, and use updateFilter to update the filter list and selection
if (selectedTableName) [selectedTableName release];
+
selectedTableName = [[NSString alloc] initWithString:[copyTableNameField stringValue]];
selectedTableType = tblType;
+
[self updateFilter:self];
+
[tablesListView scrollRowToVisible:[tablesListView selectedRow]];
[tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType];