FireDAC.Stan.Option.TFDFormatOptions.Round2Scale

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Round2Scale: Boolean read GetRound2Scale write SetRound2Scale  stored IsRSS default False;

C++

__property bool Round2Scale = {read=GetRound2Scale, write=SetRound2Scale, stored=IsRSS, default=0};

Properties

Type Visibility Source Unit Parent
property published
FireDAC.Stan.Option.pas
FireDAC.Stan.Option.hpp
FireDAC.Stan.Option TFDFormatOptions

Description

Controls the values rounding.

Use the Round2Scale property to control whether FireDAC should round the numeric and time values to the scale specified in a database or not. The default value is False

If it is True, then the rounding will be performed. The rounding happens at the client side, only when an application assigns a value to a field of numeric / time / date & time type. The rounding uses a corresponding TFDDatSColumn.Scale value. For numbers, it is the amount of digits after the decimal point. For time, it is the maximal supported precision in msecs. 

Setting the Round2Scale property to True allows an application to avoid potential rounding errors.

Consider the following scenario: the application has UpdateOptions.LockMode = lmOptimistic and ADQuery with simple SELECT to an Oracle table with a DATE field. The DATE data type in Oracle has 1 sec precision. Now add a new record, assign the Now() result to the DATE field, and post the change to the database. The client record buffer will store a value with some msecs, while the database will store a value WITHOUT msecs. Try to edit the record. Before this, the lock will be performed. But FireDAC will fail to compare the field values from the client buffer and the one just fetched from the database. As a result, the "DApt-400" exception will be raised.

But if Round2Scale is set to True, then FireDAC will round a client value to seconds and a comparison will succeed.


See Also