IgnoreErrors: Boolean;
The IgnoreErrors property determines whether it is possible to pass SQL operator if an error appears during its execution.
By default the property is set to False, and if during the execution of the SQL operator an error occurs, then the platform generates the exceptional situation and updating is stopped.
If the property value is True, this operator will be ignored if an error appears during SQL operator execution and update will be continued from the next element.
If the property value is True, queries with mistakes are ignored.
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_TABLEphysical name. There is a history of execution of any actions in this table. The table has fields ACTION and DATE_ACTION, in which action description and date when it happened are specified.
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 this example a new update is created. Data and metadata of the Table_1 table are added in update. SQL operator is also added in update. On executing this SQL operator a new record that contains information about the Table_1 table update is added in the Log_Table table. Execution of SQL operator will be ignored if it is impossible to add new records in the Log_Table table by any reasons. Update will be continued from the next element. SQL operator is executed within DB server on which the BD database is set up.
See also: