Esempio n. 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);
            }
        }
Esempio n. 2
0
 public BulkCopyJobCommand(ITabularDataStore source, ITabularDataStore target, IRowTransform rowTransform, TableCopyOptions copyOpts)
 {
     m_source      = source;
     m_target      = target;
     m_transform   = rowTransform;
     m_copyOptions = copyOpts;
 }
Esempio n. 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"));
 }
Esempio n. 4
0
        public TableCopyOptions GetOptions()
        {
            TableCopyOptions res = new TableCopyOptions();

            res.AllowBulkCopy      = chbAllowBulkCopy.Checked;
            res.TruncateBeforeCopy = chbTruncateBeforeCopy.Checked;
            res.DisableConstraints = chbDisableConstraints.Checked;
            return(res);
        }
Esempio n. 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);
        }
Esempio n. 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");
        }
Esempio n. 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);
 }
Esempio n. 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);
        }
Esempio n. 9
0
 public override void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
 {
     m_dw.FillTable(table, queue, opts);
 }
Esempio n. 10
0
 public BulkInserterBase()
 {
     BatchSize   = 100;
     CopyOptions = new TableCopyOptions();
 }
Esempio n. 11
0
 public virtual void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
 {
 }
Esempio n. 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));
 }