Precision: Integer;
The Precision property returns precision of the cursor field.
The property returns the following values:
The property returns 0 for string data types.
The property returns the number of decimal places after the point for numeric data types with fixed point.
The property returns 0 for numeric data types with floating point.
The property returns 0 for the Blob fields.
Executing the example requires that the repository contains a database with the BD identifier.
Add links to the Dal, Db, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
DB: IDatabaseInstance;
sql : string;
Com: IDalCommand;
Cur: IDalCursor;
Field: IDalCursorField;
i: Integer;
Begin
MB := MetabaseClass.Active;
DB := MB.ItemById("BD").Open(Null) As IDatabaseInstance;
sql := "Select * From Table_1";
Com := DB.Connection.CreateCommand(sql);
Cur := Com.DescribeCursor;
For i:=0 To Cur.Fields.Count-1 Do
Field := Cur.Fields.Item(i);
Debug.WriteLine("--------------------------------------------");
Debug.WriteLine("Field : "+ Field.Name);
Debug.WriteLine("Size : "+ Field.Size.ToString);
Debug.WriteLine("Precision : "+ Field.Precision.ToString);
Debug.WriteLine("--------------------------------------------");
End For;
Cur.Close;
Com.Close;
End Sub UserProc;
After executing the example the console window displays information about precision and size of the table fields.
See also: