aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Resources/English.lproj/DataMigrationDialog.stringsbin15340 -> 18292 bytes
-rw-r--r--Resources/English.lproj/ImportAccessory.stringsbin7442 -> 7436 bytes
-rw-r--r--Resources/English.lproj/Localizable.stringsbin168700 -> 169886 bytes
-rw-r--r--Source/SPTableContent.h1
-rw-r--r--Source/SPTableContent.m46
5 files changed, 26 insertions, 21 deletions
diff --git a/Resources/English.lproj/DataMigrationDialog.strings b/Resources/English.lproj/DataMigrationDialog.strings
index 89aa301d..1280b4cd 100644
--- a/Resources/English.lproj/DataMigrationDialog.strings
+++ b/Resources/English.lproj/DataMigrationDialog.strings
Binary files differ
diff --git a/Resources/English.lproj/ImportAccessory.strings b/Resources/English.lproj/ImportAccessory.strings
index 88e4758a..058feae0 100644
--- a/Resources/English.lproj/ImportAccessory.strings
+++ b/Resources/English.lproj/ImportAccessory.strings
Binary files differ
diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings
index e39c1a96..88766593 100644
--- a/Resources/English.lproj/Localizable.strings
+++ b/Resources/English.lproj/Localizable.strings
Binary files differ
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index b82eb7c3..f88d6fe9 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -159,6 +159,7 @@
- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(NSUInteger)targetRowCount;
- (BOOL)addRowToDB;
- (NSString *)argumentForRow:(NSInteger)row;
+- (NSString *)argumentForRow:(NSInteger)row excludingLimits:(BOOL)excludeLimits;
- (NSString *)argumentForRow:(NSUInteger)rowIndex ofTable:(NSString *)tableForColumn andDatabase:(NSString *)database includeBlobs:(BOOL)includeBlobs;
- (BOOL)tableContainsBlobOrTextColumns;
- (NSString *)fieldListForQuery;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index b57678e5..30329809 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1626,6 +1626,10 @@
[mySQLConnection queryString:[NSString stringWithFormat:@"DELETE FROM %@", [selectedTable backtickQuotedString]]];
if ( ![mySQLConnection queryErrored] ) {
+ maxNumRows = 0;
+ tableRowsCount = 0;
+ maxNumRowsIsEstimate = NO;
+ [self updateCountText];
// Reset auto increment if suppression button was ticked
if([[alert suppressionButton] state] == NSOnState) {
@@ -1684,6 +1688,7 @@
}
[tableContentView selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO];
+ NSInteger affectedRows = 0;
errors = 0;
// Disable updating of the Console Log window for large number of queries
@@ -1738,6 +1743,8 @@
if(!reloadAfterRemovingRow)
[selectedRows removeIndex:index];
errors++;
+ } else {
+ affectedRows++;
}
} else {
if(!reloadAfterRemovingRow)
@@ -1750,7 +1757,6 @@
// if table has only one PRIMARY KEY
// delete the fast way by using the PRIMARY KEY in an IN clause
NSMutableString *deleteQuery = [NSMutableString string];
- NSInteger affectedRows = 0;
[deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE %@ IN (", [selectedTable backtickQuotedString], [NSArrayObjectAtIndex(primaryKeyFieldNames,0) backtickQuotedString]]];
@@ -1793,7 +1799,6 @@
// if table has more than one PRIMARY KEY
// delete the row by using all PRIMARY KEYs in an OR clause
NSMutableString *deleteQuery = [NSMutableString string];
- NSInteger affectedRows = 0;
[deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE ", [selectedTable backtickQuotedString]]];
@@ -1801,23 +1806,7 @@
// Build the AND clause of PRIMARY KEYS
[deleteQuery appendString:@"("];
- for(NSString *primaryKeyFieldName in primaryKeyFieldNames) {
-
- id keyValue = [tableValues cellDataAtRow:index column:[[[tableDataInstance columnWithName:primaryKeyFieldName] objectForKey:@"datacolumnindex"] integerValue]];
-
- [deleteQuery appendString:[primaryKeyFieldName backtickQuotedString]];
- if ([keyValue isKindOfClass:[NSData class]]) {
- [deleteQuery appendString:@"=X'"];
- [deleteQuery appendString:[mySQLConnection prepareBinaryData:keyValue]];
- } else {
- [deleteQuery appendString:@"='"];
- [deleteQuery appendString:[mySQLConnection prepareString:[keyValue description]]];
- }
- [deleteQuery appendString:@"' AND "];
- }
-
- // Remove the trailing AND and add the closing bracket
- [deleteQuery deleteCharactersInRange:NSMakeRange([deleteQuery length]-5, 5)];
+ [deleteQuery appendString:[self argumentForRow:index excludingLimits:YES]];
[deleteQuery appendString:@")"];
// Split deletion query into 64k chunks
@@ -1850,6 +1839,10 @@
// Restore Console Log window's updating bahaviour
[[SPQueryController sharedQueryController] setAllowConsoleUpdate:consoleUpdateStatus];
+ maxNumRows -= affectedRows;
+ tableRowsCount -= affectedRows;
+ [self updateCountText];
+
if (errors) {
NSArray *message;
//TODO: The following three messages are NOT localisable!
@@ -2475,13 +2468,24 @@
return NO;
}
-/*
+/**
* Returns the WHERE argument to identify a row.
* If "row" is -2, it uses the oldRow.
* Uses the primary key if available, otherwise uses all fields as argument and sets LIMIT to 1
*/
- (NSString *)argumentForRow:(NSInteger)row
{
+ return [self argumentForRow:row excludingLimits:NO];
+}
+
+/**
+ * Returns the WHERE argument to identify a row.
+ * If "row" is -2, it uses the oldRow value.
+ * "excludeLimits" controls whether a LIMIT 1 is appended if no primary key was available to
+ * uniquely identify the row.
+ */
+- (NSString *)argumentForRow:(NSInteger)row excludingLimits:(BOOL)excludeLimits
+{
MCPResult *theResult;
NSDictionary *theRow;
id tempValue;
@@ -2565,7 +2569,7 @@
}
}
- if (setLimit) [argument appendString:@" LIMIT 1"];
+ if (setLimit && !excludeLimits) [argument appendString:@" LIMIT 1"];
return argument;
}