Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
11.8.3
-
None
Description
Please verify findings below:
odbc syntax:
select hex(0xff & 0xf0);
|
+------------------+
|
| hex(0xff & 0xf0) |
|
+------------------+
|
| F0 |
|
+------------------+
|
|
... result is correct.
SQL syntax:
select hex(x'ff' & x'f0');
|
+--------------------+
|
| hex(x'ff' & x'f0') |
|
+--------------------+
|
| 0 |
|
+--------------------+
|
result is wrong.
... and two warnings:
+---------+------+-------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+-------------------------------------------+
|
| Warning | 1292 | Truncated incorrect DECIMAL value: '\xFF' |
|
| Warning | 1292 | Truncated incorrect DECIMAL value: '\xF0' |
|
+---------+------+-------------------------------------------+
|
Output of bitwise operations remains rather unexpected when capitals get used with SQL style:
select hex(X'FF' & X'F0');
|
+--------------------+
|
| hex(X'FF' & X'F0') |
|
+--------------------+
|
| 0 |
|
+--------------------+
|
'incorrect decimal values' warnings get generated as well.
at last:
select hex((0xff+0) & (0x7f+0));
|
+--------------------------+
|
| hex((0xff+0) & (0x7f+0)) |
|
+--------------------------+
|
| 7F |
|
+--------------------------+
|
vs.
select hex((x'ff'+0) & (x'7f'+0));
|
+----------------------------+
|
| hex((x'ff'+0) & (x'7f'+0)) |
|
+----------------------------+
|
| 0 |
|
+----------------------------+
|
Last command: warnings gone, result remains wrong.
Above findings were verified with bitwise operator '|' as well.
Conclusions:
- odbc syntax of hex operands causes maria to execute bitwise logical operations.
- SQL syntax of hex operands causes maria to convert hex to integer in background, prior to request processing.
Best Regards.