You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CQL Interpolation supports interpolating Scala constants (ie. final vals) by injecting values in place. Depending on the injection position, these values need to be quoted:
finalvaltableName="table"finalvalqueryParam="some_string"defquery(param: String) =cql"SELECT * FROM \"${table}\" WHERE some_column = '${queryParam}' AND other_column = $param"
Since table is a reserved word we need to quote it with double quotes, and since queryParam will be injected we need single quotes (it's on query parameter position). On the other hand param will be replaced with a named bind parameter. The prepared query will be:
Users shouldn't need care about quoting injected values, Helenus should be able to decide when and how to quote injected values, so we end up with Scala code like:
defquery(param: String) =cql"SELECT * FROM ${table} WHERE some_column = ${queryParam} AND other_column = $param"
Which provides the same valid CQL output
The text was updated successfully, but these errors were encountered:
Problem
CQL Interpolation supports interpolating Scala constants (ie.
final val
s) by injecting values in place. Depending on the injection position, these values need to be quoted:Since
table
is a reserved word we need to quote it with double quotes, and sincequeryParam
will be injected we need single quotes (it's on query parameter position). On the other handparam
will be replaced with a named bind parameter. The prepared query will be:Desired Solution
Users shouldn't need care about quoting injected values, Helenus should be able to decide when and how to quote injected values, so we end up with Scala code like:
Which provides the same valid CQL output
The text was updated successfully, but these errors were encountered: