IDtFieldDefinition.Precision

Syntax

Precision: Integer;

Description

The Precision property determines the precision of the provider/consumer field.

Comments

Provider/consumer field precision is the number of characters after point. The property is relevant for real type of data only.

Example

Add a link to the Dt system assembly.

Sub UserProc;
Var
    FProvider: IDtOleDbProvider;
    Prov: IDtProvider;
    FConsumer: IDtOleDbConsumer;
    ConStr: String;
    Fields, Fields_Cons: IDtFieldDefinitions;
    Field_Prov: IDtFieldDefinition;
    i: Integer;
Begin
    // Determine provider and its fields
    FProvider := New DtOleDbProvider.Create;
    ConStr := "Provider=MSDAORA.1;Password=test;User ID=test;Data Source=test;Persist Security Info=True";
    FProvider.ConnectionString := ConStr;
    FProvider.Query := "select * from TableProvider";
    FProvider.Open;
    Fields := FProvider.Fields;
    Prov := FProvider As IDtProvider;
    // Create a consumer, create its fields
    FConsumer := New DtOleDbConsumer.Create;
    FConsumer.ConnectionString := ConStr;
    // New table:
    FConsumer.Table := "New_TAB_CONS";
    Fields_Cons := FConsumer.Fields;
    Fields_Cons.Clear;
    For i:=0 To Fields.Count-1 Do
        Field_Prov := Fields.Item(i);
        Fields_Cons.Add;
        Fields_Cons.Item(i).Name := Field_Prov.Name;
        Fields_Cons.Item(i).DataType := Field_Prov.DataType;
        Fields_Cons.Item(i).Size := Field_Prov.Size;
        Fields_Cons.Item(i).Precision := Field_Prov.Precision;
    End For;
    // Start export
    FConsumer.PutProvider(Prov);
    Prov.Close;
End Sub UserProc;

After executing the example data from the indicated source is exported into the consumer. Export is performed into new table, for which a set of fields, identical to source fields, is created.

See also:

IDtFieldDefinition