Fork me on GitHub
#sql
<
2017-11-06
>
plins14:11:22

hello everyone its possible with jdbc/insert to call functions like NOW() ?

plins17:11:37

is possible for this to work?

(defn update-campaigns-status [db-spec campaigns]
  (jdbc/update! db-spec
                :tb_campanha_usuario
                {:dataAgendamento (db/now)}
                [“idCampanha in ?” campaigns]))

plins17:11:57

where campaigns is a vector

seancorfield18:11:56

@plins insert! and update! work with Clojure data structures. If you want to use SQL functions, you'll need to use execute!.

seancorfield18:11:42

@plins for your question regarding in, you need to provide enough ? to match your vector: (into [(str "idCampanha in ( " (str/join "," (repeat (count campaigns))) " )"] campaigns) is what you are looking for.

seancorfield18:11:37

so you would construct ["idCampanha in ( ?, ?, ?, ? )" campaign1 campaign2 campaign3 campaign4] (if campaigns had four elements)