Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: latest PDI version still not escaping single quote (') in Execute SQL Statement

  1. #1
    Join Date
    Sep 2014
    Posts
    175

    Default latest PDI version still not escaping single quote (') in Execute SQL Statement

    I mentioned this a few times before, but yes can be quite annoying.

    I'm essentially using previous_result.getLogText() or what have you, and writing that text to a SQL database.

    Sometimes that Log Text will include a single quote like "We didn't receive any rows" (note word didn't with apostrophe).


    This breaks the SQL script if you are writing something like:

    Insert into mytable (log_text) values ${LOG_TEXT}.

    I believe bind parameters only works with fields, not environmental variables, -- though hmm maybe I can convert the variables to fields first.

  2. #2
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    It has been clearly documented and explained more than a few times that variables are not, and are not expected to be, escaped.

    Convert the variable to a field, and then it should work. And yes, this is easy to do. I also wouldn't use Execute SQL statement for that... Use the Table Output step.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.