Description:
As I try to modify a record containing double our float with the
.edit and .update method, with some values, the update fails.
How to repeat:
I just take the exemple
25.1.19.2. DAO : rs.addNew, rs.update et scrolls
and I modify the table creation: I add a double(7,2) at the end of the record.
Set queryDef = conn.CreateQueryDef("", "create table my_dao(Id INT AUTO_INCREMENT PRIMARY KEY, " _
& "Ts TIMESTAMP(14) NOT NULL, Name varchar(20), Id2 INT, Dbl1 DOUBLE(7,2))")
I assign the value 0.99 to this field
For I = 10 To 15
rs.AddNew
rs!Name = "insert record" & I
rs!Id2 = I
rs!Dbl1 = 0.99
rs.Update
Next I
I modify the value of the double for the record id=3
' Dbl1 = Dbl1+1
' modification of the data of the record id=3
For I = 1 To 5
Set rs = conn.OpenRecordset("Select * from my_dao where Id=3", dbOpenDynamic, dbExecDirect, dbOptimistic)
rs.Edit
rs!Name = CStr(rs!Dbl1)
rs!Dbl1 = rs!Dbl1 + 1
rs.Update
rs.Close
Next I
-- Query logging
--
-- Driver name: MySQL ODBC 3.51 Driver Version: 03.51.23
-- Timestamp: 080325 17:06:32
drop table if exists my_dao;
create table my_dao(Id INT AUTO_INCREMENT PRIMARY KEY, Ts TIMESTAMP(14) NOT NULL, Name varchar(20), Id2 INT, Dbl1 DOUBLE(7,2));
my_dao;
SELECT * FROM my_dao;
insert into my_dao (Name, Id2, Dbl1) values ('insert record10', 10, 9.89999999999999990e-001);
insert into my_dao (Name, Id2, Dbl1) values ('insert record11', 11, 9.89999999999999990e-001);
insert into my_dao (Name, Id2, Dbl1) values ('insert record12', 12, 9.89999999999999990e-001);
insert into my_dao (Name, Id2, Dbl1) values ('insert record13', 13, 9.89999999999999990e-001);
insert into my_dao (Name, Id2, Dbl1) values ('insert record14', 14, 9.89999999999999990e-001);
insert into my_dao (Name, Id2, Dbl1) values ('insert record15', 15, 9.89999999999999990e-001);
Select * from my_dao where Id=3;
update my_dao SET Name='0,99' , Dbl1=1.99000000000000000e+000 WHERE `Name` = 'insert record12' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:33' AND `Id2` = 12 AND `Id` = 3;
Select * from my_dao where Id=3;
update my_dao SET Name='0,99' , Dbl1=1.99000000000000000e+000 WHERE `Name` = 'insert record12' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:33' AND `Id` = 3 AND `Id2` = 12;
Select * from my_dao where Id=3;
update my_dao SET Name='0,99' , Dbl1=1.99000000000000000e+000 WHERE `Name` = 'insert record12' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:33' AND `Id` = 3 AND `Id2` = 12;
Select * from my_dao where Id=3;
update my_dao SET Name='0,99' , Dbl1=1.99000000000000000e+000 WHERE `Name` = 'insert record12' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:33' AND `Id` = 3 AND `Id2` = 12;
Select * from my_dao where Id=3;
update my_dao SET Name='0,99' , Dbl1=1.99000000000000000e+000 WHERE `Name` = 'insert record12' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:33' AND `Id` = 3 AND `Id2` = 12;
my_dao;
SELECT * FROM my_dao;
update my_dao SET Name='updated-string' WHERE `Name` = 'insert record10' AND `Dbl1` = 9.89999999999999990e-001 AND `Ts` = '2008-03-25 17:06:32' AND `Id` = 1 AND `Id2` = 10;
my_dao;
SELECT * FROM my_dao;
Suggested fix:
I don't know if the SQL command is generated by Microsoft or by the ODBC Driver.
In this case, the driver must take in account the format of the double ( ie 7,2 )