public BulkCopyJobCommand(ITabularDataStore source, ITabularDataStore target, IRowTransform rowTransform, TableCopyOptions copyOpts) { m_source = source; m_target = target; m_transform = rowTransform; m_copyOptions = copyOpts; }
public TransformResults(TransformResults parent, IRowTransform transform, ReportResults pivotedRows) { Parent = parent ?? EMPTY; RowTransform = transform; PivotedRows = pivotedRows; Depth = Parent.Depth + 1; }
public void LoadFromTransform(IRowTransform tr) { lbtarget.Rows.Clear(); if (tr is IdentityTransform) { foreach (IColumnStructure col in m_srcformat.Columns) { lbtarget.Rows.Add(col.ColumnName, new GenericTransform.ColumnColExprType().ToString(), col.ColumnName); } } if (tr is PermuteTransform) { var t = tr as PermuteTransform; foreach (int i in t.DestIndexes) { IColumnStructure col = m_srcformat.Columns[i]; lbtarget.Rows.Add(col.ColumnName, new GenericTransform.ColumnColExprType().ToString(), col.ColumnName); } } if (tr is GenericTransform) { var t = tr as GenericTransform; foreach (var col in t.DestCols) { lbtarget.Rows.Add(col.Name, col.Type.ToString(), col.Expression); } } }
public IRowTransform LoadRowTransform(XmlElement xml, ITableStructure source, ITableStructure target) { IRowTransform res = (IRowTransform)StaticSpace.FindHolder(xml.GetAttribute("type")).CreateInstance(); res.LoadFromXml(xml, source, target); return(res); }
//internal Dictionary<string, int> m_fieldNameToIndex_Get = new Dictionary<string, int>(); public GenericDataQueue(ITableStructure putFormat, ITableStructure getFormat, IRowTransform transform) { m_putFormat = putFormat; m_getFormat = getFormat; m_transform = transform; //foreach (IColumnStructure col in getFormat.Columns) //{ // m_fieldNameToIndex_Get[col.ColumnName] = col.ColumnOrder; //} }
public void LoadFromTransform(IRowTransform tr) { bool[] activeCols = new bool[m_target.Columns.Count]; if (tr is IdentityTransform) { for (int i = 0; i < m_combos.Count; i++) { activeCols[i] = true; int srcindex = m_source.Columns.GetIndex(m_target.Columns[i].ColumnName); if (srcindex >= 0) { SetColumnBindings(i, new GenericTransform.ColumnColExprType(), m_source.Columns[srcindex].ColumnName); } } } if (tr is PermuteTransform) { var t = tr as PermuteTransform; for (int i = 0; i < t.OutputFormat.Columns.Count; i++) { var dstcol = t.OutputFormat.Columns[i]; int dsti = m_target.Columns.GetIndex(dstcol.ColumnName); if (dsti < 0) { continue; } int srci = t.DestIndexes[i]; IColumnStructure srccol = m_source.Columns[srci]; SetColumnBindings(dsti, new GenericTransform.ColumnColExprType(), srccol.ColumnName); activeCols[dsti] = true; } } if (tr is GenericTransform) { var t = tr as GenericTransform; for (int i = 0; i < t.OutputFormat.Columns.Count; i++) { var dstcol = t.OutputFormat.Columns[i]; int dsti = m_target.Columns.GetIndex(dstcol.ColumnName); if (dsti < 0) { continue; } var d = t.DestCols[i]; SetColumnBindings(dsti, d.Type, d.Expression); activeCols[dsti] = true; } } for (int i = 0; i < activeCols.Length; i++) { m_checks[i].Checked = !activeCols[i]; } }
public TransformStack PushTransform(IRowTransform rowTransform) { return(new TransformStack(new [] { rowTransform }.Concat(RowTransforms.Skip(StackIndex)) .Where(transform => !transform.IsEmpty), 0)); }
protected override void DoRun(IJobRunEnv env) { m_source.Mode = TabularDataStoreMode.Read; m_target.Mode = TabularDataStoreMode.Write; m_target.CopyOptions = m_copyOptions; Async.SafeOpen(m_source.Connection); Async.SafeOpen(m_target.Connection); IAsyncResult asyncs = m_source.BeginGetRowFormat(null); m_sourceStruct = m_source.EndGetRowFormat(asyncs); IAsyncResult asynct = m_target.BeginGetRowFormat(null); m_targetStruct = m_target.EndGetRowFormat(asynct); var targetFull = m_targetStruct; if (m_transform == null) { m_transform = RowTransformAddonType.Instance.LoadRowTransform(m_transformXml, m_sourceStruct, m_targetStruct); if (!m_target.AvailableRowFormat) { m_target.SetRowFormat(m_transform.OutputFormat); m_targetStruct = m_transform.OutputFormat; } } GenericDataQueue queue = new GenericDataQueue(m_sourceStruct, m_transform.OutputFormat, m_transform); if (m_target.Connection != null && m_target.Connection.SystemConnection != null) { var fi = m_source as IDataFormatHolder; var fmt = fi != null ? fi.FormatSettings : new DataFormatSettings(); var outputAdapter = new RecordToDbAdapter(m_transform.OutputFormat, targetFull, m_target.Connection.Dialect, fmt); outputAdapter.ProgressInfo = ProgressInfo; queue.AddOutputAdapter(outputAdapter); } m_source.ProgressInfo = ProgressInfo; m_target.ProgressInfo = ProgressInfo; IAsyncResult async_src = m_source.BeginRead(null, queue); IAsyncResult async_dst = m_target.BeginWrite(null, queue); if (async_src is ICancelable) { m_cancelSrc = (ICancelable)async_src; } if (async_dst is ICancelable) { m_cancelDst = (ICancelable)async_dst; } try { m_source.EndRead(async_src); } finally { m_target.EndWrite(async_dst); } Async.SafeClose(m_source.Connection); Async.SafeClose(m_target.Connection); }
public static Job Create(ITabularDataStore source, ITabularDataStore target, IRowTransform rowTransform, TableCopyOptions copyOpts, JobProperties jobProps) { return(Job.FromCommand(new BulkCopyJobCommand(source, target, rowTransform, copyOpts), jobProps)); }