chandrasis / php-handlersocket

Automatically exported from code.google.com/p/php-handlersocket
0 stars 0 forks source link

Doing PK lookups for columns defined as BINARY does not work.... #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have tried this many different ways. If someone knows how to query by binary 
data, please let me know. You cannot pass a 16-byte MD5 for PK lookup from my 
testing....

What steps will reproduce the problem?
1. Make a table with a primary key defined as binary(16) and a timestamp field 
called timestamp

2. Insert into this column with standard SQL an MD5 such as 
unhex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");

3.
Use the following code in execute single

$retval = 
$hs->executeSingle(1,'=',array(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),1,0);

OR

$retval = 
$hs->executeSingle(1,'=',array('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'),1,0);

OR any bin2hex function and submit the data as pure binary data

What is the expected output? What do you see instead?

Expected output is the timestamp of the row you inserted

What version of the product are you using? On what operating system?

php-handlersocket 0.2.0 Debian

Please provide any additional information below.

Running against Percona Server 5.5.11-55

Original issue reported on code.google.com by reyort...@gmail.com on 10 May 2011 at 2:13

GoogleCodeExporter commented 8 years ago
$hs->executeSingle(1,'=',array(hex2bin("00001b01ce13e5540c41a914f04705e6cea21592
")),1,0);

Works like a charm, on binary(20) indexed field.

Original comment by globalwh...@gmail.com on 30 Jul 2012 at 7:35