diff options
author | rowanbeentje <rowan@beent.je> | 2010-12-13 02:25:06 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-12-13 02:25:06 +0000 |
commit | 3adfcf0898f78a8459aedd46be5e89ec906f0314 (patch) | |
tree | 36c9863b70a0f804f1a41bb29b3f172501147049 /Source | |
parent | d607a28b78cd0256eff3cb71a2d33646a5b6d131 (diff) | |
download | sequelpro-3adfcf0898f78a8459aedd46be5e89ec906f0314.tar.gz sequelpro-3adfcf0898f78a8459aedd46be5e89ec906f0314.tar.bz2 sequelpro-3adfcf0898f78a8459aedd46be5e89ec906f0314.zip |
- Remove the CURRENT_TIMESTAMP workaround when saving rows as r3013 removes the need for it; this also improves speed slightly as non-changed rows can be skipped much earlier
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTableContent.m | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 1f4889d7..82282b5d 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2402,25 +2402,19 @@ // preference setting is enabled, and don't need to be saved back to the table. if ([rowObject isSPNotLoaded]) continue; - // Prepare to derive the value to save, also tracking whether the field has changed. - BOOL fieldValueHasChanged = (isEditingNewRow || ![rowObject isEqual:NSArrayObjectAtIndex(oldRow, i)]); + // If an edit has taken place, and the field value hasn't changed, the value + // can also be skipped + if (!isEditingNewRow && [rowObject isEqual:NSArrayObjectAtIndex(oldRow, i)]) continue; + + // Prepare to derive the value to save NSString *fieldValue; NSString *fieldTypeGroup = [NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"typegrouping"]; - // Catch CURRENT_TIMESTAMP automatic updates - if the row is new and the cell value matches - // the default value, or if the cell hasn't changed, update the current timestamp. - if ([[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"onupdatetimestamp"] integerValue] - && ( (isEditingNewRow && [rowObject isEqualTo:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"default"]]) - || (!isEditingNewRow && [rowObject isEqualTo:NSArrayObjectAtIndex(oldRow, i)]))) - { - fieldValue = @"CURRENT_TIMESTAMP"; - fieldValueHasChanged = YES; - // Use NULL when the user has entered the nullValue string defined in the preferences, // or when a numeric field is empty. - } else if ([rowObject isNSNull] - || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"]) - && [[rowObject description] isEqualToString:@""])) + if ([rowObject isNSNull] + || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"]) + && [[rowObject description] isEqualToString:@""])) { fieldValue = @"NULL"; @@ -2454,9 +2448,6 @@ } } - // If the field value hasn't changed (only occurs while editing!), continue without saving - if (!fieldValueHasChanged) continue; - // Store the key and value in the ordered arrays for saving. [rowFieldsToSave addObject:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"]]; [rowValuesToSave addObject:fieldValue]; |