IMetabaseUpdateSqlNode.IgnoreErrors

Syntax

IgnoreErrors: Boolean;

Description

The IgnoreErrors property determines whether it is possible to pass SQL command if an error occurs during its execution.

Comments

The property is set to False by default, and if during the execution of the SQL command an error occurs, the platform throws an exception and the update is stopped.

If the property is set to True, this command will be skipped if an error occurs during SQL command execution and the update will be continued from the next element.

If the property is set to True, queries with errors are skipped.

Example

Executing the example requires that the repository contains a table with the Table_1 identifier and a database with the BD identifier. The schema, on which this database is set, contains a table with the LOG_TABLE physical name. This table stores a history of execution of any actions. The table has the ACTION and DATE_ACTION fields that will display action description and date of the occurred action.

Sub Main;

Var

Mb: IMetabase;

Db: IMetabaseObject;

Mu: IMetabaseUpdate;

Root: IMetabaseUpdateFolderNode;

SQLNode: IMetabaseUpdateSqlNode;

DNode: IMetabaseUpdateDataObjectNode;

Begin

Mb := MetabaseClass.Active;

Db := Mb.ItemById("BD").Bind;

Mu := Mb.CreateUpdate;

Root := Mu.RootFolder;

DNode := Root.Add(MetabaseUpdateNodeType.DataObject) As IMetabaseUpdateDataObjectNode;

DNode.Object := MB.ItemById("Table_1");

DNode.UpdatePart := MetabaseObjectUpdatePart.DataMetadata;

SQLNode := Root.Add(MetabaseUpdateNodeType.Sql) As IMetabaseUpdateSQLNode;

SQLNode.Label := "SQL";

SqlNode.Sql((Db As IDatabase).DriverId) := "Insert Into Log_Table (ACTION,DATE_ACTION) Values('Update table Table_1',sysdate)";

SqlNode.IgnoreErrors := True;

SqlNode.Database := Db.Key;

Mu.SaveToFileNF("c:\Update.pefx");

End Sub Main;

After executing the example a new update is created. Data and metadata of the Table_1 table are added to update. An SQL command is also added to update. On executing this SQL command a new record that contains information about the Table_1 table update is added to the Log_Table table. Execution of SQL command will be ignored if it is impossible to add new records to the Log_Table table by any reasons. Update will be continued from the next element. The SQL command is executed within DB server, on which the BD database is configured.

See also:

IMetabaseUpdateSqlNode