From b21ab51d37672f7e5934938d0ffde641f4de3a26 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 15 Jul 2010 10:57:32 +0000 Subject: Improve handling of BIT fields, including: - Exporting BIT fields properly in SQL dumps using b'x' notation. - Properly handling editing of BIT fields in both the content and custom query results views. - Correctly display BIT fields in the content view, where binary values are zero-padded to the specified length of the field. (Note, that the new BIT handling logic has only been added to MCPKit's MCPStreamingResult and MCPResult as the latter does not keep a record of the field's length which the new functionality depends on. Needs to be discussed). --- Source/SPCustomQuery.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/SPCustomQuery.m') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index ebc4f726..02cd25ff 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1671,7 +1671,7 @@ } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) { newObject = @"NULL"; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"bit"]) { - newObject = ((![[anObject description] length] || [[anObject description] isEqualToString:@"0"])?@"0":@"1"); + newObject = [NSString stringWithFormat:@"b'%@'", ((![[anObject description] length] || [[anObject description] isEqualToString:@"0"]) ? @"0" : [anObject description])]; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"date"] && [[anObject description] isEqualToString:@"NOW()"]) { newObject = @"NOW()"; @@ -1681,7 +1681,7 @@ } [mySQLConnection queryString: - [NSString stringWithFormat:@"UPDATE %@.%@ SET %@.%@.%@=%@ %@ LIMIT 1", + [NSString stringWithFormat:@"UPDATE %@.%@ SET %@.%@.%@ = %@ %@ LIMIT 1", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], [columnName backtickQuotedString], newObject, fieldIDQueryString]]; -- cgit v1.2.3