Beispiel #1
0
            public override void RunCommand()
            {
                IDatabaseSource src = m_source.GetConnection();
                IDatabaseSource dst = m_target.GetConnection();

                CopyDbJob.CopyDatabase(src, new DatabaseSourceWriter(dst), null, new DatabaseCopyOptions {
                    CopyMembers = DatabaseStructureMembers.FullStructure
                });
            }
            public override void RunCommand()
            {
                if (Format == null)
                {
                    if (Outfile.EndsWith(".dbk"))
                    {
                        Format = "dbk";
                    }
                    else if (Outfile.EndsWith(".ddf"))
                    {
                        Format = "ddf";
                    }
                    else
                    {
                        throw new CommandLineError("DAE-00151 Unknown output format, cannot be deduced from file extension");
                    }
                }
                IDatabaseSource db = m_connection.GetConnection();

                Async.SafeOpen(db.Connection);
                try
                {
                    switch (Format)
                    {
                    case "ddf":
                    {
                        var s = new DatabaseStructure(db.InvokeLoadStructure(DatabaseStructureMembers.FullStructure, null));
                        s.Save(Outfile);
                    }
                    break;

                    case "dbk":
                    {
                        DataArchiveWriter dw = new DataArchiveWriter();
                        dw.FilePlace = FilePlaceAddonType.PlaceFromVirtualFile(Outfile);
                        CopyDbJob.CopyDatabase(db, dw, null, new DatabaseCopyOptions {
                                CopyMembers = DatabaseStructureMembers.FullStructure
                            });
                        Async.SafeClose(db.Connection);
                    }
                    break;

                    default:
                        throw new CommandLineError("DAE-00152 Unknown format:" + Format);
                    }
                }
                finally
                {
                    Async.SafeClose(db.Connection);
                }
            }
        public override void LoadDatabase(IDatabaseSource dst)
        {
            var writer = new DatabaseSourceWriter(dst);
            var reader = new DataArchiveReader(Filename);
            var dbmem  = new DatabaseStructureMembers
            {
                TableMembers          = TableStructureMembers.AllNoRefs,
                SpecificObjectDetails = true,
            };
            var copyOpts = new DatabaseCopyOptions
            {
                CopyMembers   = dbmem,
                DataMode      = DbCopyDataMode.All,
                CopyStructure = true,
                SchemaMode    = DbCopySchemaMode.Original,
            };

            CopyDbJob.CopyDatabase(reader, writer, ProgressInfo, copyOpts);
        }
Beispiel #4
0
        protected override void DoRun(IJobRunEnv env)
        {
            string dir = GetBackupDir();

            try { Directory.CreateDirectory(dir); }
            catch { }
            string          bckfile  = Path.Combine(dir, CreateFileName());
            IDatabaseWriter writer   = m_format.GetWriter(bckfile + m_format.Extension, m_src);
            var             copyOpts = new DatabaseCopyOptions
            {
                CopyMembers    = m_members,
                DataMode       = DbCopyDataMode.All,
                CopyStructure  = true,
                SchemaMode     = m_src.Dialect.DialectCaps.MultipleSchema ? DbCopySchemaMode.Original : DbCopySchemaMode.Explicit,
                ExplicitSchema = null
            };

            CopyDbJob.CopyDatabase(m_src, writer, ProgressInfo, copyOpts);
            SetCurWork(Texts.Get("s_finishing"));
            BackupContainer bc = new BackupContainer(bckfile, m_format);

            bc.Save();
        }
Beispiel #5
0
 private Job CreateJob()
 {
     //return new CopyDbJobCommand(m_source, m_target, CreateOptions());
     return(CopyDbJob.CreateJob(m_source.CloneSource(), m_target, CreateOptions(), null));
 }
Beispiel #6
0
 protected override void DoRun(IJobRunEnv env)
 {
     CopyDbJob.CopyDatabase(m_src, m_dst, ProgressInfo, m_copyOpts);
 }