Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Criterion OperatorId that generates LIKE and ESCAPE { '\' } only

    I am generating my own simple regexp strings that are compliant with SQL Server expression matching with a LIKE operator. I correctly escape the '_' and '[' and '%' characters when I want them in the string, and do not escape them when I want them to be part of the LIKE expression match. So for instance I will generate the string i\_sys\_clk to match the exact string 'i_sys_clk' .

    The issue I'm having is to find an OperatorId that will allow me to generate a Criterion that will do a simple

    'Table.column LIKE 'my_escaped_string' {ESCAPE }' predicate clause.

    I have tried using CONTAINS and this seems to escape my escapes, I have tried using MATCHES_PATTERN and this also operates on my value string.

    What OperatorId.X do you recommend that will suppress any string manipulations on the provided string, and generate the LIKE and { ESCAPE } clause?

    Apologies in advance if the answer is already on the Forum but any search I did turned up too many irrelevant matches to any question I could think of forming to find a solution.


    #2
    See the Custom Query overview - $rawValue is how you get access to an unescaped value.

    Bear in mind, this removes *all* escaping, so if you need to do some degree of escaping (perhaps to prevent SQL injection attacks), you need to do it yourself. One way to do this would be with a DMI, where you would make the escaped string available to SQL templating via dsRequest.addToTemplateContext().

    See also dataSourceField.customCriteriaExpression - this might apply if what you have is a field that should always use regexp matching when queried.

    Comment

    Working...
    X