@@ -39,6 +39,7 @@ namespace
3939#define INI_PORT TEXT (" Port" ) /* Port on which the ClickHouse is listening */
4040#define INI_READONLY TEXT (" ReadOnly" ) /* Database is read only */
4141#define INI_PROTOCOL TEXT (" Protocol" ) /* What protocol (6.2) */
42+ #define INI_TIMEOUT TEXT (" Timeout" )
4243#define INI_DSN TEXT (" ClickHouse" )
4344
4445#define ABBR_PROTOCOL TEXT (" A1" )
@@ -70,6 +71,7 @@ struct ConnInfo
7071 TCHAR port[SMALL_REGISTRY_LEN];
7172 TCHAR sslmode[16 ];
7273 TCHAR onlyread[SMALL_REGISTRY_LEN];
74+ TCHAR timeout[SMALL_REGISTRY_LEN];
7375 TCHAR fake_oid_index[SMALL_REGISTRY_LEN];
7476 TCHAR show_oid_column[SMALL_REGISTRY_LEN];
7577 TCHAR row_versioning[SMALL_REGISTRY_LEN];
@@ -113,7 +115,7 @@ struct SetupDialogData
113115BOOL
114116copyAttributes (ConnInfo *ci, LPCTSTR attribute, LPCTSTR value)
115117{
116- BOOL found = TRUE ;
118+ BOOL found = TRUE ;
117119
118120 if (stricmp (attribute, TEXT (" DSN" )) == 0 )
119121 strcpy (ci->dsn , value);
@@ -142,6 +144,9 @@ copyAttributes(ConnInfo *ci, LPCTSTR attribute, LPCTSTR value)
142144 else if (stricmp (attribute, INI_READONLY) == 0 || stricmp (attribute, ABBR_READONLY) == 0 )
143145 strcpy (ci->onlyread , value);
144146
147+ else if (stricmp (attribute, INI_TIMEOUT) == 0 )
148+ strcpy (ci->timeout , value);
149+
145150 else
146151 found = FALSE ;
147152
@@ -218,6 +223,9 @@ void getDSNinfo(ConnInfo *ci, bool overwrite)
218223
219224 if (ci->password [0 ] == ' \0 ' || overwrite)
220225 SQLGetPrivateProfileString (DSN, INI_PASSWORD, TEXT (" " ), ci->password , sizeof (ci->password ), ODBC_INI);
226+
227+ if (ci->timeout [0 ] == ' \0 ' || overwrite)
228+ SQLGetPrivateProfileString (DSN, INI_TIMEOUT, TEXT (" 30" ), ci->timeout , sizeof (ci->timeout ), ODBC_INI);
221229}
222230
223231/* This is for datasource based options only */
@@ -262,6 +270,11 @@ void writeDSNinfo(const ConnInfo * ci)
262270 INI_PASSWORD,
263271 ci->password ,
264272 ODBC_INI);
273+
274+ SQLWritePrivateProfileString (DSN,
275+ INI_TIMEOUT,
276+ ci->timeout ,
277+ ODBC_INI);
265278}
266279
267280static bool setDSNAttributes (HWND hwndParent, SetupDialogData * lpsetupdlg, DWORD * errcode)
@@ -386,6 +399,7 @@ INT_PTR CALLBACK
386399 SetDlgItemText (hdlg, IDC_DATABASE, ci->database );
387400 SetDlgItemText (hdlg, IDC_USER, ci->username );
388401 SetDlgItemText (hdlg, IDC_PASSWORD, ci->password );
402+ SetDlgItemText (hdlg, IDC_TIMEOUT, ci->timeout );
389403
390404 return TRUE ; /* Focus was not set */
391405 }
@@ -404,6 +418,7 @@ INT_PTR CALLBACK
404418 GetDlgItemText (hdlg, IDC_DATABASE, ci->database , sizeof (ci->database ));
405419 GetDlgItemText (hdlg, IDC_USER, ci->username , sizeof (ci->username ));
406420 GetDlgItemText (hdlg, IDC_PASSWORD, ci->password , sizeof (ci->password ));
421+ GetDlgItemText (hdlg, IDC_TIMEOUT, ci->timeout , sizeof (ci->timeout ));
407422
408423 /* Return to caller */
409424 case IDCANCEL:
0 commit comments