<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 02/05/16 16:22, gmele wrote:<br>
    </div>
    <blockquote cite="mid:1462198962335-148039.post@n5.nabble.com"
      type="cite">
      <pre wrap="">Hello Daniel,

I'm now investigating the presence notification module problem and the odbc
query:

replace watchers
(presentity_uri,watcher_username,watcher_domain,event,status,inserted_time,reason
) values ('<a class="moz-txt-link-freetext" href="sip:xxx@zzzzzzz','yyyyy','zzzzzzzz,'presence',1,1462197118">sip:xxx@zzzzzzz','yyyyy','zzzzzzzz,'presence',1,1462197118</a>,'');

This query will insert a new row if it doesn't exist and replace it if it
exists in the table.

This requests fails with unixodbc and oracle as it seems it is not
supported. Can you confirm me if the odbc query replace is supported for
oracle? Didn't find anything on the web.</pre>
    </blockquote>
    It is raw query sent to unixodbc, if oracle doesn't support it, then
    it throws error.<br>
    <blockquote cite="mid:1462198962335-148039.post@n5.nabble.com"
      type="cite">
      <pre wrap="">

Is there the possiblity to split this query in 2: first a select, then an
insert or update?

</pre>
    </blockquote>
    Theoretically yes -- db_postgres does this kind of trick: first try
    an update and if affected rows is 0 then it does an insert. However,
    I am not familiar with unixodbc api to know if affected rows number
    is available for oracle.<br>
    <br>
    You will have to write code in c for db_unixodbc, to inspire from
    replace implementation in db_postgres -- I expect to be quite on
    pair with the impelmentation for postgres, the db modules in
    kamailio follow similar pattern with functions.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>