public override void Transform(RavenEtlItem item) { Current = item; if (item.IsDelete == false) { if (_script.Transformation != null) { if (_script.LoadToCollections.Length > 1 || _script.IsLoadedToDefaultCollection(item, _script.LoadToCollections[0]) == false) { // first, we need to delete docs prefixed by modified document ID to properly handle updates of // documents loaded to non default collections ApplyDeleteCommands(item, OperationType.Put); } SingleRun.Run(Context, "execute", new object[] { Current.Document }).Dispose(); } else { _commands.Add(new PutCommandDataWithBlittableJson(item.DocumentId, null, item.Document.Data)); } } else { if (_script.Transformation != null) { ApplyDeleteCommands(item, OperationType.Delete); } else { _commands.Add(new DeleteCommandData(item.DocumentId, null)); } } }
public override void Transform(RavenEtlItem item) { Current = item; if (item.IsDelete == false) { if (_script.Transformation != null) { if (_script.LoadToCollections.Length > 1 || _script.IsLoadedToDefaultCollection(item, _script.LoadToCollections[0]) == false) { // first, we need to delete docs prefixed by modified document ID to properly handle updates of // documents loaded to non default collections ApplyDeleteCommands(item, OperationType.Put); } SingleRun.Run(Context, Context, "execute", new object[] { Current.Document }).Dispose(); } else { _commands.Add(new PutCommandDataWithBlittableJson(item.DocumentId, null, item.Document.Data)); if ((item.Document.Flags & DocumentFlags.HasAttachments) == DocumentFlags.HasAttachments) { HandleDocumentAttachments(item); } } } else { if (_script.Transformation != null) { Debug.Assert(item.IsAttachmentTombstone == false, "attachment tombstones are tracked only if script is empty"); ApplyDeleteCommands(item, OperationType.Delete); } else { if (item.IsAttachmentTombstone == false) { _commands.Add(new DeleteCommandData(item.DocumentId, null)); } else { var(doc, attachmentName) = AttachmentsStorage.ExtractDocIdAndAttachmentNameFromTombstone(Context, item.AttachmentTombstoneId); _commands.Add(new DeleteAttachmentCommandData(doc, attachmentName, null)); } } } }
public override void Transform(ToSqlItem item) { if (item.IsDelete == false) { Current = item; SingleRun.Run(Context, "execute", new object[] { Current.Document }).Dispose(); } // ReSharper disable once ForCanBeConvertedToForeach for (int i = 0; i < _config.SqlTables.Count; i++) { // delete all the rows that might already exist there var sqlTable = _config.SqlTables[i]; if (sqlTable.InsertOnlyMode) { continue; } GetOrAdd(sqlTable.TableName).Deletes.Add(item); } }