Sql에 물음표 포함되어 있는 경우 pasring 오류

안녕하세요.

  1. SQL에서 URL 치환이 필요하여 다음 코드와 같이 구성하였습니다.
  2. 평상 시 해당 코드는 잘 작동합니다.
  3. 다만 valueFromEnv를 통해서 파라미터를 세팅할 경우 parsing 오류가 발생합니다.
  4. ?%3F로 치환해서 사용할 경우 문제는 해결됩니다.

앞으로도 4번 방법을 통해서 치환하여 사용하는 것이 맞을까요?

전체 코드

pages:
- path: pages/test
  blocks:
  - type: query
    resource: mysql.sample
    sqlType: select
    sql: >
      SELECT 
        b.id,
        CASE
          WHEN b.landingUrl THEN replace(b.landingUrl, 'https://', '')
          ELSE concat('exmaple.com/banner/index.html?bannerId=', b.id)
        END as openUrl,
        b.landingUrl
      FROM banner b
      WHERE b.groupId = :GROUP_ID
    searchOptions:
      enabled: true
    paginationOptions:
      enabled: true
      perPage: 10
    params: 
      - key: GROUP_ID
        valueFromEnv: true

오류 메시지

Server Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1184'bannerId=', b.id)
END as openUrl,
b.landingUrl
FROM banner' at line 5
1개의 좋아요

안녕하세요. 해당 부분 확인해보겠습니다. 문의주셔서 감사합니다!

1개의 좋아요