aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h1
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m10
2 files changed, 10 insertions, 1 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index 45491884..25ef7d36 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -204,6 +204,7 @@ void performThreadedKeepAlive(void *ptr);
- (BOOL)selectDB:(NSString *)dbName;
// Error information
+- (BOOL)queryErrored;
- (NSString *)getLastErrorMessage;
- (void)setLastErrorMessage:(NSString *)theErrorMessage;
- (NSUInteger)getLastErrorID;
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];
}
/**