IDalCommand.Parse

Syntax

Parse;

Description

The Parse method analyzes the query and detects parameters in it.

Comments

While being executed, the method analyzes the query that was specified on command creation or specified in the SQL property. The detected parameters will be added to the collection of parameters available in the Params property.

Example

Executing the example requires that the repository contains a database with the DB identifier.

Add links to the Dal, Db, and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    DB: IDatabaseInstance;
    Com: IDalCommand;
    Cur: IDalCursor;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    DB := MB.ItemById("DB").Open(NullAs IDatabaseInstance;
    Com := DB.Connection.CreateCommand("");
    Com.SQL := "Select * From Table_1 Where (Num1 > :Param) And (F_Date = :Param1)";
    Com.Parse;
    Com.Params.Item(0).Value := 40;
    Com.Params.Item(1).Value := "03.03.2000";
    Cur := Com.CreateCursor;
    While Not Cur.Eof Do
        i := i + 1;
        Cur.Next;
    End While;
    Cur.Close;
    Com.Close;
End Sub UserProc;

After executing the example the connection to database is established, and the SQL query that selects all records from the Table_1 table, for which the values of the Num1 and F_Date fields satisfy the assigned parameters, is executed. Two parameters are found as a result of the analysis of the SQL query using the Parse method.

See also:

IDalCommand