From ef09fbe186a06c36eb2e073c0e3f8ef6c1fdde65 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 15 Oct 2009 18:13:52 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20issue=20for=20closing=20the=20sheet?= =?UTF-8?q?=20for=20deleting/adding=20row(s)=20explicitly=20due=20to=20the?= =?UTF-8?q?=20fact=20that=20SP=20would=20crash=20if=20an=20error=20alert?= =?UTF-8?q?=20sheet=20follows=20=E2=80=A2=20fixed=20NULL=20value=20detecti?= =?UTF-8?q?on=20in=20method=20'argumentForRow'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notes: - isSPNotLoaded check has to be implemented in line 1658 - hide blob data "(not loaded)" can be applied for tables which have no primary keys - we have to check the code again here --- Source/TableContent.m | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'Source') diff --git a/Source/TableContent.m b/Source/TableContent.m index 5ceb6682..70904dbd 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1652,19 +1652,16 @@ tempValue = [oldRow objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"datacolumnindex"] intValue]]; } - if ( [tempValue isKindOfClass:[NSData class]] ) { - [value setString:[NSString stringWithFormat:@"X'%@'", [mySQLConnection prepareBinaryData:tempValue]]]; - } else { - [value setString:[tempValue description]]; - } - - if ( [value isNSNull] ) { + if ( [tempValue isNSNull] ) { [argument appendString:[NSString stringWithFormat:@"%@ IS NULL", [NSArrayObjectAtIndex(keys, i) backtickQuotedString]]]; + } else if ( [tempValue isSPNotLoaded] ) { + // TODO } else { - if (! [tempValue isKindOfClass:[NSData class]] ) { + if ( [tempValue isKindOfClass:[NSData class]] ) + [value setString:[NSString stringWithFormat:@"X'%@'", [mySQLConnection prepareBinaryData:tempValue]]]; + else [value setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:value]]]; - } [argument appendString:[NSString stringWithFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; } @@ -1719,7 +1716,7 @@ } } -- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo +- (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo /* if contextInfo == addrow: remain in edit-mode if user hits OK, otherwise cancel editing if contextInfo == removerow: removes row if user hits OK @@ -1732,7 +1729,12 @@ NSInteger i, errors; BOOL consoleUpdateStatus; BOOL reloadAfterRemovingRow = [prefs boolForKey:@"ReloadAfterRemovingRow"]; - + + if([sheet respondsToSelector:@selector(orderOut:)]) + [sheet orderOut:self]; + else if([sheet window] && [[sheet window] respondsToSelector:@selector(orderOut:)]) + [[sheet window] orderOut:self]; + if ( [contextInfo isEqualToString:@"addrow"] ) { [sheet orderOut:self]; @@ -2301,7 +2303,7 @@ // If the selected cell hasn't been loaded, load it. if ([NSArrayObjectAtIndex(NSArrayObjectAtIndex(tableValues, rowIndex), [[aTableColumn identifier] intValue]) isSPNotLoaded]) { - NSString *wherePart = [NSString stringWithString:[self argumentForRow:[tableContentView selectedRow]]]; + NSString *wherePart = [NSString stringWithString:[self argumentForRow:[tableContentView selectedRow]]]; if ([wherePart length] == 0) return NO; // Only get the data for the selected column, not all of them @@ -2314,7 +2316,7 @@ return NO; } - NSArray *tempRow = [tempResult fetchRowAsArray]; + NSArray *tempRow = [tempResult fetchRowAsArray]; [[tableValues objectAtIndex:rowIndex] replaceObjectAtIndex:[[tableContentView tableColumns] indexOfObject:aTableColumn] withObject:[tempRow objectAtIndex:0]]; [tableContentView reloadData]; } -- cgit v1.2.3