Exemple #1
0
 public ITabularDataStore GetDataStore()
 {
     if (m_selectedTable == null)
     {
         return(null);
     }
     return(m_selectedTable.GetDataStoreAndClone());
 }
        public void DragDrop_CopyTable(AppObject appobj)
        {
            //var tobj = appobj as TableAppObject;
            //if (tobj == null) return;
            var              conn    = this.FindDatabaseConnection();
            ITableSource     tsource = appobj.TableSource;
            TableStructure   tbl     = new TableStructure(tsource.InvokeLoadStructure(TableStructureMembers.AllNoRefs));
            TableCopyOptions opts;
            bool             copydata;
            string           newname = CopyTableForm.Run(tsource, conn, out copydata, out opts);

            if (newname == null)
            {
                return;
            }
            List <NameWithSchema> names = new List <NameWithSchema>(conn.InvokeLoadFullTableNames());

            if (ArrayTool.Contains(names, new NameWithSchema(newname)))
            {
                StdDialog.ShowError(Texts.Get("s_table_allready_exists"));
                return;
            }
            tbl.FullName = new NameWithSchema(newname);
            if (conn.Dialect != null)
            {
                conn.Dialect.MigrateTable(tbl, conn.Dialect.CreateMigrationProfile(), null);
            }
            tbl.RemoveConstraints <IForeignKey>();
            PrimaryKey pk = (PrimaryKey)TableStructureExtension.FindConstraint <IPrimaryKey>(tbl);

            if (pk != null && pk.Name != null && pk.Name.ToUpper().StartsWith("PK_"))
            {
                pk.Name = "PK_" + tbl.Name;
            }
            try
            {
                ITableSource dst = conn.CreateTable(tbl);
                if (copydata)
                {
                    BulkCopyJob.Create(tsource.GetDataStoreAndClone(), dst.GetDataStoreAndClone(), new IdentityTransform(tbl), opts, null).StartProcess();
                }
            }
            catch (Exception e)
            {
                Errors.Report(e);
            }
        }
Exemple #3
0
        public void DragDrop_Table(AppObject appobj)
        {
            ITableSource src = appobj.TableSource;

            BulkCopyWizard.Run(src.GetDataStoreAndClone(), TableSource.GetDataStoreAndClone());
        }
 public void Export()
 {
     BulkCopyWizard.Run(TableSource.GetDataStoreAndClone(), null);
 }