/// <summary> /// Formats the warnings returned by an executed query contained in a <see cref="MySqlConnection"/> instance. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="args">Event arguments.</param> private void FormatWarnings(object sender, MySqlInfoMessageEventArgs args) { if (args.errors.Length == 0) { return; } string nl = string.Empty; if (_warningsBuilder == null) { _warningsBuilder = new StringBuilder(MiscUtilities.STRING_BUILDER_DEFAULT_CAPACITY); } else { nl = Environment.NewLine; } string excelRowText = ExcelRowText; bool addExcelRowText = !string.IsNullOrEmpty(excelRowText); foreach (var warning in args.errors) { WarningsQuantity++; _warningsBuilder.Append(nl); _warningsBuilder.AppendFormat(_executionOrderFormat, ExecutionOrder); _warningsBuilder.AppendFormat(": {0} - {1}", warning.Code, warning.Message); if (addExcelRowText) { _warningsBuilder.AppendFormat(" (Excel row: {0}).", excelRowText); } nl = Environment.NewLine; } }
private static void Connection_InfoMessage(object sender, MySqlInfoMessageEventArgs args) { int i = 0; while (i < args.errors.Length) { Console.WriteLine($"InfoMessage: {args.errors[i]}"); i++; } }
/// <summary> /// Handles the InfoMessage event of the conn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="T:MySql.Data.MySqlClient.MySqlInfoMessageEventArgs"/> instance containing the event data.</param> private void conn_InfoMessage(object sender, MySqlInfoMessageEventArgs args) { //Gets last MySQL error and format it MySqlError lastError = args.errors[args.errors.Length - 1]; string error = String.Format( "Error #{0} - {2} [{1}]", lastError.Code, lastError.Level, lastError.Message ); //Throws an exception to our Error event if (Error != null) { Error(this, new ExceptionEventArgs(new Exception(error))); } }
private void WarningsInfoMessage(object sender, MySqlInfoMessageEventArgs args) { Assert.AreEqual(1, args.errors.Length); }
private void WarningsInfoMessage(object sender, MySqlInfoMessageEventArgs args) { Assert.AreEqual(1, args.errors.Length); }
private void WarningsInfoMessage(object sender, MySqlInfoMessageEventArgs args) { Assert.Single(args.errors); }
private static void OnDatabaseMessage(object sender, MySqlInfoMessageEventArgs args) { Debug.Log(args); }
private void WarningsInfoMessage(object sender, MySqlInfoMessageEventArgs args) { Assert.That(args.errors, Has.One.Items); }
private void OnMySQLMessageInfo(object sender, MySqlInfoMessageEventArgs args) { }
private void ddl_mysql_InfoMessage(object sender, MySqlInfoMessageEventArgs args) { throw new DALException(args.ToString()); }
private void DeltaCon_InfoMessage(object sender, MySqlInfoMessageEventArgs args) { }