IQueryStorage.DefineBySql

Syntax

DefineBySql;

Description

The DefineBySql method determines settings for data saving by SQL query, specified in the IQuery.Sql property.

Comments

On executing the method the analysis of SQL query is made. A table, physical name of which is first met after the key word From, is set as a table for saving. Presence of fields used in SQL query is also checked in this table.

Example

Executing the example requires that the repository contains the Query object with the Query_1 identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Query: IQuery;
    Storage: IQueryStorage;
Begin
    MB := MetabaseClass.Active;
    Query := MB.ItemById("Query_1").Edit As IQuery;
    Storage := Query.Storage;
    Storage.Enabled := True;
    Storage.DefineBySql;
    (Query As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, the settings of specified query are changed. Saving data is enabled for the query. Options for data saving are determined by SQL query text.

See also:

IQueryStorage