void RunOneUpdate(UpdateHop updateScript, string operationName) { logger.Info(operationName); textviewLog.Buffer.Text = textviewLog.Buffer.Text + operationName + "\n"; string sql; using (Stream stream = updateScript.Assembly.GetManifestResourceStream(updateScript.Resource)) { if (stream == null) { throw new InvalidOperationException(String.Format("Ресурс {0} указанный в обновлениях не найден.", updateScript.Resource)); } StreamReader reader = new StreamReader(stream); sql = reader.ReadToEnd(); } int predictedCount = Regex.Matches(sql, ";").Count; logger.Debug("Предполагаем наличие {0} команд в скрипте.", predictedCount); progressbarTotal.Text = operationName; progressbarTotal.Adjustment.Value = 0; progressbarTotal.Adjustment.Upper = predictedCount; QSMain.WaitRedraw(); var script = new MySqlScript(QSMain.connectionDB, sql); script.StatementExecuted += Script_StatementExecuted; var commands = script.Execute(); logger.Debug("Выполнено {0} SQL-команд.", commands); }
public DBUpdateProcess(UpdateHop hop) { this.Build (); updateHop = hop; progressbarTotal.Text = String.Format ("Обновление: {0} → {1}", StringWorks.VersionToShortString (updateHop.Source), StringWorks.VersionToShortString (updateHop.Destanation) ); string fileName = System.IO.Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "Резервные копии", String.Format ("{0}{1:yyMMdd-HHmm}.sql", MainSupport.ProjectVerion.Product, DateTime.Now) ); entryFileName.Text = fileName; }
public DBUpdateProcess(UpdateHop hop) { this.Build(); updateHop = hop; progressbarTotal.Text = String.Format("Обновление: {0} → {1}", StringWorks.VersionToShortString(updateHop.Source), StringWorks.VersionToShortString(updateHop.Destanation) ); string fileName = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Резервные копии", String.Format("{0}{1:yyMMdd-HHmm}.sql", MainSupport.ProjectVerion.Product, DateTime.Now) ); entryFileName.Text = fileName; }
void RunOneUpdate(UpdateHop updateScript, string operationName) { logger.Info (operationName); textviewLog.Buffer.Text = textviewLog.Buffer.Text + operationName + "\n"; string sql; using(Stream stream = updateScript.Assembly.GetManifestResourceStream(updateScript.Resource)) { if(stream == null) throw new InvalidOperationException( String.Format("Ресурс {0} указанный в обновлениях не найден.", updateScript.Resource)); StreamReader reader = new StreamReader(stream); sql = reader.ReadToEnd(); } int predictedCount = Regex.Matches( sql, ";").Count; logger.Debug ("Предполагаем наличие {0} команд в скрипте.", predictedCount); progressbarTotal.Text = operationName; progressbarTotal.Adjustment.Value = 0; progressbarTotal.Adjustment.Upper = predictedCount; QSMain.WaitRedraw (); var script = new MySqlScript(QSMain.connectionDB, sql); script.StatementExecuted += Script_StatementExecuted; var commands = script.Execute (); logger.Debug ("Выполнено {0} SQL-команд.", commands); }