Ejabberd: Database Macros Help required

Created on 16 Aug 2018  路  4Comments  路  Source: processone/ejabberd

What version of ejabberd are you using?

18.06

What operating system (version) are you using?

Ubuntu 16.04

How did you install ejabberd (source, package, distribution)?

Source

What did not work as expected? Are there error messages in the log? What
was the unexpected behavior? What was the expected result?

I need help regarding DB Macros like ?SQL_UPSERT_MARK , ?SQL_INSERT, ?SQL_UPSERT

Can you share me a link of some blog ?

in my custom mule I have to update if id already exist or I have to Insert if does not exist.

Most helpful comment

username and server_host are used inside where clause, while xml is updated, yes. If the row doesn't exist, all columns are inserted.

All 4 comments

Use ?SQL_UPSERT macro: grep sources, there are plenty of examples.

@zinid Thanks for quick reply .. just a small help will play a big role

In following example I am assuming !username and !server_hos fieds to be matched ?? and xml to be inserted or updated ??

?SQL_UPSERT_T(
                             "motd",
                             ["!username=%(U)s",
                              "!server_host=%(LServer)s",
                              "xml=''"])

username and server_host are used inside where clause, while xml is updated, yes. If the row doesn't exist, all columns are inserted.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lgg picture lgg  路  4Comments

Vshnv picture Vshnv  路  4Comments

pacija picture pacija  路  4Comments

kabirhaxor picture kabirhaxor  路  3Comments

cromain picture cromain  路  3Comments