Click here to Skip to main content
15,896,727 members
Articles / Desktop Programming / Windows Forms

SQLite Compare Utility

Rate me:
Please Sign up or sign in to vote.
4.89/5 (68 votes)
21 Feb 2015LGPL35 min read 285.6K   37.2K   131  
Utility for comparing two SQLite database files for both structure and data
using System;
using System.Collections.Generic;
using System.Text;

namespace SQLiteParser
{
    public class SQLiteCaseItem
    {
        private SQLiteCaseItem()
        {
        }

        public SQLiteCaseItem(SQLiteExpression whenExpr, SQLiteExpression thenExpr)
        {
            _when = whenExpr;
            _then = thenExpr;
        }

        public SQLiteExpression WhenExpression
        {
            get { return _when; }
            set { _when = value; }
        }

        public SQLiteExpression ThenExpression
        {
            get { return _then; }
            set { _then = value; }
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            SQLiteCaseItem dst = obj as SQLiteCaseItem;
            if (dst == null)
                return false;

            if (!RefCompare.CompareMany(_when, dst._when, _then, dst._then))
                return false;

            return base.Equals(obj);
        }

        public override string ToString()
        {
            return "WHEN " + _when.ToString() + " THEN " + _then.ToString();
        }

        public virtual object Clone()
        {
            SQLiteExpression when = null;
            if (_when != null)
                when = (SQLiteExpression)_when.Clone();
            SQLiteExpression then = null;
            if (_then != null)
                then = (SQLiteExpression)_then.Clone();

            SQLiteCaseItem res = new SQLiteCaseItem();
            res._when = when;
            res._then = then;
            return res;
        }

        private SQLiteExpression _when;
        private SQLiteExpression _then;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer
Israel Israel
My name is Liron Levi and I'm developing software for fun & profit for 15 years already.

Comments and Discussions