aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-25 01:13:12 +0000
committerrowanbeentje <rowan@beent.je>2010-03-25 01:13:12 +0000
commit32e858b26923b371a93e800687a13edf1254e445 (patch)
treeff2bac08381f0bd54e01c2f3f756c9fe5a2e2507 /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
parent5061643c1bf92a3583e4ede059951e1f17befac9 (diff)
downloadsequelpro-32e858b26923b371a93e800687a13edf1254e445.tar.gz
sequelpro-32e858b26923b371a93e800687a13edf1254e445.tar.bz2
sequelpro-32e858b26923b371a93e800687a13edf1254e445.zip
- Make [MCPConnection getLastErrorMessage] more consistent by always returning nil if no error occurred (previously a blank string was returned most of the time)
- Add a new (BOOL)[MCPConnection queryErrored] method, changing all error message checks to use it for clarity
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 8c3ffbd4..94fb4434 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1155,6 +1155,14 @@ void performThreadedKeepAlive(void *ptr)
#pragma mark Error information
/**
+ * Returns whether the last query errored or not.
+ */
+- (BOOL)queryErrored
+{
+ return (lastQueryErrorMessage)?YES:NO;
+}
+
+/**
* Returns a string with the last MySQL error message on the connection.
*/
- (NSString *)getLastErrorMessage
@@ -1172,7 +1180,7 @@ void performThreadedKeepAlive(void *ptr)
if (!theErrorMessage) theErrorMessage = [self stringWithCString:mysql_error(mConnection)];
if (lastQueryErrorMessage) [lastQueryErrorMessage release], lastQueryErrorMessage = nil;
- lastQueryErrorMessage = [[NSString alloc] initWithString:theErrorMessage];
+ if (theErrorMessage && [theErrorMessage length]) lastQueryErrorMessage = [[NSString alloc] initWithString:theErrorMessage];
}
/**