Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
schinzelh committed May 11, 2016
1 parent dce2931 commit bb4b252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Abe/DataStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2361,7 +2361,7 @@ def offer_existing_block(store, hash, chain_id):
block_total_satoshis, block_satoshi_seconds,
block_total_ss
FROM block
WHERE block_hash = ?
WHERE block_hash = (_binary ?)
""", (store.hashin(hash),))

if not block_row:
Expand Down

1 comment on commit bb4b252

@dermoth
Copy link

@dermoth dermoth commented on bb4b252 May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hardly think that will be supported by other databases. I really don't like the idea of having to explicitly pass binary data onto a binary column as binary to avoid utf-8 interpretation, this is counter-productive!

The proper fix for this would be to implement the _binary flag in the conversion functions, fortunately there's an even easier way. It seems like you can use this statement at connect time to set the proper default collation:

SET NAMES binary;

If you implement this in a patch, just make sure it also handle reconnections properly - the statement will have to be sent on reconnect too!

NB: It's probably best to use this statement only when using binary data storage.

Please sign in to comment.