aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-03-29 23:55:09 +0000
committerrowanbeentje <rowan@beent.je>2012-03-29 23:55:09 +0000
commit537a96297f236e2c41dd6d18ae317d2211a334a5 (patch)
tree094965db188cfb2ceb15210a864109cc2a750efd /Frameworks/SPMySQLFramework/Source
parente611c3b44b57715a917563f897237fddcaf991c8 (diff)
downloadsequelpro-537a96297f236e2c41dd6d18ae317d2211a334a5.tar.gz
sequelpro-537a96297f236e2c41dd6d18ae317d2211a334a5.tar.bz2
sequelpro-537a96297f236e2c41dd6d18ae317d2211a334a5.zip
- Fix SPMySQL warnings about delegate and proxy methods mixing synthesized getters and manually overridden setters
- Fix autoincrement ID retrieval in SPMySQL, addressing issues previewing rows when the setting for "Reload Table After: Adding a row" is not being used
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.h8
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m28
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m5
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h3
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m3
5 files changed, 37 insertions, 10 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.h b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.h
index cf132fcf..9fa930c5 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.h
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.h
@@ -33,4 +33,12 @@
@interface SPMySQLConnection (Delegate_and_Proxy)
+// Connection delegage
+- (void)setDelegate:(NSObject <SPMySQLConnectionDelegate> *)aDelegate;
+- (NSObject <SPMySQLConnectionDelegate> *)delegate;
+
+// Connection proxy
+- (void)setProxy:(NSObject <SPMySQLConnectionProxy> *)aProxy;
+- (NSObject <SPMySQLConnectionProxy> *)proxy;
+
@end
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m
index 3ac013cc..59e78c35 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m
@@ -39,8 +39,8 @@
#pragma mark Connection delegate
/**
- * Override the synthesized delegate setter, to allow optimisations to oft-made
- * checks by precacheing availability.
+ * Set the delegate of the connection object, precaching availability of
+ * oft-called methods to allow optimisation.
*/
- (void)setDelegate:(NSObject <SPMySQLConnectionDelegate> *)aDelegate
{
@@ -51,12 +51,22 @@
delegateSupportsConnectionLost = [delegate respondsToSelector:@selector(connectionLost:)];
}
+/**
+ * Return the current instance delegate.
+ */
+- (NSObject <SPMySQLConnectionDelegate> *)delegate
+{
+ return delegate;
+}
+
#pragma mark -
#pragma mark Connection proxy
/**
- * Override the synthesized proxy setter, to record the initial state and to
- * set the state change selector.
+ * Set the connection proxy, used by the class to set up a connection pre-requisite, and
+ * monitored for state changes. This allows the MySQL connection to be routed over
+ * another helper class providing a port or socket. This method also records the initial
+ * state and sets the state change selector.
*/
- (void)setProxy:(NSObject <SPMySQLConnectionProxy> *)aProxy
{
@@ -64,7 +74,15 @@
previousProxyState = [aProxy state];
[proxy setConnectionStateChangeSelector:@selector(_proxyStateChange:) delegate:self];
-}
+}
+
+/**
+ * Return the current instance proxy.
+ */
+- (NSObject <SPMySQLConnectionProxy> *)proxy
+{
+ return proxy;
+}
@end
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
index 9b54029c..686be183 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
@@ -330,6 +330,11 @@
NSString *theErrorMessage = [self _stringForCString:mysql_error(mySQLConnection)];
NSUInteger theErrorID = mysql_errno(mySQLConnection);
+ // Update the connection's stored insert ID if available
+ if (mySQLConnection->insert_id) {
+ lastQueryInsertID = mySQLConnection->insert_id;
+ }
+
// If the query was cancelled, override the error state
if (lastQueryWasCancelled) {
theErrorMessage = NSLocalizedString(@"Query cancelled.", @"Query cancelled error");
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
index 8f3b7f9f..8ed01ec6 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
@@ -131,9 +131,6 @@
#pragma mark -
#pragma mark Synthesized properties
-@property (readwrite, assign, nonatomic) NSObject <SPMySQLConnectionDelegate> *delegate;
-@property (readwrite, assign, nonatomic) NSObject <SPMySQLConnectionProxy> *proxy;
-
@property (readwrite, retain) NSString *host;
@property (readwrite, retain) NSString *username;
@property (readwrite, retain) NSString *password;
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
index 17acaf1b..800157ca 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
@@ -54,8 +54,6 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS
#pragma mark -
#pragma mark Synthesized properties
-@synthesize delegate;
-@synthesize proxy;
@synthesize host;
@synthesize username;
@synthesize password;
@@ -124,6 +122,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS
previousEncodingUsesLatin1Transport = NO;
// Initialise default delegate settings
+ delegate = nil;
delegateSupportsWillQueryString = NO;
delegateSupportsConnectionLost = NO;
delegateQueryLogging = YES;