Exemple #1
0
        public ResultMessage InData(DBHost host, DBInfo tmodel, SCHEMA source)
        {
            ResultMessage resultMessage = new ResultMessage();

            this.SetProgress("获取目标数据结构");
            SCHEMA      sCHEMA      = MySqlCore.GetSCHEMA(Data.Instance.InformationConnString(host), tmodel.DBName);
            MySqlScript mySqlScript = new MySqlScript(source, sCHEMA);
            TableMySQL  tableMySQL  = new TableMySQL(Data.Instance.DBConnString(host, tmodel.DBName));

            this.SetProgress("生成需要更新的脚本,并更新");
            try
            {
                foreach (string current in mySqlScript.MakeScript())
                {
                    this.SetProgress(current);
                    tableMySQL.ExecuteNonQuery(current);
                }
                this.SetProgress("更新成功");
                resultMessage.Result  = true;
                resultMessage.Message = "更新成功";
            }
            catch (Exception ex)
            {
                this.SetProgress("失败" + ex.Message);
                resultMessage.Result  = false;
                resultMessage.Message = ex.Message;
            }
            return(resultMessage);
        }