Bug #1700 Decimal Input parameters on a query causes error at
Description:
The following error appears:
[MySQL][ODBC 3.51 Driver][mysqld-4.0.16-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SQL State: 42000
Native: 1064
Executing: 'SELECT Containers.TAG, Containers.CLASS_ID, Containers.EDIT_ID, Containers.ORIGIN, Containers.DESTINATION, Containers.CREATEDDT, Containers.STATUS, Containers.WEIGHT, Containers.CWB, Containers.CWBSOURCEID, Containers.CONTAINERTAG, Containers.POSSESSEDBY FROM Containers WHERE CWB = ? '
At the time when the first parameter is bound (call to SQLBindColumn)
Under the following circumstances:
1) This is the first time that a statement has been prepared with an input parameter which is DECIMAL(19,4) on THIS TABLE
2) The input parameters are bound before the columns are bound.
IE
Prepare (SQLPrepare)
Bind Parameters (SQLBindParameter)
Bind Columns (SQLBindColumn) ' At the First column binding this throws the above error.
Execute (SQLExecute)
NO error happens if the order is changed to
Prepare (SQLPrepare)
Bind Columns (SQLBindColumn)
Bind Parameters (SQLBindParameter)
Execute (SQLExecute)
How to repeat:
1) Build the table def below.
2) Prepare the SQL in the description just after the ODBC Driver error (which looks to originate from the engine to me) on a statement (SQLPrepare)
3) Bind the Input Parameter SQLBindParameter
fParamType = SQL_PARAM_INPUT
fcType = 1
fSQLType = 2
cbColDef = 19
ibScale = 4
cbValueMax = 0
4) Bind the first result column (Tag) using SQLBindColumn
fcType = -16 = SQL_C_SLONG
BufferLen = 4
Here is a table definition:
CREATE TABLE `containers` (
`Tag` int(11) default NULL,
`Class_Id` smallint(6) default NULL,
`Edit_Id` smallint(6) default NULL,
`Origin` char(6) default NULL,
`Destination` char(6) default NULL,
`CreatedDT` datetime default NULL,
`Status` smallint(6) default NULL,
`Weight` int(11) default NULL,
`CWB` decimal(19,4) default NULL,
`CWBSOURCEID` smallint(6) default NULL,
`ContainerTag` int(11) default NULL,
`PossessedBy` char(6) default NULL,
UNIQUE KEY `ContainerTagi` (`Tag`),
UNIQUE KEY `ContainerCWB` (`CWB`,`CWBSOURCEID`),
KEY `ContainerConti` (`ContainerTag`),
KEY `ContainerOrigini` (`Origin`),
KEY `ContainerDesti` (`Destination`),
KEY `ContainerCreatedi` (`CreatedDT`)
) TYPE=MyISAM;
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.