diff options
author | Max <post@wickenrode.com> | 2014-03-05 03:36:32 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2014-03-05 03:36:32 +0100 |
commit | b67728258595b7ce256ea50485ee6e6cb8137ac8 (patch) | |
tree | eab934d5e0ddfd4a10b35760876d4e1b76c4d879 /Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m | |
parent | 5c0212a51d21f06f3beb62059b0b17c6ee1d8c91 (diff) | |
download | sequelpro-b67728258595b7ce256ea50485ee6e6cb8137ac8.tar.gz sequelpro-b67728258595b7ce256ea50485ee6e6cb8137ac8.tar.bz2 sequelpro-b67728258595b7ce256ea50485ee6e6cb8137ac8.zip |
Add support for SQLSTATE
This commit adds the backend code to get the mysql SQLSTATE error code (to be used when displaying errors).
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m')
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m index cf08f749..79d5060a 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m @@ -165,6 +165,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS // Start with a blank error state queryErrorID = 0; queryErrorMessage = nil; + querySqlstate = nil; // Start with empty cancellation details lastQueryWasCancelled = NO; @@ -231,6 +232,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS if (databaseToRestore) [databaseToRestore release], databaseToRestore = nil; if (serverVersionString) [serverVersionString release], serverVersionString = nil; if (queryErrorMessage) [queryErrorMessage release], queryErrorMessage = nil; + if (querySqlstate) [querySqlstate release], querySqlstate = nil; [delegateDecisionLock release]; [NSObject cancelPreviousPerformRequestsWithTarget:self]; @@ -465,6 +467,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS // Clear the connection error record [self _updateLastErrorID:NSNotFound]; [self _updateLastErrorMessage:nil]; + [self _updateLastSqlstate:nil]; // Unlock the connection [self _unlockConnection]; @@ -566,6 +569,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS if (isMaster) { [self _updateLastErrorMessage:[self _stringForCString:mysql_error(theConnection)]]; [self _updateLastErrorID:mysql_errno(theConnection)]; + [self _updateLastSqlstate:[self _stringForCString:mysql_sqlstate(theConnection)]]; } return NULL; |