Package com.clickhouse.client
Class ClickHouseParameterizedQuery
java.lang.Object
com.clickhouse.client.ClickHouseParameterizedQuery
- All Implemented Interfaces:
Serializable
Deprecated.
A parameterized query is a parsed query with parameters being extracted for
substitution.
Here parameter is define in the format of :<name>[(<type>)]. It
starts with colon, immediately followed by name, and then optionally type
within brackets. For example: in query "select :no as no, :name(String) as
name", we have two parameters: no and name. Moreover, type of
the last parameter is String.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDeprecated.A part of query. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClickHouseConfigDeprecated.protected final StringDeprecated. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseParameterizedQuery(ClickHouseConfig config, String query) Deprecated.Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDeprecated.Adds part of query and the following parameter.protected voidDeprecated.Adds part of query and the following parameter.protected StringBuilderappendLastPartIfExists(StringBuilder builder) Deprecated.Appends last part of the query if it exists.voidapply(StringBuilder builder, Object[] values) Deprecated.Applies raw parameters to the given string builder.voidapply(StringBuilder builder, Object param, Object... more) Deprecated.Applies raw parameters to the given string builder.voidapply(StringBuilder builder, String[] values) Deprecated.Applies stringified parameters to the given string builder.voidapply(StringBuilder builder, String param, String... more) Deprecated.Applies stringified parameters to the given string builder.static voidDeprecated.Substitute named parameters in given SQL.voidapply(StringBuilder builder, Collection<String> params) Deprecated.Applies stringified parameters to the given string builder.voidapply(StringBuilder builder, Map<String, String> params) Deprecated.Applies stringified parameters to the given string builder.static StringDeprecated.Substitute named parameters in given SQL.booleanDeprecated.Deprecated.Gets original query.Deprecated.Gets named parameters.Deprecated.Gets parameter templates for converting value to SQL expression.protected List<ClickHouseParameterizedQuery.QueryPart>getParts()Deprecated.Gets immutable list of query parts.Deprecated.Gets query parts.inthashCode()Deprecated.booleanDeprecated.Checks if the query has at least one parameter or not.static ClickHouseParameterizedQueryof(ClickHouseConfig config, String query) Deprecated.Creates an instance by parsing the given query.protected Stringparse()Deprecated.Parses the query given in constructor.protected StringtoSqlExpression(String paramName, Object value) Deprecated.Converts given raw value to SQL expression.
-
Field Details
-
config
Deprecated. -
originalQuery
Deprecated.
-
-
Constructor Details
-
ClickHouseParameterizedQuery
Deprecated.Default constructor.- Parameters:
config- non-null configquery- non-blank query
-
-
Method Details
-
apply
Deprecated.Substitute named parameters in given SQL.- Parameters:
sql- SQL containing named parametersparams- mapping between parameter name and correspoding SQL expression(NOT raw value)- Returns:
- substituted SQL, or the given sql if one of
sqlandparamsis null or empty
-
apply
Deprecated.Substitute named parameters in given SQL.- Parameters:
builder- non-null string buildersql- SQL containing named parametersparams- mapping between parameter name and correspoding SQL expression(NOT raw value)
-
of
Deprecated.Creates an instance by parsing the given query.- Parameters:
config- non-null configquery- non-empty SQL query- Returns:
- parameterized query
-
addPart
Deprecated.Adds part of query and the following parameter.- Parameters:
part- part of the query, between previous and current parameterparamIndex- zero-based index of the parameterparamType- type of the parameter, could be null
-
addPart
Deprecated.Adds part of query and the following parameter.- Parameters:
part- part of the query, between previous and current parameterparamIndex- zero-based index of the parameterparamName- name of the parameter, null meansString.valueOf(paramIndex)paramType- type of the parameter, could be null
-
getParts
Deprecated.Gets immutable list of query parts.- Returns:
- immutable list of query parts
-
parse
Deprecated.Parses the query given in constructor.- Returns:
- remaining part(right after the last parameter) after parsing, could be null
-
appendLastPartIfExists
Deprecated.Appends last part of the query if it exists.- Parameters:
builder- non-null string builder- Returns:
- the builder
-
toSqlExpression
Deprecated.Converts given raw value to SQL expression.- Parameters:
paramName- name of the parametervalue- raw value, could be null- Returns:
- non-null SQL expression
-
apply
Deprecated.Applies stringified parameters to the given string builder.- Parameters:
builder- non-null string builderparams- stringified parameters
-
apply
Deprecated.Applies stringified parameters to the given string builder.- Parameters:
builder- non-null string builderparams- stringified parameters
-
apply
Deprecated.Applies raw parameters to the given string builder.ClickHouseValues.convertToSqlExpression(Object)will be used to stringify the parameters.- Parameters:
builder- non-null string builderparam- raw parametermore- more raw parameters if any
-
apply
Deprecated.Applies raw parameters to the given string builder.ClickHouseValues.convertToSqlExpression(Object)will be used to stringify the parameters.- Parameters:
builder- non-null string buildervalues- raw parameters
-
apply
Deprecated.Applies stringified parameters to the given string builder.- Parameters:
builder- non-null string builderparam- stringified parametermore- more stringified parameters if any
-
apply
Deprecated.Applies stringified parameters to the given string builder.- Parameters:
builder- non-null string buildervalues- stringified parameters
-
getParameters
Deprecated.Gets named parameters.- Returns:
- list of named parameters
-
getOriginalQuery
Deprecated.Gets original query.- Returns:
- original query
-
getQueryParts
Deprecated.Gets query parts. Each part is composed of a snippet taken fromgetOriginalQuery(), followed by a parameter name, which might be null.- Returns:
- query parts
-
getParameterTemplates
Deprecated.Gets parameter templates for converting value to SQL expression.- Returns:
- parameter templates
-
hasParameter
public boolean hasParameter()Deprecated.Checks if the query has at least one parameter or not.- Returns:
- true if there's at least one parameter; false otherwise
-
hashCode
public int hashCode()Deprecated. -
equals
Deprecated.
-