Class CommonSettings
java.lang.Object
com.clickhouse.client.api.internal.CommonSettings
Class representing very common logic across all setting objects
like setting database, getting option
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyAndMerge(CommonSettings override) Get all settings as an unmodifiable map.Gets DB roles for an operation.Returns network timeout.Operation id.Gets a configuration option.Gets a configuration option.booleanhttpHeader(String key, String value) Defines list of headers that should be sent with current request.httpHeader(String key, Collection<String> values) but for multiple values.httpHeaders(Map<String, String> headers) but for multiple headers.logComment(String logComment) Sets the comment that will be added to the query log record associated with the query.resetOption(String option) serverSetting(String name, String value) Defines list of server settings that should be sent with each request.serverSetting(String name, Collection<String> values) but for multiple values.setDatabase(String database) Sets database to be used for a request.setDBRoles(Collection<String> dbRoles) Sets DB roles for an operation.voidsetNetworkTimeout(long timeout, ChronoUnit unit) Sets a network operation timeout.setOperationId(String operationId) Operation id.Sets a configuration option.setQueryId(String queryId) Sets the query id.
-
Field Details
-
settings
-
-
Constructor Details
-
CommonSettings
public CommonSettings()
-
-
Method Details
-
getOption
Gets a configuration option.- Parameters:
option- - configuration option name- Returns:
- configuration option value
-
getOption
Gets a configuration option. If not set then defaultValue is returned.- Parameters:
option- - config option keydefaultValue- - default option to return when option is not set- Returns:
- configuration option value
-
hasOption
-
setOption
Sets a configuration option. This method can be used to set any configuration option. There is no specific validation is done on the key or value.- Parameters:
option- - configuration option namevalue- - configuration option value
-
resetOption
-
getAllSettings
Get all settings as an unmodifiable map.- Returns:
- all settings
-
getQueryId
-
setQueryId
Sets the query id. This id will be sent to the server and can be used to identify the query. -
getOperationId
Operation id. Used internally to register new operation. Should not be called directly. -
setOperationId
Operation id. Used internally to register new operation. Should not be called directly.- Parameters:
operationId- - operation id
-
setDatabase
Sets database to be used for a request. -
getDatabase
-
httpHeader
Defines list of headers that should be sent with current request. The Client will use a header value defined inheadersinstead of any other.- Parameters:
key- - header name.value- - header value.- Returns:
- same instance of the builder
- See Also:
-
httpHeader
but for multiple values.- Parameters:
key- - name of the headervalues- - collection of values- Returns:
- same instance of the builder
-
httpHeaders
but for multiple headers.- Parameters:
headers- - map of headers- Returns:
- same instance of the builder
-
serverSetting
Defines list of server settings that should be sent with each request. The Client will use a setting value defined insettingsinstead of any other. Operation settings may override these values.- Parameters:
name- - name of the settingvalue- - value of the setting- Returns:
- same instance of the builder
- See Also:
-
serverSetting
but for multiple values.- Parameters:
name- - name of the setting without special prefixvalues- - collection of values- Returns:
- same instance of the builder
-
setDBRoles
Sets DB roles for an operation. Roles that were set byClient.setDBRoles(Collection)will be overridden.- Parameters:
dbRoles-
-
getDBRoles
Gets DB roles for an operation.- Returns:
- list of DB roles
-
logComment
Sets the comment that will be added to the query log record associated with the query.- Parameters:
logComment- - comment to be added to the log- Returns:
- same instance of the builder
-
getLogComment
-
setNetworkTimeout
Sets a network operation timeout.- Parameters:
timeout-unit-
-
getNetworkTimeout
Returns network timeout. Zero value is returned if no timeout is set.- Returns:
- timeout in ms.
-
copyAndMerge
-