IDalCursorField.DataDomain

Syntax

DataDomain: DbDataDomain;

DataDomain: Prognoz.Platform.Interop.Dal.DbDataDomain;

Description

The DataDomain property returns the type of the field data if the field is used to store multibyte information.

Comments

The field can store multibyte information if the GetDbDataType property returns DbDataType.String or DbDataType.Blob. Working with multibyte information is described in the knowledge database in the Working with Fields That Have Custom Data Type article.

Also, if the table field has the type - DbDataType.DateTime and the field can store date and time up to milliseconds, the DataDomain property returns DbDataDomain.MSec.

Example

Executing the example requires that the repository contains a database with the DB identifier. This database stores table data with the TBL physical name.

Sub UserProc;
Var
    MB: IMetabase;
    DB: IDatabaseInstance;
    Com: IDalCommand;
    Cur: IDalCursor;
    Fields: IDalCursorFields;
    Field: IDalCursorField;
Begin
    MB := MetabaseClass.Active;
    DB := MB.ItemById(
"DB").Open(NullAs IDatabaseInstance;
    Com := DB.Connection.CreateCommand(
"Select * From TBL");
    Cur := Com.CreateCursor;
    Fields := Cur.Fields;
    
For Each Field In Fields Do
        
If (Field.GetDbDataType = DbDataType.Blob) Then
            
Select Case Field.DataDomain
                
Case DbDataDomain.None: Debug.WriteLine("The " + Field.Name + " field stores binary data");
                
Case DbDataDomain.Memo: Debug.WriteLine("The " + Field.Name + " field stores text data");
                
Case DbDataDomain.Raw: Debug.WriteLine("The " + Field.Name + " field stores custom data");
            
End Select;
        
Elseif Field.GetDbDataType = DbDataType.DateTime Then
            
If Field.DataDomain = DbDataDomain.MSec Then
                Debug.WriteLine(
"The " + Field.Name + " field stores date and time up to milliseconds");
            
End If;
        
End If;
    
End For;
    Cur.Close;
    Com.Close;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    DB: IDatabaseInstance;
    Com: IDalCommand;
    Cur: IDalCursor;
    Fields: IDalCursorFields;
    Field: IDalCursorField;
Begin
    MB := Params.Metabase;
    DB := MB.ItemById[
"DB"].Open(NullAs IDatabaseInstance;
    Com := DB.Connection.CreateCommand(
"Select * From TBL");
    Cur := Com.CreateCursor();
    Fields := Cur.Fields;
    
For Each Field In Fields Do
        
If (Field.GetDbDataType = DbDataType.ddtBlob) Then
            
Select Case Field.DataDomain
                
Case DbDataDomain.dddNone: System.Diagnostics.Debug.WriteLine("The " + Field.Name + " field stores binary data");
                
Case DbDataDomain.dddMemo: System.Diagnostics.Debug.WriteLine("The " + Field.Name + " field stores text data");
                
Case DbDataDomain.dddRaw: System.Diagnostics.Debug.WriteLine("The " + Field.Name + " field stores custom data");
            
End Select;
        
Elseif Field.GetDbDataType = DbDataType.ddtDateTime Then
            
If Field.DataDomain = DbDataDomain.dddMSec Then
                System.Diagnostics.Debug.WriteLine(
"The " + Field.Name + " field stores date and time up to milliseconds");
            
End If;
        
End If;
    
End For;
    Cur.Close();
    Com.Close();
End Sub;

After executing the example information about the table fields that are used to store multibyte information is displayed in the console window.

See also:

IDalCursorField