diff options
author | rowanbeentje <rowan@beent.je> | 2010-12-13 02:00:25 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-12-13 02:00:25 +0000 |
commit | d607a28b78cd0256eff3cb71a2d33646a5b6d131 (patch) | |
tree | 2718681e3364f195272b3c69283f465a3b12566b /Source/SPCopyTable.m | |
parent | b2015bc3974c04557492bb4a698776824ab6689d (diff) | |
download | sequelpro-d607a28b78cd0256eff3cb71a2d33646a5b6d131.tar.gz sequelpro-d607a28b78cd0256eff3cb71a2d33646a5b6d131.tar.bz2 sequelpro-d607a28b78cd0256eff3cb71a2d33646a5b6d131.zip |
- When saving rows in the table content view, only include those fields which have altered values in the UPDATE query, improving speed and reducing the chance of issues when copying queries or altering rapidly changing tables. This addresses Issue #527; thanks to Tobias Mollstam for contributing a patch which prompted this update.
- Rename SPTableContent's "addRowToDB" to "saveRowToTable" for clarity, and clean up the code for speed and clarity
- Correctly save numeric fields as NULL if the value is blanked
Diffstat (limited to 'Source/SPCopyTable.m')
-rw-r--r-- | Source/SPCopyTable.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 7a132348..6b9383ab 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -973,8 +973,8 @@ NSInteger kBlobAsImageFile = 4; // Save the current line if it's the last field in the table if ( [self numberOfColumns] - 1 == column ) { - if([[self delegate] respondsToSelector:@selector(addRowToDB)]) - [[self delegate] addRowToDB]; + if([[self delegate] respondsToSelector:@selector(saveRowToTable)]) + [[self delegate] saveRowToTable]; [[self window] makeFirstResponder:self]; } else { // Select the next field for editing @@ -991,8 +991,8 @@ NSInteger kBlobAsImageFile = 4; // Save the current line if it's the last field in the table if ( column < 1 ) { - if([[self delegate] respondsToSelector:@selector(addRowToDB)]) - [[self delegate] addRowToDB]; + if([[self delegate] respondsToSelector:@selector(saveRowToTable)]) + [[self delegate] saveRowToTable]; [[self window] makeFirstResponder:self]; } else { // Select the previous field for editing @@ -1010,8 +1010,8 @@ NSInteger kBlobAsImageFile = 4; return YES; [[control window] makeFirstResponder:control]; - if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(addRowToDB)]) - [[self delegate] addRowToDB]; + if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) + [[self delegate] saveRowToTable]; return YES; } @@ -1028,10 +1028,10 @@ NSInteger kBlobAsImageFile = 4; if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check if we're already at the end of the list [[control window] makeFirstResponder:control]; - if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(addRowToDB)]) - [[self delegate] addRowToDB]; + if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) + [[self delegate] saveRowToTable]; - if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check again. addRowToDB could reload the table and change the number of rows + if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check again. saveRowToTable could reload the table and change the number of rows if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too [self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; @@ -1051,10 +1051,10 @@ NSInteger kBlobAsImageFile = 4; NSUInteger newRow = row-1; [[control window] makeFirstResponder:control]; - if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(addRowToDB)]) - [[self delegate] addRowToDB]; + if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) + [[self delegate] saveRowToTable]; - if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; // addRowToDB could reload the table and change the number of rows + if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; // saveRowToTable could reload the table and change the number of rows if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too [self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; |