I want to store a SHA1 hash into a BINARY(20) column. I tried it by preparing INSERT INTO foo SET ( hash=? )
followed by executing the statement binding to a variable containing the 20-byte binary value, but got a runtime syntax error "... hash='\0\0#*$^!...'". (I'm baffled why executing a prepared statement would represent values like this.) This post doesn't indicate there's anything wrong with storing a SHA1 into a BINARY(20) column, but doesn't indicate how it's done with SQL.
UPDATE: "Why binary and not hex?" There will be about a billion rows, so 20 extra bytes is significant, and also I'm told that numeric lookups are twice as fast as string lookups (and that BINARY fields will be treated like numerics)
UPDATE 2: The error message was not complaining about the representation of the binary value, but about the parentheses around the SET list.