diff options
author | rowanbeentje <rowan@beent.je> | 2010-03-25 01:13:12 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-03-25 01:13:12 +0000 |
commit | 32e858b26923b371a93e800687a13edf1254e445 (patch) | |
tree | ff2bac08381f0bd54e01c2f3f756c9fe5a2e2507 /Source/SPTableData.m | |
parent | 5061643c1bf92a3583e4ede059951e1f17befac9 (diff) | |
download | sequelpro-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 'Source/SPTableData.m')
-rw-r--r-- | Source/SPTableData.m | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 2b07fbce..1807b66e 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -330,7 +330,7 @@ [theResult setReturnDataAsStrings:YES]; // Check for any errors, but only display them if a connection still exists - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) { SPBeginAlertSheet(NSLocalizedString(@"Error retrieving table information", @"error retrieving table information message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil, nil, @@ -598,7 +598,7 @@ [theResult setReturnDataAsStrings:YES]; // Check for any errors, but only display them if a connection still exists - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) { SPBeginAlertSheet(NSLocalizedString(@"Error retrieving table information", @"error retrieving table information message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil, nil, @@ -692,7 +692,7 @@ [theResult setReturnDataAsStrings:YES]; // Check for any errors, but only display them if a connection still exists - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) { SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil, nil, @@ -711,7 +711,7 @@ [theResult setReturnDataAsStrings:YES]; // Check for any errors, but only display them if a connection still exists - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) { SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil, nil, @@ -809,7 +809,7 @@ } // Check for any errors, only displaying them if the connection hasn't been terminated - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) { SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil, nil, @@ -840,7 +840,7 @@ // this happens e.g. for db "information_schema" if([[status objectForKey:@"Rows"] isKindOfClass:[NSNull class]]) { tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [escapedTableName backtickQuotedString] ]]; - if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) + if (![mySQLConnection queryErrored]) [status setObject:[[tableStatusResult fetchRowAsArray] objectAtIndex:0] forKey:@"Rows"]; [status setObject:@"y" forKey:@"RowsCountAccurate"]; } @@ -1064,7 +1064,7 @@ if([r numOfRows] < 1) return nil; - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + if ([mySQLConnection queryErrored]) { if ([mySQLConnection isConnected]) NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while retrieving the PRIAMRY KEY data:\n\n%@", [mySQLConnection getLastErrorMessage]], @"OK", nil, nil); return nil; |