IDalConnection.Columns

Syntax

Columns(TableName: String): IDalColumns;

Parameters

TableName. Physical name of the table in the database.

Description

The Columns property returns the cursor that contains system information about table fields.

Comments

If an empty row is defined as the value of the TableName property, the property returns the cursor containing the information about the fields of all the tables, which are in the database.

The cursor contains records, each of them contains information about a single table field. The Fields collection will contain a certain number of fields, each of them stores one of the table field parameters. The field name in the Fields collection will correspond to the parameter name, and the value of this field will correspond to the value of parameter for the table field. For example, the Fields collection contains the COLUMN_NAME field, which value will correspond to names of the table fields.

Example

Sub UserProc;
Var
    Driver: IDalDriver;
    Connect: IDalConnection;
    ColCur: IDalColumns;
    ConnectDesc: IDalConnectionDescriptor;
    ConnectDescParams: IDalConnectionDescriptorParams;
    ColFields: IDalCursorFields;
    ColField: IDalCursorField;
    i: Integer;
Begin
    Driver := New DalOrcl8Driver.Create;
    ConnectDesc := Driver.CreateDescriptor;
    ConnectDescParams := ConnectDesc.Params;
    ConnectDescParams.Find("User Name").Value := "User";
    ConnectDescParams.Find("Password").Value := "Password";
    ConnectDescParams.Find("Host BSTR").Value := "OrclServer";
    ConnectDescParams.Find("Schema").Value := "Repository";
    Connect := ConnectDesc.CreateConnection;
    //Parameters of DataTable table fields
    ColCur := Connect.Columns("DataTable");
    ColFields := ColCur.Fields;
    //View parameters and their values
    While Not ColCur.Eof Do
        i := i + 1;
        Debug.WriteLine("Field number: " + i.ToString);
        Debug.Indent;
        For Each ColField In ColFields Do
            Debug.WriteLine(ColField.Name + " = " + ColField.Value);
        End For;
        Debug.Unindent;
        ColCur.Next;
    End While;
    ColCur.Close;
    Connect.Close;
End Sub UserProc;

On executing the example the repository connection is established with specified location parameters. A cursor with parameters of DataTable table field parameters is created based on the connection. Information about parameters and their values is displayed in the development environment console.

See also:

IDalConnection