aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-10-16 12:30:38 +0000
committerBibiko <bibiko@eva.mpg.de>2009-10-16 12:30:38 +0000
commit507d0089c6bb73a01129f1e356d1e88ca53afb55 (patch)
tree9b892fb51823de5e7381d70e2330392a418e0f06
parenta57daba74182b3123c47b44996680efd399a471d (diff)
downloadsequelpro-507d0089c6bb73a01129f1e356d1e88ca53afb55.tar.gz
sequelpro-507d0089c6bb73a01129f1e356d1e88ca53afb55.tar.bz2
sequelpro-507d0089c6bb73a01129f1e356d1e88ca53afb55.zip
• fixed three further typos for: objectForKey:@"NullValue"
• allow to enter the NULL value string even if the cell/field's maximal length is set to less then the actual NULL value string length (eg varchar(3) and NULL value string is @"NULL")
-rw-r--r--Source/CMCopyTable.m4
-rw-r--r--Source/CustomQuery.m2
-rw-r--r--Source/SPDataCellFormatter.m4
-rw-r--r--Source/SPFieldEditorController.m10
4 files changed, 11 insertions, 9 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m
index 23bf7804..c0197c0e 100644
--- a/Source/CMCopyTable.m
+++ b/Source/CMCopyTable.m
@@ -133,7 +133,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
if ( nil != rowData )
{
if ([rowData isNSNull])
- [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"nullValue"]]];
+ [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"NullValue"]]];
else if ([rowData isSPNotLoaded])
[result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]];
else
@@ -371,7 +371,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
if ( nil != rowData )
{
if ([rowData isNSNull])
- [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"nullValue"]]];
+ [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"NullValue"]]];
else if ([rowData isSPNotLoaded])
[result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]];
else
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 0589ab6f..323a9078 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1643,7 +1643,7 @@
[fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] intValue]];
id originalData = [[fullResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]];
- if ([originalData isNSNull]) originalData = [prefs objectForKey:@"nullValue"];
+ if ([originalData isNSNull]) originalData = [prefs objectForKey:@"NullValue"];
id editData = [[fieldEditor editWithObject:originalData
fieldName:[columnDefinition objectForKey:@"name"]
diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m
index 5a768686..916568ca 100644
--- a/Source/SPDataCellFormatter.m
+++ b/Source/SPDataCellFormatter.m
@@ -76,8 +76,8 @@
- (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error
{
- // No limit set
- if (textLimit == 0)
+ // No limit set or partialString is NULL value string allow editing
+ if (textLimit == 0 || [partialString isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"NullValue"]])
return YES;
// A single character over the length of the string - likely typed. Prevent the change.
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index bdb78726..83a63d6b 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -346,10 +346,10 @@
editSheetReturnCode = 0;
// Validate the sheet data before saving them.
- // - for max text length select the part which won't be saved
+ // - for max text length (except for NULL value string) select the part which won't be saved
// and suppress closing the sheet
if(sender == editSheetOkButton) {
- if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength) {
+ if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:@"NullValue"]]) {
[editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
[editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)];
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %d.", @"Text is too long. Maximum text length is set to %d."), maxTextLength]];
@@ -833,11 +833,13 @@
#pragma mark Delegates
/*
- Validate editTextView for max text length
+ Validate editTextView for max text length except for NULL value string
*/
- (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)r replacementString:(NSString *)replacementString
{
- if(textView == editTextView && maxTextLength > 0) {
+
+ if(textView == editTextView && maxTextLength > 0
+ && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:@"NullValue"]]) {
int newLength;