From 53ca55f91c40dcc488d6ecbd08b3e04907b62399 Mon Sep 17 00:00:00 2001 From: Laurent Goujon Date: Wed, 25 Jan 2017 10:52:31 -0800 Subject: DRILL-5220: Provide API to set application/client names in C++ connector Add method to DrillClientConfig to set the client and the application names in the C++ connector. Allow the ODBC driver (or any user of the C++ connector) to provide more specific informations like the application using the client. This closes #728 --- .../client/src/include/drill/drillClient.hpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'contrib/native/client/src/include') diff --git a/contrib/native/client/src/include/drill/drillClient.hpp b/contrib/native/client/src/include/drill/drillClient.hpp index 29ae6c284..00ff72344 100644 --- a/contrib/native/client/src/include/drill/drillClient.hpp +++ b/contrib/native/client/src/include/drill/drillClient.hpp @@ -91,6 +91,43 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{ static int32_t getQueryTimeout(); static int32_t getHeartbeatFrequency(); static logLevel_t getLogLevel(); + + /** + * Return the client name sent to the server when connecting + * + * @return the current client name + */ + static const std::string& getClientName(); + + /** + * Set the client name to be sent to the server when connecting. + * + * Only new connections will use the new value. Existing connections + * will be left unchanged. + * + * @param name the name to be send to the server + */ + static void setClientName(const std::string& name); + + /** + * Return the application name sent to the server when connecting + * + * @return the current application name + */ + static const std::string& getApplicationName(); + + /** + * Set the application name to be sent to the server when connecting. + * + * Only new connections will use the new value. Existing connections + * will be left unchanged. + * + * @param name the name to be send to the server + */ + static void setApplicationName(const std::string& name); + + + private: // The logging level static logLevel_t s_logLevel; @@ -122,6 +159,11 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{ static int32_t s_queryTimeout; static int32_t s_heartbeatFrequency; static boost::mutex s_mutex; + + // The client name (default to DRILL_CONNECTOR_NAME) + static std::string s_clientName; + // The application name (default to ) + static std::string s_applicationName; }; -- cgit v1.2.3