Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
MIT License
323
stars
98
forks
source link
Decoding of DECIMALS adds non significant trailing zeroes #81
mysql version 10.3.22-MariaDB-1:10.3.22+maria~bionic-log
Steps required to reproduce the problem (take from the unit tests)
CREATE TABLE test (test DECIMAL(20,10));
INSERT INTO test VALUES(-42000.123456);
Expected Result.
'-42000.123456'
Actual Result.
'-42000.1234560000'
Why this is a problem
Mathematically speaking, both results are valid. However decimals are represented using strings in the lib (bcmath). Hence, when tested for equality, '-42000.123456' is not the same as '-42000.1234560000'. Greater/Lower comparison do work, but not strict equality. The unit tests enforce the presence of these trailing zeroes, which to me should not be.
I can do a pull request to fix this if you agree with me that this is an issue. Not a big one, but still :)
CREATE TABLE test (test DECIMAL(20,10)); INSERT INTO test VALUES(-42000.123456);
'-42000.123456'
'-42000.1234560000'
Mathematically speaking, both results are valid. However decimals are represented using strings in the lib (bcmath). Hence, when tested for equality, '-42000.123456' is not the same as '-42000.1234560000'. Greater/Lower comparison do work, but not strict equality. The unit tests enforce the presence of these trailing zeroes, which to me should not be.
I can do a pull request to fix this if you agree with me that this is an issue. Not a big one, but still :)