Kbase P166274: SAVE-ROW-CHANGES saves more decimal places than the database schema defines.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  20/05/2010 |
|
Status: Unverified
SYMPTOM(s):
SAVE-ROW-CHANGES saves more decimal places than the database schema defines.
Using an update statement on a decimal field using a format with a large number of decimal places, will round the entered decimal value depending on the number of decimal places defined in the database schema.
For example:
DO TRANSACTION:
FIND FIRST customer WHERE customer.custnum = 1.
UPDATE customer.creditlimit FORMAT ">>>>>9.99999999".
RELEASE customer.
END.
FIND FIRST customer WHERE customer.custnum = 1.
DISPLAY customer.creditlimit.
If SAVE-ROW-CHANGES is used with a prodataset then any large decimal value is saved to the database regardless of the database decimal field number of decimal places. For example:
DEFINE TEMP-TABLE ttCustomer NO-UNDO BEFORE-TABLE ttBeforeCustomer
FIELD custNum AS INTEGER
FIELD NAME AS CHARACTER FORMAT "X(30)"
FIELD CreditLimit AS DECIMAL FORMAT ">>>>>9.99999999"
INDEX idxCustNum IS PRIMARY UNIQUE custNum.
DEFINE VARIABLE h_field AS HANDLE NO-UNDO.
DEFINE VARIABLE h_buffer AS HANDLE NO-UNDO.
DEFINE DATASET dsCustomer FOR ttCustomer.
DEFINE DATA-SOURCE dsoCustomer FOR customer.
/* Fill dataset */
BUFFER ttCustomer:ATTACH-DATA-SOURCE( DATA-SOURCE dsoCustomer:HANDLE ).
DATA-SOURCE dsoCustomer:FILL-WHERE-STRING = "WHERE customer.CustNum = 1".
DATASET dsCustomer:FILL().
BUFFER ttCustomer:DETACH-DATA-SOURCE().
/* Change record */
TEMP-TABLE ttCustomer:TRACKING-CHANGES = TRUE.
FIND FIRST ttCustomer WHERE ttCustomer.custNum = 1.
UPDATE ttCustomer.CreditLimit SKIP.
RELEASE ttCustomer.
TEMP-TABLE ttCustomer:TRACKING-CHANGES = FALSE.
/* Write changes to database */
BUFFER ttCustomer:ATTACH-DATA-SOURCE( DATA-SOURCE dsoCustomer:HANDLE ).
FOR EACH ttBeforeCustomer:
BUFFER ttBeforeCustomer:SAVE-ROW-CHANGES.
END.
BUFFER ttCustomer:DETACH-DATA-SOURCE().
FIND FIRST customer NO-LOCK WHERE
customer.CustNum = 1.
DISPLAY customer.CustNum customer.NAME customer.CreditLimit FORMAT
">>>>>9.99999999".
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.x
CAUSE:
Bug# OE00197722
FIX:
None at this time. As a work around Specify the number of decimals in the temp table field definition. For example:
DEFINE TEMP-TABLE ttCustomer NO-UNDO BEFORE-TABLE ttBeforeCustomer
FIELD custNum AS INTEGER
FIELD NAME AS CHARACTER FORMAT "X(30)"
FIELD CreditLimit AS DECIMAL FORMAT ">>>>>9.99999999" DECIMALS 2
INDEX idxCustNum IS PRIMARY UNIQUE custNum.