안녕하세요.
- SQL에서 URL 치환이 필요하여 다음 코드와 같이 구성하였습니다.
- 평상 시 해당 코드는 잘 작동합니다.
- 다만
valueFromEnv
를 통해서 파라미터를 세팅할 경우 parsing 오류가 발생합니다. ?
를%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