+
+/*
+ * This function will return the exact string(s) from the database engine
+ * indicating all error conditions which have just occured during the
+ * last call to the database engine.
+ *
+ * This demo uses the returned string by displaying it in a wxMessageBox. The
+ * formatting therefore is not the greatest, but this is just a demo, not a
+ * finished product. :-) gt
+ *
+ * NOTE: The value returned by this function is for temporary use only and
+ * should be copied for long term use
+ */
+char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
+{
+ static wxString msg;
+
+ wxString tStr;
+
+ if (ErrFile || ErrLine)
+ {
+ msg += "File: ";
+ msg += ErrFile;
+ msg += " Line: ";
+ tStr.Printf("%d",ErrLine);
+ msg += tStr.GetData();
+ msg += "\n";
+ }
+
+ msg.Append ("\nODBC errors:\n");
+ msg += "\n";
+
+ /* Scan through each database connection displaying
+ * any ODBC errors that have occured. */
+ for (DbList *pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
+ {
+ // Skip over any free connections
+ if (pDbList->Free)
+ continue;
+ // Display errors for this connection
+ for (int i = 0; i < DB_MAX_ERROR_HISTORY; i++)
+ {
+ if (pDbList->PtrDb->errorList[i])
+ {
+ msg.Append(pDbList->PtrDb->errorList[i]);
+ if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
+ msg.Append("\n");
+ }
+ }
+ }
+ msg += "\n";
+
+ return (char*) (const char*) msg;
+} // GetExtendedDBErrorMsg
+
+
+