Re: [metabase-dev] RE: [PEAR-DEV] mdb decimal types

From: Date: Sat, 29 Mar 2003 11:51:04 +0000
Subject: Re: [metabase-dev] RE: [PEAR-DEV] mdb decimal types
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14720@lists.php.net to get a copy of this message
Hello, On 03/27/2003 05:28 AM, Lukas Smith wrote:
Just having a look through the decimal handling in mdb for mysql and postgres it appears to be mapping decimals to integers then doing a bit of maths in PHP to 'get' it out again. mysql has decimal (5,2) postgres has numeric(5,2) It would be far better to use these for cash calculations (unless mdb wants to start using bcmath to do the calcs.?) Thoughts?
So far I have left the native datatypes to be exactly what metabases uses. Manuel usually makes very educated decisions. However the times do change and so some decision might make sense to be reconsidered. Usually these types of decision were made by Manuel to ensure 100% portability across RDBMS and across RDBMS versions. For now I want to wait until we have the driver set complete (and maybe the unit tests) before making any such changes, so that we can better see the implications.
Lucas is right, there is always a good reason for having a certain implementation of certain features in Metabase. The reason why Metabase MySQL driver uses big integers for decimal fields is because only recently native decimal fields were supported. Using big integers is appropriate because that is how fixed precision decimal fields are implemented. They are appropriate for operation with values that can't loose precision in rounding like with money operations. Now that MySQL supports decimal fields natively, I don't see a problem in using them conditionally if a driver setup option is specified. I just did not do it myself because I have rarely used them in my applications. Users only have to warned that they must specify the same setup options to make it work portably, not only to whether they should use native decimals or not, but also regarding number of places. -- Regards, Manuel Lemos

« previous php.pear.dev (#14720) next »