简体   繁体   中英

MySQL BIT Variable Type Altering Data

I have a table with two columns and two variable types.

CATEGORY VARCHAR(64)

HASH BIT(49)

I'm using a php page to insert new values each time they are found.

Here is an example insertion statement:

INSERT INTO `HASH` (HASH, CATEGORY) VALUES (0b1001010010110101011100111000101000010100001110001, 'foo');

The query executes fine, but here's the problem.

Now, when I look in my database, the 'foo' hash value is this:

1001100100011011100110000001100010011010000110000

When the original value was:

1001010010110101011100111000101000010100001110001

Why is this? And how can I fix it?

The error must be located somewhere else.

The code works. See this SQLFiddle example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM