Announcement

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

    Problem with quotes for inset operator

    Hi,

    i have code on server which is adding to the template context some value in a form of string like this: 1,2,3,4
    Code:
    dsRequest.addToTemplateContext(name,value);
    then on DS level i have defined in where clause:
    Code:
                AND  EXISTS ( SELECT 1 FROM TABLE1 cr 
                       				WHERE TABLE2.ID1=cr.ID2 AND
                       				cr.ID3 in ($name)
               			    )
    -----------------------------------------------------------------------------------------
    My problem is that this is not working properly.
    Reason > it is handled either like this>
    Code:
                AND  EXISTS ( SELECT 1 FROM TABLE1 cr 
                       				WHERE TABLE2.ID1=cr.ID2 AND
                       				cr.ID3 in ('1,2,3,4')
               			    )
    or like this (if i add to template context 1','2','3','4)
    Code:
                AND  EXISTS ( SELECT 1 FROM TABLE1 cr 
                       				WHERE TABLE2.ID1=cr.ID2 AND
                       				cr.ID3 in ('1'',''2,'',3'',4')
               			    )
    -----------------------------------------------------------------------------------------
    But actually i need something like this

    Code:
                AND  EXISTS ( SELECT 1 FROM TABLE1 cr 
                       				WHERE TABLE2.ID1=cr.ID2 AND
                       				cr.ID3 in (1,2,3,4)
               			    )
    or like this (if i add to template context 1','2','3','4)
    Code:
                AND  EXISTS ( SELECT 1 FROM TABLE1 cr 
                       				WHERE TABLE2.ID1=cr.ID2 AND
                       				cr.ID3 in ('1','2,',3',4')
               			    )
    ------------------------------------------------------------------------------------------

    Do you have any suggestion for me ?
    Regards,
    Fero

    #2
    Use $rawValue.name to switch off the automatic quoting/escaping. That will be fine in this case because the "name" variable is added on the server. However, exercise great care when using $rawValue with values that have been sent up from a client, for the reasons described here

    Comment

    Working...
    X