Re: NiFi QueryRecord Escape Single Quote in string

2021-05-06 Thread Josef.Zahner1
Sorry I had another issue that caused my test to fail. I can confirm that 
double quoting (two single quotes) work to get a single quote.

Cheers


From: "Zahner Josef, GSB-LR-TRW-LI" 
Date: Thursday, 6 May 2021 at 09:40
To: "users@nifi.apache.org" 
Subject: NiFi QueryRecord Escape Single Quote in string

Hi guys

We would like to insert a string as a column with the QueryRecord which 
includes a single quote, please check my example below.

SELECT 'Can't create a text with single quote' AS message
FROM FLOWFILE

The yellow marked single quote generates a syntax error and I don’t know how to 
fix it. Surrounding double quotes doesn’t seem to work as in regular SQL. I 
tried the following with no luck:

  *   \\’
  *   \’
  *   ‘’ (Double up the single quote)

Any help would be appreciated.

Cheers Josef




smime.p7s
Description: S/MIME Cryptographic Signature


NiFi QueryRecord Escape Single Quote in string

2021-05-06 Thread Josef.Zahner1
Hi guys

We would like to insert a string as a column with the QueryRecord which 
includes a single quote, please check my example below.

SELECT 'Can't create a text with single quote' AS message
FROM FLOWFILE

The yellow marked single quote generates a syntax error and I don’t know how to 
fix it. Surrounding double quotes doesn’t seem to work as in regular SQL. I 
tried the following with no luck:

  *   \\’
  *   \’
  *   ‘’ (Double up the single quote)

Any help would be appreciated.

Cheers Josef




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Escape Single Quote

2018-04-05 Thread Noe Detore
that was it. Thank you

On Thu, Apr 5, 2018 at 11:12 AM, James Wing <jvw...@gmail.com> wrote:

> I believe you need something like
>
> ${my_forcast:replace("'","\\'")}
>
> Using two backslashes \\.  The backslash is also used as an escape
> character in the expression language string, so you need two consecutive
> backslashes to make one literal backslash in the output.
>
> On Thu, Apr 5, 2018 at 7:31 AM, Noe Detore <ndet...@minerkasch.com> wrote:
>
>> Need to escape single quote for PutSql.  'Today's forecast ...' by a
>> backslash: 'Today\'s forecast ...', How can this be done using ReplaceText?
>> ${my_forcast:replace("'","\'")} does not work.
>>
>
>


Re: Escape Single Quote

2018-04-05 Thread James Wing
I believe you need something like

${my_forcast:replace("'","\\'")}

Using two backslashes \\.  The backslash is also used as an escape
character in the expression language string, so you need two consecutive
backslashes to make one literal backslash in the output.

On Thu, Apr 5, 2018 at 7:31 AM, Noe Detore <ndet...@minerkasch.com> wrote:

> Need to escape single quote for PutSql.  'Today's forecast ...' by a
> backslash: 'Today\'s forecast ...', How can this be done using ReplaceText?
> ${my_forcast:replace("'","\'")} does not work.
>


Escape Single Quote

2018-04-05 Thread Noe Detore
Need to escape single quote for PutSql.  'Today's forecast ...' by a
backslash: 'Today\'s forecast ...', How can this be done using ReplaceText?
${my_forcast:replace("'","\'")} does not work.