Bug #17683 | LOAD DATA INFILE loads wrong value for BIT columns | ||
---|---|---|---|
Submitted: | 24 Feb 2006 0:59 | Modified: | 6 Apr 2006 19:16 |
Reporter: | Ruby Muse | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.0.18 | OS: | Linux (Linux 2.4.31-ow1) |
Assigned to: | Paul DuBois | CPU Architecture: | Any |
[24 Feb 2006 0:59]
Ruby Muse
[28 Feb 2006 5:10]
Ruby Muse
When I use PHP's pack() function to write binary data in the text file, LOAD DATA INFILE loads the proper values into the BIT field. It would be nice if the values could be written in hex or decimal, and if the LOAD DATA INFILE doc explicitly stated what format is expected.
[2 Apr 2006 13:36]
Valeriy Kravchuk
Thank you for a problem report. Here is one way to solve the problem: openxs@suse:~/dbs/5.0> cat /tmp/bit_test.txt 2 127 openxs@suse:~/dbs/5.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 to server version: 5.0.21 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> load data infile '/tmp/bit_test.txt' into table bit_test (@var1) set b= cast(@var1 as signed); Query OK, 2 rows affected (0.00 sec) Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 mysql> select bin(b+0) from bit_test; .txt' into +----------+ | bin(b+0) | +----------+ | 10 | | 1111111 | +----------+ 2 rows in set (0.00 sec) But you are right - loading of BIT values should be explicitely documented. So, it is a verified documentation request.
[6 Apr 2006 19:16]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant product(s).