Changeset: 88d9d92ce1a0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/88d9d92ce1a0 Modified Files: clients/odbc/ChangeLog.Jun2023 clients/odbc/winsetup/resource.h clients/odbc/winsetup/setup.c clients/odbc/winsetup/setup.rc Branch: Jun2023 Log Message:
Extended Windows MonetDB ODBC Data Source setup program with option to specify a logfile to enable tracing of ODBC Driver API calls. diffs (211 lines): diff --git a/clients/odbc/ChangeLog.Jun2023 b/clients/odbc/ChangeLog.Jun2023 --- a/clients/odbc/ChangeLog.Jun2023 +++ b/clients/odbc/ChangeLog.Jun2023 @@ -1,6 +1,17 @@ # ChangeLog file for odbc # This file is updated with Maddlog +* Thu May 25 2023 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> +- Extended Windows MonetDB ODBC Data Source setup program with option + to specify a logfile to enable tracing of ODBC Driver API calls. + On other platforms users can edit the odbc.ini file and add a line: + logfile=/home/username/odbctrace.log + When a logfile is specified it will start logging the ODBC Driver API calls + to the logfile after a new connection is made via SQLConnect() or + SQLDriverConnect() or SQLBrowseConnect(). + Note that enabling ODBC logging will slow down the performance of ODBC + applications, so enable it only for analysing ODBC Driver problems. + * Thu Apr 13 2023 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> - Enhanced SQLTables() by adding support for table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter TableType. These are diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h --- a/clients/odbc/winsetup/resource.h +++ b/clients/odbc/winsetup/resource.h @@ -13,14 +13,15 @@ // Used by odbcconfig.rc // #define IDD_SETUP_DIALOG 106 -#define IDC_EDIT_DSN 2000 -#define IDC_EDIT_UID 2001 -#define IDC_EDIT_PWD 2002 -#define IDC_EDIT_HOST 2003 -#define IDB_BANNER 2003 -#define IDC_EDIT_PORT 2004 -#define IDC_BUTTON_CANCEL 2006 -#define IDC_EDIT_DATABASE 2007 +#define IDB_BANNER 2000 +#define IDC_EDIT_DSN 2001 +#define IDC_EDIT_UID 2002 +#define IDC_EDIT_PWD 2003 +#define IDC_EDIT_HOST 2004 +#define IDC_EDIT_PORT 2005 +#define IDC_EDIT_DATABASE 2006 +#define IDC_EDIT_LOGFILE 2007 +#define IDC_BUTTON_CANCEL 2008 // Next default values for new objects // diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c --- a/clients/odbc/winsetup/setup.c +++ b/clients/odbc/winsetup/setup.c @@ -94,6 +94,7 @@ struct data { char *host; char *port; char *database; + char *logfile; HWND parent; WORD request; }; @@ -101,7 +102,7 @@ struct data { static void MergeFromProfileString(const char *dsn, char **datap, const char *entry, const char *defval) { - char buf[256]; + char buf[2048]; if (*datap != NULL) return; @@ -118,7 +119,7 @@ static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static struct data *datap; - char buf[128]; + char buf[2048]; RECT rcDlg, rcOwner; switch (uMsg) { @@ -142,6 +143,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR SetDlgItemText(hwndDlg, IDC_EDIT_HOST, datap->host ? datap->host : ""); SetDlgItemText(hwndDlg, IDC_EDIT_PORT, datap->port ? datap->port : ""); SetDlgItemText(hwndDlg, IDC_EDIT_DATABASE, datap->database ? datap->database : ""); + SetDlgItemText(hwndDlg, IDC_EDIT_LOGFILE, datap->logfile ? datap->logfile : ""); if (datap->request == ODBC_ADD_DSN && datap->dsn && *datap->dsn) EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_DSN), FALSE); return TRUE; @@ -183,6 +185,10 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR if (datap->database) free(datap->database); datap->database = strdup(buf); + GetDlgItemText(hwndDlg, IDC_EDIT_LOGFILE, buf, sizeof(buf)); + if (datap->logfile) + free(datap->logfile); + datap->logfile = strdup(buf); /* fall through */ case IDCANCEL: EndDialog(hwndDlg, LOWORD(wParam)); @@ -226,6 +232,7 @@ ConfigDSN(HWND parent, WORD request, LPC data.host = NULL; data.port = NULL; data.database = NULL; + data.logfile = NULL; data.parent = parent; data.request = request; @@ -251,6 +258,8 @@ ConfigDSN(HWND parent, WORD request, LPC data.port = strdup(value); else if (strncasecmp("database=", attributes, value - attributes) == 0) data.database = strdup(value); + else if (strncasecmp("logfile=", attributes, value - attributes) == 0) + data.logfile = strdup(value); attributes = value + strlen(value) + 1; } @@ -270,14 +279,16 @@ ConfigDSN(HWND parent, WORD request, LPC MergeFromProfileString(data.dsn, &data.host, "host", "localhost"); MergeFromProfileString(data.dsn, &data.port, "port", MAPI_PORT_STR); MergeFromProfileString(data.dsn, &data.database, "database", ""); + MergeFromProfileString(data.dsn, &data.logfile, "logfile", ""); - ODBCLOG("ConfigDSN values: dsn=%s uid=%s pwd=%s host=%s port=%s database=%s\n", + ODBCLOG("ConfigDSN values: dsn=%s uid=%s pwd=%s host=%s port=%s database=%s logfile=%s\n", data.dsn ? data.dsn : "(null)", data.uid ? data.uid : "(null)", data.pwd ? data.pwd : "(null)", data.host ? data.host : "(null)", data.port ? data.port : "(null)", - data.database ? data.database : "(null)"); + data.database ? data.database : "(null)", + data.logfile ? data.logfile : "(null)"); /* we're optimistic: default return value */ rc = TRUE; @@ -363,19 +374,21 @@ ConfigDSN(HWND parent, WORD request, LPC goto finish; } } - ODBCLOG("ConfigDSN writing values: dsn=%s uid=%s pwd=%s host=%s port=%s database=%s\n", + ODBCLOG("ConfigDSN writing values: dsn=%s uid=%s pwd=%s host=%s port=%s database=%s logfile=%s\n", data.dsn ? data.dsn : "(null)", data.uid ? data.uid : "(null)", data.pwd ? data.pwd : "(null)", data.host ? data.host : "(null)", data.port ? data.port : "(null)", - data.database ? data.database : "(null)"); + data.database ? data.database : "(null)", + data.logfile ? data.logfile : "(null)"); if (!SQLWritePrivateProfileString(data.dsn, "uid", data.uid, "odbc.ini") || !SQLWritePrivateProfileString(data.dsn, "pwd", data.pwd, "odbc.ini") || !SQLWritePrivateProfileString(data.dsn, "host", data.host, "odbc.ini") || !SQLWritePrivateProfileString(data.dsn, "port", data.port, "odbc.ini") || - !SQLWritePrivateProfileString(data.dsn, "database", data.database, "odbc.ini")) { + !SQLWritePrivateProfileString(data.dsn, "database", data.database, "odbc.ini") || + !SQLWritePrivateProfileString(data.dsn, "logfile", data.logfile, "odbc.ini")) { rc = FALSE; if (parent) MessageBox(parent, @@ -400,6 +413,8 @@ ConfigDSN(HWND parent, WORD request, LPC free(data.port); if (data.database) free(data.database); + if (data.logfile) + free(data.logfile); ODBCLOG("ConfigDSN returning %s\n", rc ? "TRUE" : "FALSE"); return rc; } diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc --- a/clients/odbc/winsetup/setup.rc +++ b/clients/odbc/winsetup/setup.rc @@ -103,7 +103,7 @@ END // Dialog // -IDD_SETUP_DIALOG DIALOGEX 0, 0, 210, 163 +IDD_SETUP_DIALOG DIALOGEX 0, 0, 226, 163 STYLE DS_MODALFRAME | WS_CAPTION CAPTION "MonetDB Data Source Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 @@ -114,15 +114,17 @@ BEGIN EDITTEXT IDC_EDIT_HOST,75,88,128,14,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_PORT,75,104,128,14,ES_AUTOHSCROLL | ES_NUMBER EDITTEXT IDC_EDIT_DATABASE,75,120,128,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,7,141,50,14 - PUSHBUTTON "Cancel",IDCANCEL,153,141,50,14 + EDITTEXT IDC_EDIT_LOGFILE,75,136,128,14,ES_AUTOHSCROLL LTEXT "Data Source Name",IDC_STATIC,7,42,63,8 LTEXT "User Name",IDC_STATIC,7,58,36,8 LTEXT "Password",IDC_STATIC,7,74,32,8 LTEXT "Host",IDC_STATIC,7,90,16,8 LTEXT "Port",IDC_STATIC,7,106,14,8 + LTEXT "Database",IDC_STATIC,7,122,32,8 + LTEXT "Logfile",IDC_STATIC,7,138,32,8 + DEFPUSHBUTTON "OK",IDOK,7,157,50,14 + PUSHBUTTON "Cancel",IDCANCEL,153,157,50,14 CONTROL 2003,IDC_STATIC,"Static",SS_BITMAP,0,0,240,37 - LTEXT "Database",IDC_STATIC,7,122,32,8 END @@ -137,9 +139,9 @@ BEGIN IDD_SETUP_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 203 + RIGHTMARGIN, 155 TOPMARGIN, 7 - BOTTOMMARGIN, 155 + BOTTOMMARGIN, 219 END END #endif // APSTUDIO_INVOKED _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org