diff options
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 9 | ||||
-rw-r--r-- | Source/SPTableContent.m | 13 |
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; |