Bug #16511 Decimal data types broken with prepared statements
Submitted: 15 Jan 2006 1:12 Modified: 14 Feb 2006 3:21
Reporter: Eric Huss (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0/5.1 OS:Any (all)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[15 Jan 2006 1:12] Eric Huss
Attempting to bind a DECIMAL type parameter with the prepared statement API can cause various errors (such as ER_WRONG_ARGUMENTS) because it is unpacking the packet incorrectly.

How to repeat:
My particular test was trying to insert 2 values, the first of which was a DECIMAL type using the C Prepared Statement API.

Suggested fix:
In set_param_decimal() in sql_prepare.cc the following line:
    *pos+= len;
should be:
    *pos+= length;
[26 Jan 2006 9:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[27 Jan 2006 8:24] Ramil Kalimullin
Eric, thanks a lot for your contribution!
[27 Jan 2006 8:58] Konstantin Osipov
Approved by email: the patch is ok to push with a testcase.
[10 Feb 2006 9:21] Ramil Kalimullin
fixed in 5.0.19
[14 Feb 2006 3:21] Paul Dubois
Noted in 5.0.19 changelog.

          The <literal>DECIMAL</literal> data type was not being handled
           correctly with prepared statements. (Bug #16511)