Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 468b9d8

Browse files
committed
Move updateCommon() into Win32 block because it is only used there.
1 parent 20dd23c commit 468b9d8

File tree

1 file changed

+105
-106
lines changed

1 file changed

+105
-106
lines changed

src/interfaces/odbc/dlg_specific.c

Lines changed: 105 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ extern GLOBAL_VALUES globals;
5252
#ifdef WIN32
5353
static int driver_optionsDraw(HWND, const ConnInfo *, int src, BOOL enable);
5454
static int driver_options_update(HWND hdlg, ConnInfo *ci, BOOL);
55-
#endif
5655
static void updateCommons(const ConnInfo *ci);
56+
#endif
5757

5858
#ifdef WIN32
5959
void
@@ -390,6 +390,110 @@ ds_optionsProc(HWND hdlg,
390390
return FALSE;
391391
}
392392

393+
/*
394+
* This function writes any global parameters (that can be manipulated)
395+
* to the ODBCINST.INI portion of the registry
396+
*/
397+
static void
398+
updateCommons(const ConnInfo *ci)
399+
{
400+
const char *sectionName;
401+
const char *fileName;
402+
const GLOBAL_VALUES *comval;
403+
char tmp[128];
404+
405+
if (ci)
406+
if (ci->dsn && ci->dsn[0])
407+
{
408+
mylog("DSN=%s updating\n", ci->dsn);
409+
comval = &(ci->drivers);
410+
sectionName = ci->dsn;
411+
fileName = ODBC_INI;
412+
}
413+
else
414+
{
415+
mylog("ci but dsn==NULL\n");
416+
return;
417+
}
418+
else
419+
{
420+
mylog("drivers updating\n");
421+
comval = &globals;
422+
sectionName = DBMS_NAME;
423+
fileName = ODBCINST_INI;
424+
}
425+
sprintf(tmp, "%d", comval->fetch_max);
426+
SQLWritePrivateProfileString(sectionName,
427+
INI_FETCH, tmp, fileName);
428+
429+
sprintf(tmp, "%d", comval->commlog);
430+
SQLWritePrivateProfileString(sectionName,
431+
INI_COMMLOG, tmp, fileName);
432+
433+
sprintf(tmp, "%d", comval->debug);
434+
SQLWritePrivateProfileString(sectionName,
435+
INI_DEBUG, tmp, fileName);
436+
437+
sprintf(tmp, "%d", comval->disable_optimizer);
438+
SQLWritePrivateProfileString(sectionName,
439+
INI_OPTIMIZER, tmp, fileName);
440+
441+
sprintf(tmp, "%d", comval->ksqo);
442+
SQLWritePrivateProfileString(sectionName,
443+
INI_KSQO, tmp, fileName);
444+
445+
/* Never update the onlyread, unique_index from this module
446+
sprintf(tmp, "%d", comval->unique_index);
447+
SQLWritePrivateProfileString(sectionName,
448+
INI_UNIQUEINDEX, tmp, fileName);
449+
450+
sprintf(tmp, "%d", comval->onlyread);
451+
SQLWritePrivateProfileString(sectionName,
452+
INI_READONLY, tmp, fileName);*/
453+
454+
sprintf(tmp, "%d", comval->use_declarefetch);
455+
SQLWritePrivateProfileString(sectionName,
456+
INI_USEDECLAREFETCH, tmp, fileName);
457+
458+
sprintf(tmp, "%d", comval->unknown_sizes);
459+
SQLWritePrivateProfileString(sectionName,
460+
INI_UNKNOWNSIZES, tmp, fileName);
461+
462+
sprintf(tmp, "%d", comval->text_as_longvarchar);
463+
SQLWritePrivateProfileString(sectionName,
464+
INI_TEXTASLONGVARCHAR, tmp, fileName);
465+
466+
sprintf(tmp, "%d", comval->unknowns_as_longvarchar);
467+
SQLWritePrivateProfileString(sectionName,
468+
INI_UNKNOWNSASLONGVARCHAR, tmp, fileName);
469+
470+
sprintf(tmp, "%d", comval->bools_as_char);
471+
SQLWritePrivateProfileString(sectionName,
472+
INI_BOOLSASCHAR, tmp, fileName);
473+
474+
sprintf(tmp, "%d", comval->parse);
475+
SQLWritePrivateProfileString(sectionName,
476+
INI_PARSE, tmp, fileName);
477+
478+
sprintf(tmp, "%d", comval->cancel_as_freestmt);
479+
SQLWritePrivateProfileString(sectionName,
480+
INI_CANCELASFREESTMT, tmp, fileName);
481+
482+
sprintf(tmp, "%d", comval->max_varchar_size);
483+
SQLWritePrivateProfileString(sectionName,
484+
INI_MAXVARCHARSIZE, tmp, fileName);
485+
486+
sprintf(tmp, "%d", comval->max_longvarchar_size);
487+
SQLWritePrivateProfileString(sectionName,
488+
INI_MAXLONGVARCHARSIZE, tmp, fileName);
489+
490+
SQLWritePrivateProfileString(sectionName,
491+
INI_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, fileName);
492+
493+
/* Never update the conn_setting from this module
494+
SQLWritePrivateProfileString(sectionName,
495+
INI_CONNSETTINGS, comval->conn_settings, fileName); */
496+
}
393497
#endif /* WIN32 */
394498

