예제 #1
0
        //--- Constructors ---
        public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version)
        {
            _effectiveVersion = new VersionInfo(version);
            if(!_effectiveVersion.IsValid) {
                throw new VersionInfoException(_effectiveVersion);
            }

            // initialize the data catalog
            var dataFactory = new DataFactory("MySql.Data", "?");
            var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword);
            _dataCatalog = new DataCatalog(dataFactory, connectionString);
            _dataCatalog.TestConnection();
        }
예제 #2
0
        //--- Constructors ---
        public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version, uint timeout)
        {
            if(string.IsNullOrEmpty(version)) {
                _targetVersion = null;
            } else {
                _targetVersion = new VersionInfo(version);
                if(!_targetVersion.IsValid) {
                    throw new VersionInfoException(_targetVersion);
                }
            }

            // initialize the data catalog
            var dataFactory = new DataFactory("MySql.Data", "?");
            var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword, timeout);
            _dataCatalog = new DataCatalog(dataFactory, connectionString);
            _dataCatalog.TestConnection();
        }
예제 #3
0
        //--- Methods ---
        public VersionDiff CompareTo(VersionInfo other)
        {
            if(!IsValid || !other.IsValid) {
                return Raw.CompareTo(other.Raw) == 0
                    ? new VersionDiff(VersionChange.None, VersionSeverity.None)
                    : new VersionDiff(VersionChange.Incompatible, VersionSeverity.Unknown);
            }
            var change = VersionChange.None;
            var severity = VersionSeverity.None;

            if(Major > other.Major) {
                change = VersionChange.Upgrade;
                severity = VersionSeverity.Major;
            } else if(Major < other.Major) {
                change = VersionChange.Downgrade;
                severity = VersionSeverity.Major;
            } else if(Minor > other.Minor) {
                change = VersionChange.Upgrade;
                severity = VersionSeverity.Minor;
            } else if(Minor < other.Minor) {
                change = VersionChange.Downgrade;
                severity = VersionSeverity.Minor;
            } else if(Revision > other.Revision) {
                change = VersionChange.Upgrade;
                severity = VersionSeverity.Revision;
            } else if(Revision < other.Revision) {
                change = VersionChange.Downgrade;
                severity = VersionSeverity.Revision;
            }
            return new VersionDiff(change, severity);
        }
예제 #4
0
 public DbMethod(MethodInfo methodInfo, VersionInfo targetVersion, MethodType methodType)
 {
     _methodInfo    = methodInfo;
     _targetVersion = targetVersion;
     _methodType    = methodType;
 }
예제 #5
0
 //--- Constructors ---
 public DbMethod(MethodInfo methodInfo, VersionInfo targetVersion)
 {
     _methodInfo    = methodInfo;
     _targetVersion = targetVersion;
     _methodType    = MethodType.Update;
 }
예제 #6
0
 public VersionInfoException(VersionInfo _versionInfo)
     : base(String.Format("Version string is invalid : {0}", _versionInfo.ToString()))
 {
 }