psqlodbc.git / summary / log / commit / refs

commit    128cd656822683048af12eaca43d1f2d3e16be74
Author:   Hiroshi Inoue <inoue@tpf.co.jp>
Date:     Thu Sep 25 00:11:55 2014 +0000

    Add '#ifdef USE_LIBPQ' around the code which use PreferLibpq option
    introduced in the previous commit.


connection.c | 4 ++++ connection.h | 2 ++ dlg_specific.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/connection.c b/connection.c index ba64dbdb..84efb6a9 100644 --- a/connection.c +++ b/connection.c @@ -300,7 +300,9 @@ CC_conninfo_init(ConnInfo *conninfo, UInt4 option) conninfo->gssauth_use_gssapi = -1; conninfo->keepalive_idle = -1; conninfo->keepalive_interval = -1; +#ifdef USE_LIBPQ conninfo->prefer_libpq = -1; +#endif /* USE_LIBPQ */ #ifdef _HANDLE_ENLIST_IN_DTC_ conninfo->xa_opt = -1; #endif /* _HANDLE_ENLIST_IN_DTC_ */ @@ -334,7 +336,9 @@ CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci) CORR_STRCPY(translation_dll); CORR_STRCPY(translation_option); CORR_VALCPY(focus_password); +#ifdef USE_LIBPQ CORR_VALCPY(prefer_libpq); +#endif /* USE_LIBPQ */ NAME_TO_NAME(ci->conn_settings, sci->conn_settings); CORR_VALCPY(disallow_premature); CORR_VALCPY(allow_keyset); diff --git a/connection.h b/connection.h index 89d4ce44..2e7bd74f 100644 --- a/connection.h +++ b/connection.h @@ -298,7 +298,9 @@ typedef struct char translation_dll[MEDIUM_REGISTRY_LEN]; char translation_option[SMALL_REGISTRY_LEN]; char focus_password; +#ifdef USE_LIBPQ signed char prefer_libpq; +#endif /* USE_LIBPQ */ pgNAME conn_settings; signed char disallow_premature; signed char allow_keyset; diff --git a/dlg_specific.c b/dlg_specific.c index 078c54e5..627114ee 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -220,6 +220,7 @@ makeKeepaliveConnectString(char *target, const ConnInfo *ci, BOOL abbrev) return target; } +#ifdef USE_LIBPQ static char * makePreferLibpqConnectString(char *target, const ConnInfo *ci, BOOL abbrev) { @@ -235,6 +236,7 @@ makePreferLibpqConnectString(char *target, const ConnInfo *ci, BOOL abbrev) sprintf(buf, INI_PREFERLIBPQ "=%u;", ci->prefer_libpq); return target; } +#endif /* USE_LIBPQ */ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) @@ -312,7 +314,9 @@ inolog("hlen=%d", hlen); INI_USESERVERSIDEPREPARE "=%d;" INI_LOWERCASEIDENTIFIER "=%d;" "%s" +#ifdef USE_LIBPQ "%s" +#endif /* USE_LIBPQ */ #ifdef WIN32 INI_GSSAUTHUSEGSSAPI "=%d;" #endif /* WIN32 */ @@ -352,7 +356,9 @@ inolog("hlen=%d", hlen); ,ci->use_server_side_prepare ,ci->lower_case_identifier ,makeKeepaliveConnectString(keepaliveStr, ci, FALSE) +#ifdef USE_LIBPQ ,makePreferLibpqConnectString(preferLibpqStr, ci, FALSE) +#endif /* USE_LIBPQ */ #ifdef WIN32 ,ci->gssauth_use_gssapi #endif /* WIN32 */ @@ -447,7 +453,9 @@ inolog("hlen=%d", hlen); INI_INT8AS "=%d;" ABBR_EXTRASYSTABLEPREFIXES "=%s;" "%s" +#ifdef USE_LIBPQ "%s" +#endif /* USE_LIBPQ */ INI_ABBREVIATE "=%02x%x", encoded_item, ci->drivers.fetch_max, @@ -457,7 +465,9 @@ inolog("hlen=%d", hlen); ci->int8_as, ci->drivers.extra_systable_prefixes, makeKeepaliveConnectString(keepaliveStr, ci, TRUE), +#ifdef USE_LIBPQ makePreferLibpqConnectString(preferLibpqStr, ci, TRUE), +#endif /* USE_LIBPQ */ EFFECTIVE_BIT_COUNT, flag); if (olen < nlen && (PROTOCOL_74(ci) || ci->rollback_on_error >= 0)) { @@ -657,8 +667,10 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value) ci->keepalive_idle = atoi(value); else if (stricmp(attribute, INI_KEEPALIVEINTERVAL) == 0 || stricmp(attribute, ABBR_KEEPALIVEINTERVAL) == 0) ci->keepalive_interval = atoi(value); +#ifdef USE_LIBPQ else if (stricmp(attribute, INI_PREFERLIBPQ) == 0 || stricmp(attribute, ABBR_PREFERLIBPQ) == 0) ci->prefer_libpq = atoi(value); +#endif /* USE_LIBPQ */ else if (stricmp(attribute, INI_SSLMODE) == 0 || stricmp(attribute, ABBR_SSLMODE) == 0) { switch (value[0]) @@ -1054,12 +1066,14 @@ getDSNinfo(ConnInfo *ci, char overwrite) if (0 == (ci->keepalive_interval = atoi(temp))) ci->keepalive_interval = -1; } +#ifdef USE_LIBPQ if (ci->prefer_libpq < 0 || overwrite) { SQLGetPrivateProfileString(DSN, INI_PREFERLIBPQ, "-1", temp, sizeof(temp), ODBC_INI); if (temp[0]) ci->prefer_libpq = atoi(temp); } +#endif /* USE_LIBPQ */ if (ci->sslmode[0] == '\0' || overwrite) SQLGetPrivateProfileString(DSN, INI_SSLMODE, "", ci->sslmode, sizeof(ci->sslmode), ODBC_INI); @@ -1362,11 +1376,13 @@ writeDSNinfo(const ConnInfo *ci) INI_KEEPALIVEINTERVAL, temp, ODBC_INI); +#ifdef USE_LIBPQ sprintf(temp, "%d", ci->prefer_libpq); SQLWritePrivateProfileString(DSN, INI_PREFERLIBPQ, temp, ODBC_INI); +#endif /* USE_LIBPQ */ #ifdef _HANDLE_ENLIST_IN_DTC_ sprintf(temp, "%d", ci->xa_opt); SQLWritePrivateProfileString(DSN, INI_XAOPT, temp, ODBC_INI); [parent: 5af1ff1e7f34]