-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
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:
final val tableName = "table"
final val queryParam = "some_string"
def query(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:
SELECT * FROM "table" WHERE some_column = 'some_string' AND other_column = ?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:
def query(param: String) =
cql"SELECT * FROM ${table} WHERE some_column = ${queryParam} AND other_column = $param"Which provides the same valid CQL output
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request