/// <summary> /// Generate a detailed report for an ingres exception. /// </summary> /// <param name="ex">The exception to generate a report for.</param> /// <param name="message">A custom message to include in the report.</param> /// <returns>A detailed exception report.</returns> public static string ExceptionDetailReport(IngresException ex, string message) { StringBuilder sb = new StringBuilder(); sb.AppendLine("*****************************************************************************"); sb.AppendLine(String.Format("Ingres Exception Detail Dump - Generated {0}", DateTime.Now)); sb.AppendLine("*****************************************************************************\n"); sb.AppendLine(message + "\n\n"); sb.AppendLine(string.Format("Source : {0}\n", ex.Source)); sb.AppendLine(string.Format("Message : {0}\n", ex.Message)); sb.AppendLine(string.Format("Help Link : {0}\n", ex.HelpLink)); sb.AppendLine(string.Format("Stack Trace : {0}\n\n", ex.StackTrace)); IngresErrorCollection errorCollection = ex.Errors; foreach (IngresError ingresError in errorCollection) { sb.Append(Environment.NewLine); sb.AppendLine(String.Format("Message : {0}", ingresError.Message)); sb.AppendLine(String.Format("Native Error : {0}", ingresError.NativeError)); sb.AppendLine(String.Format("Number : {0}", ingresError.Number)); sb.AppendLine(String.Format("Source : {0}", ingresError.Source)); sb.AppendLine(String.Format("SQL State : {0}", ingresError.SQLState)); } return(sb.ToString()); }
private void FireInfoMessageEvent() { IngresErrorCollection messages; SQLWarningCollection warnings; if (advanStmt == null) return; warnings = advanStmt.Warnings; if (warnings == null) return; messages = new IngresErrorCollection(); foreach (object obj in warnings) { SqlEx ex = (SqlEx) obj; IngresException ingresEx = (IngresException)ex.createProviderException(); foreach (IngresError msg in ingresEx.Errors) messages.Add(msg); } if (messages == null) return; if (this._connection != null) this._connection.FireInfoMessageEvent(messages); advanStmt.clearWarnings(); // make sure we don't re-send warnings }
internal void FireInfoMessageEvent(IngresErrorCollection errors) { if (errors == null || errors.Count == 0) // return if no warnings return; // retrieve the delegate from the Components.Events property IngresInfoMessageEventHandler infoMessageEventHandler = (IngresInfoMessageEventHandler)Events[objEeventInfoMessage]; if (infoMessageEventHandler != null) { infoMessageEventHandler( this, new IngresInfoMessageEventArgs(errors)); } }
internal IngresInfoMessageEventArgs( IngresErrorCollection errors) { this._errors = errors; }