Closed relbraun closed 11 months ago
Maybe try update some_table set col=%(Val)s where jid=%(LJid)s and username in %(ItemIds)ls
(without embeding that in ())
@prefiks I have just tried it and it doesn't help. The same error.
Do you have -include("ejabberd_sql_pt.hrl"). in that file?
@prefiks Yes.
So for testing i used ejabberd_sql:sql_query(Host, ?SQL("update last set seconds=%(Val)s where username in %(ItemIds)ls")
and it worked when called with [<<"user1">>, <<"user2">>] as itemsids.
Do you get full stacktrace with that error?
@prefiks you were right. There was another problem in my code syntax. Thank you for assistance.
@relbraun what? what's the fix? :shrug:
@licaon-kter the fix is that you have to use this syntax: ejabberd_sql:sql_query(Host, ?SQL("update last set seconds=%(Val)s where username in %(ItemIds)ls")
. And it will work properly .
I have created a module that tries to run this query:
ejabberd_sql:sql_query_t(?SQL("update some_table set col=%(Val)s where jid=%(LJid)s and username in (%(ItemIds)ls)"))
. TheItemIds
variable is a list of binary.I get the following error:
function_clause
.What wrong with that syntax?
Environment
erl +V