2012-12-17 4 views

답변

2

AFAIR을 직접 입력 할 수 없습니다. 장면 매크로 뒤에서 with-query-results은 java.sql.PreparedStatement를 사용하고 각 매개 변수에 대해 .setObject를 호출합니다. 그래서 당신은 매개 변수 "에"와 이미 준비된 SQL 문자열을 생성하기 위해이

(sql/with-connection db 
    (sql/with-query-results rs 
    [(str "select * from users where email in (" 
      (apply 
      str 
      (interpose ", " (map #(str "\"" % "\"") 
           ["[email protected]" "[email protected]"]))) ")")] 
    ...)) 

같은 것을 작성해야 : "select * from users where email in (\"[email protected]\", \"[email protected]\")"은.

더 나은 방법은 sqlkorma와 같은 clojure sql 라이브러리 중 하나를 사용하는 것입니다.

+3

이것은 SQL 삽입 – Ankur

+0

으로 이어질 수 있습니다. 완전한 솔루션이 아니며 기존 라이브러리로 개선하거나 대체해야합니다. – mobyte

관련 문제