Class QueryUtil
java.lang.Object
com.denodo.scheduler.client.commons.utils.QueryUtil
Utility class for parameterized queries
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildFromMap(String element, Map<String, Object> parameters) static StringescapeQueryParam(String query) Escape unsafe characters.static StringescapeQueryParam(String query, String value) static StringRemoves carriage return characters from querystatic StringgetViewNameFromQuery(String query) static StringinterpolateQuery(String query, Map<String, Object> params) Obtains a valid statement filling the parameters with the values supplied.static booleanisNonParameterizedQuery(String query) Returns false if the given query is a parameterized one: 'SELECT f1, f2, f3 FROM v1 WHERE f1=@f1 AND f2=@f2'.static Collection<String>obtainQueryParams(String query) Returns the name of the parameters of a parameterized query of the form: 'SELECT f1, f2, f3 FROM v1 WHERE f1=@f1 AND f2=@f2'.static StringstripSemicolon(String query) static StringunescapeQuery(String query) Unescape unsafe characters.static StringunescapeQueryParam(String query) Unescape unsafe characters.static StringunescapeQueryParam(String query, String value)
-
Method Details
-
fixQuery
Removes carriage return characters from query -
isNonParameterizedQuery
Returns false if the given query is a parameterized one: 'SELECT f1, f2, f3 FROM v1 WHERE f1=@f1 AND f2=@f2'. A variable in a parameterized query must be specified by prefixing it with the symbol '@'. A non parameterized query only could have escaped '@'. -
obtainQueryParams
Returns the name of the parameters of a parameterized query of the form: 'SELECT f1, f2, f3 FROM v1 WHERE f1=@f1 AND f2=@f2'. -
interpolateQuery
Obtains a valid statement filling the parameters with the values supplied.- Parameters:
params- a Map of <String paramName, Object paramValue>
-
unescapeQuery
Unescape unsafe characters. Returns a string with each "\@" sequence replaced with the actual "@".- Parameters:
query-- Returns:
- a string with each "\@" sequence replaced with the actual "@".
-
unescapeQueryParam
Unescape unsafe characters. Returns a string with each "\@" sequence replaced with the actual "@".- Parameters:
query-- Returns:
- a string with each "\@" sequence replaced with the actual "@".
-
unescapeQueryParam
-
escapeQueryParam
Escape unsafe characters. Returns a string with each "=","?" and "&" sequence replaced with "\\=","\\?" and "\\&".- Parameters:
query-- Returns:
- a string with each "=","?" and "&" sequence replaced with "\\=","\\?" and "\\&".
-
escapeQueryParam
-
stripSemicolon
-
buildMap
- Parameters:
query- follow a 'name then equal sign then value then ampersand' convention.- Returns:
- a Map of pairs name of attribute/value. If query is null an empty Map is returned.
-
buildFromMap
- Parameters:
element-parameters- a Map of pairs name of attribute/value.- Returns:
- a query defined as
element[?parameters]and the parameters following the 'name then equal sign then value then ampersand' convention.
-
getViewNameFromQuery
-