diff options
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories')
3 files changed, 36 insertions, 5 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"); |