diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-10-15 18:13:52 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-10-15 18:13:52 +0000 |
commit | ef09fbe186a06c36eb2e073c0e3f8ef6c1fdde65 (patch) | |
tree | a6f258f852923a791ce33b4cc166c1696774cf60 /Source/TableContent.m | |
parent | 8e524f7266f284d3150ee13d77fd63cfffb8ec10 (diff) | |
download | sequelpro-ef09fbe186a06c36eb2e073c0e3f8ef6c1fdde65.tar.gz sequelpro-ef09fbe186a06c36eb2e073c0e3f8ef6c1fdde65.tar.bz2 sequelpro-ef09fbe186a06c36eb2e073c0e3f8ef6c1fdde65.zip |
• fixed issue for closing the sheet for deleting/adding row(s) explicitly due to the fact that SP would crash if an error alert sheet follows
• fixed NULL value detection in method 'argumentForRow'
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
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 28 |
1 files changed, 15 insertions, 13 deletions
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]; } |