Ejemplo n.º 1
0
        public void Run()
        {
            if (!System.IO.File.Exists(m_options.Dbpath))
            {
                throw new Exception(string.Format("Database file does not exist: {0}", m_options.Dbpath));
            }

            using (var db = new Database.LocalDeleteDatabase(m_options.Dbpath, false))
                using (var tr = db.BeginTransaction())
                {
                    m_result.SetDatabase(db);

                    Utility.VerifyParameters(db, m_options);

                    DoRun(db, tr, false, false);

                    if (!m_options.Dryrun)
                    {
                        using (new Logging.Timer("CommitDelete"))
                            tr.Commit();

                        db.WriteResults();
                    }
                    else
                    {
                        tr.Rollback();
                    }
                }
        }
Ejemplo n.º 2
0
        public void Run()
        {
            if (!System.IO.File.Exists(m_options.Dbpath))
            {
                throw new UserInformationException(string.Format("Database file does not exist: {0}", m_options.Dbpath), "DatabaseFileMissing");
            }

            using (var db = new Database.LocalDeleteDatabase(m_options.Dbpath, "Delete"))
            {
                var tr = db.BeginTransaction();
                try
                {
                    m_result.SetDatabase(db);
                    Utility.UpdateOptionsFromDb(db, m_options);
                    Utility.VerifyParameters(db, m_options);

                    DoRun(db, ref tr, false, false, null);

                    if (!m_options.Dryrun)
                    {
                        using (new Logging.Timer(LOGTAG, "CommitDelete", "CommitDelete"))
                            tr.Commit();

                        db.WriteResults();
                    }
                    else
                    {
                        tr.Rollback();
                    }

                    tr = null;
                }
                finally
                {
                    if (tr != null)
                    {
                        try { tr.Rollback(); }
                        catch { }
                    }
                }
            }
        }