395499

@@ -997,108 +1101,3 @@ getCommonDefaults(const char *section, const char *filename, ConnInfo *ci)
9971101
strcpy(comval->protocol, DEFAULT_PROTOCOL);
9981102
}
9991103
}
1000-
1001-
/*
1002-
* This function writes any global parameters (that can be manipulated)
1003-
* to the ODBCINST.INI portion of the registry
1004-
*/
1005-
static void
1006-
updateCommons(const ConnInfo *ci)
1007-
{
1008-
const char *sectionName;
1009-
const char *fileName;
1010-
const GLOBAL_VALUES *comval;
1011-
char tmp[128];
1012-
1013-
if (ci)
1014-
if (ci->dsn && ci->dsn[0])
1015-
{
1016-
mylog("DSN=%s updating\n", ci->dsn);
1017-
comval = &(ci->drivers);
1018-
sectionName = ci->dsn;
1019-
fileName = ODBC_INI;
1020-
}
1021-
else
1022-
{
1023-
mylog("ci but dsn==NULL\n");
1024-
return;
1025-
}
1026-
else
1027-
{
1028-
mylog("drivers updating\n");
1029-
comval = &globals;
1030-
sectionName = DBMS_NAME;
1031-
fileName = ODBCINST_INI;
1032-
}
1033-
sprintf(tmp, "%d", comval->fetch_max);
1034-
SQLWritePrivateProfileString(sectionName,
1035-
INI_FETCH, tmp, fileName);
1036-
1037-
sprintf(tmp, "%d", comval->commlog);
1038-
SQLWritePrivateProfileString(sectionName,
1039-
INI_COMMLOG, tmp, fileName);
1040-
1041-
sprintf(tmp, "%d", comval->debug);
1042-
SQLWritePrivateProfileString(sectionName,
1043-
INI_DEBUG, tmp, fileName);
1044-
1045-
sprintf(tmp, "%d", comval->disable_optimizer);
1046-
SQLWritePrivateProfileString(sectionName,
1047-
INI_OPTIMIZER, tmp, fileName);
1048-
1049-
sprintf(tmp, "%d", comval->ksqo);
1050-
SQLWritePrivateProfileString(sectionName,
1051-
INI_KSQO, tmp, fileName);
1052-
1053-
/* Never update the onlyread, unique_index from this module
1054-
sprintf(tmp, "%d", comval->unique_index);
1055-
SQLWritePrivateProfileString(sectionName,
1056-
INI_UNIQUEINDEX, tmp, fileName);
1057-
1058-
sprintf(tmp, "%d", comval->onlyread);
1059-
SQLWritePrivateProfileString(sectionName,
1060-
INI_READONLY, tmp, fileName);*/
1061-
1062-
sprintf(tmp, "%d", comval->use_declarefetch);
1063-
SQLWritePrivateProfileString(sectionName,
1064-
INI_USEDECLAREFETCH, tmp, fileName);
1065-
1066-
sprintf(tmp, "%d", comval->unknown_sizes);
1067-
SQLWritePrivateProfileString(sectionName,
1068-
INI_UNKNOWNSIZES, tmp, fileName);
1069-
1070-
sprintf(tmp, "%d", comval->text_as_longvarchar);
1071-
SQLWritePrivateProfileString(sectionName,
1072-
INI_TEXTASLONGVARCHAR, tmp, fileName);
1073-
1074-
sprintf(tmp, "%d", comval->unknowns_as_longvarchar);
1075-
SQLWritePrivateProfileString(sectionName,
1076-
INI_UNKNOWNSASLONGVARCHAR, tmp, fileName);
1077-
1078-
sprintf(tmp, "%d", comval->bools_as_char);
1079-
SQLWritePrivateProfileString(sectionName,
1080-
INI_BOOLSASCHAR, tmp, fileName);
1081-
1082-
sprintf(tmp, "%d", comval->parse);
1083-
SQLWritePrivateProfileString(sectionName,
1084-
INI_PARSE, tmp, fileName);
1085-
1086-
sprintf(tmp, "%d", comval->cancel_as_freestmt);
1087-
SQLWritePrivateProfileString(sectionName,
1088-
INI_CANCELASFREESTMT, tmp, fileName);
1089-
1090-
sprintf(tmp, "%d", comval->max_varchar_size);
1091-
SQLWritePrivateProfileString(sectionName,
1092-
INI_MAXVARCHARSIZE, tmp, fileName);
1093-
1094-
sprintf(tmp, "%d", comval->max_longvarchar_size);
1095-
SQLWritePrivateProfileString(sectionName,
1096-
INI_MAXLONGVARCHARSIZE, tmp, fileName);
1097-
1098-
SQLWritePrivateProfileString(sectionName,
1099-
INI_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, fileName);
1100-
1101-
/* Never update the conn_setting from this module
1102-
SQLWritePrivateProfileString(sectionName,
1103-
INI_CONNSETTINGS, comval->conn_settings, fileName); */
1104-
}

0 commit comments

Comments
 (0)