do-commands is intended for DDL, not SQL.

You just want do-prepared:

(sql/with-connection (db-connection)
         (sql/do-prepared (str "update TASK_T_MSGIDS set status='T' where
msg_id in (" (apply str (interpose \, acks)) " )" ))
       )


On Wed, Dec 5, 2012 at 1:13 AM, Amir Wasim <amir.wa...@gmail.com> wrote:

> aha, thanks Sean
>
> I tried alternate and did the following
>
> => (sql/with-connection (db-connection)
>          (sql/do-commands (str "update TASK_T_MSGIDS set status='T' where
> msg_id in (" (apply str (interpose \, acks)) " )" ))
>        )
>
> => (sql/with-connection (db-connection)
>          (transaction (sql/do-commands (str "update TASK_T_MSGIDS set
> status='T' where msg_id in (" (apply str (interpose \, acks)) " )" )))
>        )
> ==>  (sql/with-connection (db-connection)
>   (with-open [^Statement stmt (let [^java.sql.Connection con
> (sql/connection)] (.createStatement con))]
>       (.addBatch stmt (str "update TASK_T_MSGIDS set status='E' where
> msg_id in (" (apply str (interpose \, acks)) " )" ))
>           (sql/transaction (.executeBatch stmt))))
>
> and none of them worked. with exception of do-commands which halts the jvm
> but there is no error on terminal.
>
> Do you know a way to raw update statement with "in" within Where clause...
>
>
> On Wednesday, December 5, 2012 4:53:39 AM UTC+1, Sean Corfield wrote:
>
>> ... in ? is not supported in c.j.jdbc
>>
>>
>> On Tue, Dec 4, 2012 at 6:16 AM, Amir Wasim <amir....@gmail.com> wrote:
>>
>>> I am trying to use the following
>>>
>>> (defn commit-acknowledged
>>>   [acks]
>>>   (sql/with-connection (db-connection)
>>>     (sql/transaction
>>>       (sql/update-values "MSGIDS" ["msg_id in ?" acks] {"status" "H"})
>>>       )
>>>     )
>>> )
>>>
>>> here acks is type of clojure.lang.PersistentVector when i call this
>>> function i am getting java.sql.SQLException: Invalid column type
>>>
>>>
>>> does anyone know why i am getting this?
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>>
>>
>>
>>
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to