From c3fdf8925ed7fbb3017be052e0700c51ceb12e0b Mon Sep 17 00:00:00 2001
From: Hiroshi Inoue <inoue@tpf.co.jp>
Date: Fri, 26 Jul 2002 08:45:54 +0000
Subject: [PATCH] Fix a bug about the handling of CX parameter of the
 connection string reported by Sergey Smirnov.

---
 src/interfaces/odbc/connection.c   | 1 +
 src/interfaces/odbc/dlg_specific.c | 1 -
 src/interfaces/odbc/psqlodbc.rc    | 6 +++---
 src/interfaces/odbc/setup.c        | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/interfaces/odbc/connection.c b/src/interfaces/odbc/connection.c
index 35a5e87711b..45a23386e33 100644
--- a/src/interfaces/odbc/connection.c
+++ b/src/interfaces/odbc/connection.c
@@ -112,6 +112,7 @@ PGAPI_Connect(
 	make_string(szDSN, cbDSN, ci->dsn);
 
 	/* get the values for the DSN from the registry */
+	memcpy(&ci->drivers, &globals, sizeof(globals));
 	getDSNinfo(ci, CONN_OVERWRITE);
 	logs_on_off(1, ci->drivers.debug, ci->drivers.commlog);
 	/* initialize pg_version from connInfo.protocol    */
diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c
index 32c50c35cef..4f96a6f7c56 100644
--- a/src/interfaces/odbc/dlg_specific.c
+++ b/src/interfaces/odbc/dlg_specific.c
@@ -421,7 +421,6 @@ getDSNinfo(ConnInfo *ci, char overwrite)
  *	If a driver keyword was present, then dont use a DSN and return.
  *	If DSN is null and no driver, then use the default datasource.
  */
-	memcpy(&ci->drivers, &globals, sizeof(globals));
 	if (DSN[0] == '\0')
 	{
 		if (ci->driver[0] != '\0')
diff --git a/src/interfaces/odbc/psqlodbc.rc b/src/interfaces/odbc/psqlodbc.rc
index e1e76587d94..11f63fe9dbc 100644
--- a/src/interfaces/odbc/psqlodbc.rc
+++ b/src/interfaces/odbc/psqlodbc.rc
@@ -62,8 +62,8 @@ FONT 10, "Terminal"
 BEGIN
     RTEXT           "&Data Source",IDC_DSNAMETEXT,5,11,50,12,NOT WS_GROUP
     EDITTEXT        IDC_DSNAME,57,10,72,12,ES_AUTOHSCROLL | WS_GROUP
-    RTEXT           "Des&cription",IDC_DESCTEXT,134,11,39,12,NOT WS_GROUP
-    EDITTEXT        IDC_DESC,175,10,108,12,ES_AUTOHSCROLL
+    RTEXT           "Des&cription",IDC_DESCTEXT,129,10,45,12,NOT WS_GROUP
+    EDITTEXT        IDC_DESC,176,10,107,12,ES_AUTOHSCROLL
     RTEXT           "Data&base",IDC_STATIC,16,26,38,12,NOT WS_GROUP
     EDITTEXT        IDC_DATABASE,57,25,72,12,ES_AUTOHSCROLL
     RTEXT           "&Server",IDC_STATIC,26,41,29,12,NOT WS_GROUP
@@ -171,7 +171,7 @@ BEGIN
                     WS_TABSTOP,227,95,29,10
     GROUPBOX        "Protocol",IDC_STATIC,5,115,277,25
     CONTROL         "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | 
-                    WS_GROUP,44,126,35,10
+                    WS_GROUP,44,126,49,10
     CONTROL         "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
                     117,126,26,10
     CONTROL         "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
diff --git a/src/interfaces/odbc/setup.c b/src/interfaces/odbc/setup.c
index 51173ec39ec..7320cbba58e 100644
--- a/src/interfaces/odbc/setup.c
+++ b/src/interfaces/odbc/setup.c
@@ -27,6 +27,7 @@
 #define INTFUNC  __stdcall
 
 extern HINSTANCE NEAR s_hModule;	/* Saved module handle. */
+extern GLOBAL_VALUES	globals;
 
 /* Constants */
 #define MIN(x,y)	  ((x) < (y) ? (x) : (y))
@@ -217,6 +218,7 @@ ConfigDlgProc(HWND hdlg,
 			 */
 			/* override settings in ODBC.INI */
 
+			memcpy(&ci->drivers, &globals, sizeof(globals));
 			/* Get the rest of the common attributes */
 			getDSNinfo(ci, CONN_DONT_OVERWRITE);
 
-- 
GitLab