ID: 29064 Updated by: [EMAIL PROTECTED] Reported By: daniel dot beet at accuratesoftware dot com Status: Assigned Bug Type: Sybase-ct (ctlib) related Operating System: Windows 2000 Server PHP Version: 4.3.7 / HEAD Assigned To: thekid New Comment:
On the money datatype: http://groups.google.com/groups?selm=37445202.6643%40sybase.com (link might be wrapped) Previous Comments: ------------------------------------------------------------------------ [2004-07-12 21:51:02] [EMAIL PROTECTED] Hello, > I have tested the complete patch set against PHP 4, > and have found no major issues. Thanks for testing. I did the same, but with PHP5:) > I did notice that MONEY columns only have 2 decimal > places fetched back rather than the stored 4 places > (this is also the case currently), but (not sure why, > something to do with the default formating within > Sybase for Money columns maybe?) This has to do with ct_bind() asd CS_CHARTYPE - one would have to use CS_MONEYTYPE and do quite a bit of refactoring (atm, it can be safely assumed every value returned is a char*...) > the patch I did brought back 4 decimal places. Are you sure? I wasn't able to do so... > This is not an issue for me, but does not seem quite > right. You're right. Try to search Google for this, though. There is some discussion on this topic, but they all simply suggest to use convert(numeric(19, 4), ...) on the value if you actually need the two last digits. That works fine in PHP, too. > Just wondering about the consistency of the different > database drivers in PHP. MSSQL and OCI8 return > numeric/decimals as numeric strings all the time. I > would hope that where possible, all the database > extensions would return data in a similar way. I think it's wrong to get string(1)"1" when issuing this: select 1 All in all, you selected a numeric value. IMHO, PHP should to its best and try to provide you with a numeric value from that (being int(1) in this situation). > Thanks for your help! Thanks for yours:) ------------------------------------------------------------------------ [2004-07-12 12:48:54] daniel dot beet at accuratesoftware dot com I have tested the complete patch set against PHP 4, and have found no major issues. I did notice that MONEY columns only have 2 decimal places fetched back rather than the stored 4 places (this is also the case currently), but (not sure why, something to do with the default formating within Sybase for Money columns maybe?) the patch I did brought back 4 decimal places. This is not an issue for me, but does not seem quite right. Just wondering about the consistency of the different database drivers in PHP. MSSQL and OCI8 return numeric/decimals as numeric strings all the time. I would hope that where possible, all the database extensions would return data in a similar way. Thanks for your help! Dan ------------------------------------------------------------------------ [2004-07-11 18:40:53] [EMAIL PROTECTED] I fixed this bug locally but still have quite an amount of other bugfixes / improvements lying around, which I don't want to separate from this. Maybe you'd like to test the complete patchset available at http://sitten-polizei.de/php/sybase_ct.diff (HEAD) http://sitten-polizei.de/php/sybase_ct4.diff (PHP_4 branch) As soon as I've tested the other changes enough, I'll commit everything to CVS (should be in a couple of days) ------------------------------------------------------------------------ [2004-07-11 15:35:00] [EMAIL PROTECTED] Testcase now available at: http://sitten-polizei.de/php/bug29064.phpt (place in ext/sybase_ct/tests and run make test TESTS=ext/sybase_ct, be sure to edit ext/sybase_ct/tests/test.inc and supply correct DS_QUERY and credentials there) ------------------------------------------------------------------------ [2004-07-11 15:29:26] [EMAIL PROTECTED] Seeing that the PHP version in the Bug report was 4.3.7, I also made a patch against the PHP4 branch. http://sitten-polizei.de/php/float_precision-php4.diff ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/29064 -- Edit this bug report at http://bugs.php.net/?id=29064&edit=1