[SOLVED] Re-apply string values substitution

Author: giachino@finaosta.com (Paolo Giachino)

I'm working on Uniface 9.06.04 and I use a database field containing some entity field reference like that "select * from TABLE where string = '%%FIELD.ENTITY'". To apply the string values substitution I use the $syntax proc function and the substitution succeed. I have used with success also the $string proc function. I obtain this right conversion: "select * from TABLE where string = 'value'" Upgrading to the 9.06.07 (using the patch) the $syntax proc function doesn't substitute the entity field reference and I obtain always this: "select * from TABLE where string = '%%FIELD.ENTITY'". I obtain the same result also using the $string proc function Any suggestions? Thanks in advance Paolo Giachino

7 Comments

  1. There's $expression($concat('%%"',<database_field>,'%%"'))   regards,  Iain


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. Paolo Giachino said I'm working on Uniface 9.06.04 and I use a database field containing some entity field reference like that "select * from TABLE where string = '%%FIELD.ENTITY'". To apply the string values substitution I use the $syntax proc function and the substitution succeed. I have used with success also the $string proc function. I obtain this right conversion: "select * from TABLE where string = 'value'" Upgrading to the 9.06.07 (using the patch) the $syntax proc function doesn't substitute the entity field reference and I obtain always this: "select * from TABLE where string = '%%FIELD.ENTITY'". I obtain the same result also using the $string proc function Any suggestions? Thanks in advance Paolo Giachino

    Hi Paolo, Could you please explain in a bit more detail what code you are using here? I would like to understand what you are doing and why version 9.6.07 is behaving differently than 9.6.04. Thank you in advance for your efforts. Kind regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  3. diseli said
    Paolo Giachino said I'm working on Uniface 9.06.04 and I use a database field containing some entity field reference like that "select * from TABLE where string = '%%FIELD.ENTITY'". To apply the string values substitution I use the $syntax proc function and the substitution succeed. I have used with success also the $string proc function. I obtain this right conversion: "select * from TABLE where string = 'value'" Upgrading to the 9.06.07 (using the patch) the $syntax proc function doesn't substitute the entity field reference and I obtain always this: "select * from TABLE where string = '%%FIELD.ENTITY'". I obtain the same result also using the $string proc function Any suggestions? Thanks in advance Paolo Giachino
    Hi Paolo, Could you please explain in a bit more detail what code you are using here? I would like to understand what you are doing and why version 9.6.07 is behaving differently than 9.6.04. Thank you in advance for your efforts. Kind regards, Daniel

    Here is the code entry F_PCONF   variables    string LV_SQL   endvariables   LV_SQL = CONTENTS.MYENTITY   FIELD_STRING.DUMMY = $string(LV_SQL)   FIELD_SYNTAX.DUMMY = $syntax(LV_SQL) end where CONTENTS.MYENTITY is a database field containing "select * from TABLE where string = '%%FIELD.OTHERENTITY' " In 9.06.04, at the end of F_PCONF, FIELD_SYNTAX.DUMMY equals to "select * from TABLE where string = 'StringValue' " where StringValue is the retrieved content of FIELD.OTHERENTITY. The same for FIELD_STRING.DUMMY. This is what I expect to have. In 9.06.07, at the end of F_PCONF, both FIELD_SYNTAX.DUMMY and FIELD_STRING.DUMMY equals to "select * from TABLE where string = '%%FIELD.OTHERENTITY' ", that means no string substitution. Best regards, Paolo


    Author: Paolo Giachino (giachino@finaosta.com)
  4. Try field_expression.dummy = $expression($concat("%%"",lv_sql,"%%""))  or field_expression.dummy = $expression("%%"%%lv_sql%%%%%")


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  5. Paolo Giachino said Here is the code entry F_PCONF   variables    string LV_SQL   endvariables   LV_SQL = CONTENTS.MYENTITY   FIELD_STRING.DUMMY = $string(LV_SQL)   FIELD_SYNTAX.DUMMY = $syntax(LV_SQL) end where CONTENTS.MYENTITY is a database field containing "select * from TABLE where string = '%%FIELD.OTHERENTITY' " In 9.06.04, at the end of F_PCONF, FIELD_SYNTAX.DUMMY equals to "select * from TABLE where string = 'StringValue' " where StringValue is the retrieved content of FIELD.OTHERENTITY. The same for FIELD_STRING.DUMMY. This is what I expect to have. In 9.06.07, at the end of F_PCONF, both FIELD_SYNTAX.DUMMY and FIELD_STRING.DUMMY equals to "select * from TABLE where string = '%%FIELD.OTHERENTITY' ", that means no string substitution. Best regards, Paolo

    Hi Paolo, Thanks for the info. I now can see the behavior as described. And it has changed with version 9.6.06 (patch MX05). I'm not 100% certain yet, but this change could be the result of a vulnerability that we have fixed in the mentioned version/patch. But I also tested this matter with Uniface 8 and 7, and there the behavior is the same as with version 9.6.06 or patch MX05 (and higher). I therefore think that the behavior we can see prior to version 9.6.06 (patch MX05) is not intentional. And I (so far) also could not find any hints in the Uniface Library that the previous version 9 behavior was as documented. Luckily Iain already has provided us with a solution: use $expression() (instead of $syntax() or $string()). Hope this helps. Best regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  6. Hi Daniel I want to inform you that the behavior is not intentional also with vesion 9.2.03.01, because this piece of code is coming from there. Thank you Iain for the suggestion, everything is working now with FIELD_SYNTAX.DUMMY = $expression("%%"%%LV_SQL%%%%%"") Best regards Paolo


    Author: Paolo Giachino (giachino@finaosta.com)
  7. Hi Paolo, Thanks for your feedback. And good to hear that Iain's suggestion is working for you. Best regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)