[Opensource] problems deleting DBObjects with float fields

Tsanko Stefanov tsanstef at hotmail.com
Tue Jan 7 10:05:36 PST 2003


Hi folks,

I got and error (exception) when trying to delete e DBObject with float 
fields. The reason as I discovered is that float8 and NUMERIC cannot be 
substracted (I am using postgreSQL).
The problem is in DBObject's buildWhereClauseBuffer(boolean useAllFields,  
FastStringBuffer allocatedBuffer)
.....
else if(oneField.isFloatingPointType()) {
                    //Floating point types have to be searched within a 
certain
                    //precision.  Thus we compare the ABS to the less than
                    //the field precision.
                    myStatement.append("ABS(");
                    myStatement.append(oneFieldName);
                    myStatement.append(" - ");
                    if (postgresql) {
                        myStatement.append(" CAST (");
                    }
                    myStatement.append(oneFieldValue);
                    if (postgresql) {
                        myStatement.append(" as NUMERIC)");
                    }
......
by changing NUMERIC (it occured twice) to FLOAT we managed to delete the 
DBObject through DBMaint.
Any ideas whether this is correct and should be changed?
Thanks.

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




More information about the Opensource mailing list