aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-01-14 01:04:22 +0000
committerrowanbeentje <rowan@beent.je>2011-01-14 01:04:22 +0000
commiteec292b2a6a348f061630bebc5bfd7d39aa57ea0 (patch)
treebab76a82233b0a2bf28bf013d5f8b03394bae6cf
parentae9a0c3c701429a6e0cd379245a4690e1933818a (diff)
downloadsequelpro-eec292b2a6a348f061630bebc5bfd7d39aa57ea0.tar.gz
sequelpro-eec292b2a6a348f061630bebc5bfd7d39aa57ea0.tar.bz2
sequelpro-eec292b2a6a348f061630bebc5bfd7d39aa57ea0.zip
- Fix problems correctly resetting state when a query affects no rows on creating new tables; this could be responsible for -release errors in SPDataStorage, as well as out-of-bounds errors in SPDataStorage or SPTableContent.
- Fix incorrect reporting of affected rows in MCPKit due to the use of meta/status queries; only track affected rows for framework-usage queries (already largely implemented in previous revisions)
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m9
-rw-r--r--Source/SPTableContent.m13
2 files changed, 16 insertions, 6 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index af5e6123..3556e9d7 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1899,13 +1899,14 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
}
/**
- * Returns the number of affected rows by the last query.
+ * Returns the number of affected rows by the last query. Only actual queries
+ * supplied via queryString:, streamingQueryString:, streamingQueryString:useLowMemoryBlockingStreaming:
+ * or queryString:usingEncoding:streamingResult: will have their affected rows
+ * returned, not any "meta" type queries.
*/
- (my_ulonglong)affectedRows
{
- if (mConnected) {
- return mysql_affected_rows(mConnection);
- }
+ if (mConnected) return lastQueryAffectedRows;
return 0;
}
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 6213549d..064b08f1 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2498,10 +2498,19 @@
} else {
NSBeep();
}
- [tableValues replaceRowAtIndex:currentlyEditingRow withRowContents:oldRow];
+
+ // If creating a new row, remove the row; otherwise revert the row contents
+ if (isEditingNewRow) {
+ tableRowsCount--;
+ [tableValues removeRowAtIndex:currentlyEditingRow];
+ [self updateCountText];
+ isEditingNewRow = NO;
+ } else {
+ [tableValues replaceRowAtIndex:currentlyEditingRow withRowContents:oldRow];
+ }
isEditingRow = NO;
- isEditingNewRow = NO;
currentlyEditingRow = -1;
+ [tableContentView reloadData];
[[SPQueryController sharedQueryController] showErrorInConsole:NSLocalizedString(@"/* WARNING: No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db") connection:[tableDocumentInstance name]];
return YES;