Bug #548 about select 0x??
Submitted: 30 May 2003 11:44 Modified: 7 Jun 2003 6:31
Reporter: Meng Wang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Windows (windows 2000 server)
Assigned to: Alexey Botchkov CPU Architecture:Any

[30 May 2003 11:44] Meng Wang
Description:
i have find a bug in selects query.

sorry for my english :(~~

How to repeat:
C:\mysql\bin>mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 4.0.13-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select 0x34;
+------+
| 0x34 |
+------+
| 4    |
+------+
1 row in set (0.00 sec)

mysql> select -0x34;
+-------+
| -0x34 |
+-------+
|   -52 |
+-------+
1 row in set (0.00 sec)

mysql>

i have write a test code with c.

#include <stdio.h>

int main(void)
{
    // test 1
    int test1_1;
    int test1_2;
    
    test1_1 = 0x34;
    test1_2 = 52;
    
    if (test1_1 == test1_2) {
    printf ("GooooooD,you are find a bug.");
    printf ("------ one passed!\n");
    } else {
    printf ("sorry,it's not a bug\n");
    }
    
    //test 2
    
    int test2_1;
    int test2_2;
    
    test2_1 = -0x34;
    test2_2 = -52;
    
    if (test2_1 == test2_2) {
    printf ("Good,test2 end.");
    printf ("------ two passed.\n");
    } else {
    printf ("why?");
    }
    
    return 1;
}
[7 Jun 2003 6:31] Alexey Botchkov
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Look at SELECT 0x34;
In this context MySQL treats 0x34 as ASCII code, so result is the symbol '4'.