aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-07-15 10:57:32 +0000
committerstuconnolly <stuart02@gmail.com>2010-07-15 10:57:32 +0000
commitb21ab51d37672f7e5934938d0ffde641f4de3a26 (patch)
tree0a2b670bebcaa55e046019794270beac0a699f6e /Source/SPCustomQuery.m
parent11bd9d4da5e42d5914b50c1f149d38ce6df863e7 (diff)
downloadsequelpro-b21ab51d37672f7e5934938d0ffde641f4de3a26.tar.gz
sequelpro-b21ab51d37672f7e5934938d0ffde641f4de3a26.tar.bz2
sequelpro-b21ab51d37672f7e5934938d0ffde641f4de3a26.zip
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).
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m4
1 files changed, 2 insertions, 2 deletions
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]];