Пример #1
0
        public virtual void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
        {
            var  colnames = from c in queue.GetRowFormat.Columns select c.ColumnName;
            bool autoinc  = queue.GetRowFormat.FindAutoIncrementColumn() != null;

            if (autoinc)
            {
                m_dmp.AllowIdentityInsert(table.FullName, true);
            }
            try
            {
                while (!queue.IsEof)
                {
                    IBedRecord row = queue.GetRecord();
                    m_dmp.PutCmd("^insert ^into %f (%,i) ^values (%,v)", table, colnames, row);
                }
            }
            finally
            {
                queue.CloseReading();
            }
            if (autoinc)
            {
                m_dmp.AllowIdentityInsert(table.FullName, false);
            }
        }
Пример #2
0
 public BulkCopyJobCommand(ITabularDataStore source, ITabularDataStore target, IRowTransform rowTransform, TableCopyOptions copyOpts)
 {
     m_source      = source;
     m_target      = target;
     m_transform   = rowTransform;
     m_copyOptions = copyOpts;
 }
Пример #3
0
 public override void LoadFromXml(XmlElement xml)
 {
     base.LoadFromXml(xml);
     m_source       = (ITabularDataStore)TabularDataStoreAddonType.Instance.LoadAddon(xml.FindElement("Source"));
     m_target       = (ITabularDataStore)TabularDataStoreAddonType.Instance.LoadAddon(xml.FindElement("Target"));
     m_transformXml = xml.FindElement("Transform");
     m_copyOptions  = new TableCopyOptions();
     m_copyOptions.LoadFromXml(xml.FindElement("CopyOptions"));
 }
Пример #4
0
        public TableCopyOptions GetOptions()
        {
            TableCopyOptions res = new TableCopyOptions();

            res.AllowBulkCopy      = chbAllowBulkCopy.Checked;
            res.TruncateBeforeCopy = chbTruncateBeforeCopy.Checked;
            res.DisableConstraints = chbDisableConstraints.Checked;
            return(res);
        }
Пример #5
0
        public override void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
        {
            var tdst = m_db.GetTable(table.FullName);
            ITabularDataStore dstds = tdst.GetDataStoreAndReuse();

            dstds.CopyOptions  = opts;
            dstds.ProgressInfo = ProgressInfo;
            IAsyncResult async = dstds.BeginWrite(null, queue);

            dstds.EndWrite(async);
        }
Пример #6
0
        public override void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
        {
            var          name  = new NameWithSchema(table.FullName.Schema, table.FullName.Name, false);
            var          entry = m_zip.PutNextEntry(XmlTool.NormalizeIdentifier(name.ToString()) + ".drs");
            BedDataStats stats = new BedDataStats();

            BedTool.WriteQueueToStream(queue, m_zip, stats);
            ProgressInfo.LogMessage("s_export", LogLevel.Info, Texts.Get("s_exported$table$rows$bytes", "rows", stats.Rows, "bytes", stats.Bytes, "table", table.FullName));
            //ZipEntry entry = new ZipEntry(XmlTool.NormalizeIdentifier(table.FullName.ToString()) + ".xml");
            //m_zip.PutNextEntry(entry);
            //XmlTool.WriteQueueToXml(queue, m_zip, "DataSet", "DataRow");
        }
Пример #7
0
 public void LoadFromXml(XmlElement xml)
 {
     CopyMembers = new DatabaseStructureMembers();
     CopyMembers.LoadFromXml_ForJob(xml.FindElement("Members"));
     TableOptions = new TableCopyOptions();
     TableOptions.LoadFromXml(xml.FindElement("TableOptions"));
     foreach (XmlElement tbl in xml.SelectNodes("DataCopyTables/Table"))
     {
         DataCopyTables.Add(NameWithSchema.LoadFromXml(tbl));
     }
     this.LoadPropertiesCore(xml);
 }
Пример #8
0
        public static string Run(ITableSource src, IDatabaseSource dst, out bool copydata, out TableCopyOptions opts)
        {
            CopyTableForm win = new CopyTableForm(src, dst);
            DialogResult  res = win.ShowDialogEx();

            copydata = win.cbcopydata.Checked;
            opts     = win.GetCopyOptions();
            if (res == DialogResult.OK)
            {
                return(win.tbltblname.Text);
            }
            return(null);
        }
Пример #9
0
 public override void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
 {
     m_dw.FillTable(table, queue, opts);
 }
Пример #10
0
 public BulkInserterBase()
 {
     BatchSize   = 100;
     CopyOptions = new TableCopyOptions();
 }
Пример #11
0
 public virtual void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
 {
 }
Пример #12
0
 public static Job Create(ITabularDataStore source, ITabularDataStore target, IRowTransform rowTransform, TableCopyOptions copyOpts, JobProperties jobProps)
 {
     return(Job.FromCommand(new BulkCopyJobCommand(source, target, rowTransform, copyOpts), jobProps));
 }