Changeset: 21bd5080c348 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/21bd5080c348 Modified Files: clients/Tests/exports.stable.out clients/mapilib/connect.c clients/mapilib/mapi.c clients/mapilib/mapi.h clients/mapilib/mapi_intern.h clients/odbc/driver/SQLConnect.c Branch: default Log Message:
Mention 'ODBC' in ClientLibrary if connecting through ODBC diffs (96 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -721,6 +721,7 @@ MapiMsg mapi_set_columnar_protocol(Mapi MapiMsg mapi_set_size_header(Mapi mid, bool value) __attribute__((__nonnull__(1))); MapiMsg mapi_set_time_zone(Mapi mid, int seconds_east_of_utc) __attribute__((__nonnull__(1))); MapiMsg mapi_set_timeout(Mapi mid, unsigned int timeout, bool (*callback)(void *), void *callback_data) __attribute__((__nonnull__(1))); +void mapi_setclientprefix(Mapi mid, const char *prefix); void mapi_setfilecallback(Mapi mid, char *(*getfunc)(void *priv, const char *filename, bool binary, uint64_t offset, size_t *size), char *(*putfunc)(void *priv, const char *filename, const void *data, size_t size), void *priv) __attribute__((__nonnull__(1))); void mapi_setfilecallback2(Mapi mid, char *(*getfunc)(void *priv, const char *filename, bool binary, uint64_t offset, size_t *size), char *(*putfunc)(void *priv, const char *filename, bool binary, const void *data, size_t size), void *priv) __attribute__((__nonnull__(1))); Mapi mapi_settings(msettings *settings) __attribute__((__nonnull__(1))); diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c --- a/clients/mapilib/connect.c +++ b/clients/mapilib/connect.c @@ -406,7 +406,6 @@ send_all_clientinfo(Mapi mid) application_name = (const char*) basename((char*)application_name); } } - const char *client_library = "libmapi " MONETDB_VERSION; const char *client_remark = msetting_string(mp, MP_CLIENT_REMARK); long pid = getpid(); @@ -417,7 +416,10 @@ send_all_clientinfo(Mapi mid) reallocprintf(&buf, &pos, &cap, "ClientHostName=%s\n", hostname); if (application_name[0]) reallocprintf(&buf, &pos, &cap, "ApplicationName=%s\n", application_name); - reallocprintf(&buf, &pos, &cap, "ClientLibrary=%s\n", client_library); + reallocprintf(&buf, &pos, &cap, "ClientLibrary="); + if (mid->clientprefix) + reallocprintf(&buf, &pos, &cap, "%s / ", mid->clientprefix); + reallocprintf(&buf, &pos, &cap, "libmapi %s\n", MONETDB_VERSION); if (client_remark[0]) reallocprintf(&buf, &pos, &cap, "ClientRemark=%s\n", client_remark); if (pid > 0) diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -2021,6 +2021,7 @@ mapi_destroy(Mapi mid) free(mid->noexplain); if (mid->errorstr && mid->errorstr != mapi_nomem) free(mid->errorstr); + free(mid->clientprefix); msettings_destroy(mid->settings); @@ -2246,6 +2247,17 @@ mapi_setfilecallback(Mapi mid, mid->filecontentprivate_old = filecontentprivate; } +void +mapi_setclientprefix(Mapi mid, const char *prefix) +{ + free(mid->clientprefix); + if (prefix == NULL) + mid->clientprefix = NULL; + else + mid->clientprefix = strdup(prefix); + +} + #define testBinding(hdl,fnr) \ do { \ mapi_hdl_check(hdl); \ diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h --- a/clients/mapilib/mapi.h +++ b/clients/mapilib/mapi.h @@ -105,6 +105,7 @@ mapi_export void mapi_setfilecallback( const void *data, size_t size), void *priv) __attribute__((__nonnull__(1))); +mapi_export void mapi_setclientprefix(Mapi mid, const char *prefix); mapi_export MapiMsg mapi_error(Mapi mid) __attribute__((__nonnull__(1))); diff --git a/clients/mapilib/mapi_intern.h b/clients/mapilib/mapi_intern.h --- a/clients/mapilib/mapi_intern.h +++ b/clients/mapilib/mapi_intern.h @@ -238,6 +238,7 @@ struct MapiStruct { MapiMsg error; /* Error occurred */ char *errorstr; /* error from server */ const char *action; /* pointer to constant string */ + char *clientprefix; /* prefix for 'client' clientinfo; NULL or allocated string */ struct BlockCache blk; bool connected; diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c --- a/clients/odbc/driver/SQLConnect.c +++ b/clients/odbc/driver/SQLConnect.c @@ -481,6 +481,7 @@ MNDBConnectSettings(ODBCDbc *dbc, const Mapi mid = mapi_settings(settings); if (mid) { settings = NULL; // will be free'd as part of 'mid' now + mapi_setclientprefix(mid, "ODBC " MONETDB_VERSION); mapi_setAutocommit(mid, dbc->sql_attr_autocommit == SQL_AUTOCOMMIT_ON); mapi_set_size_header(mid, true); mapi_reconnect(mid); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org