[SR-Users] Kamailio and Oracle database

Daniel-Constantin Mierla miconda at gmail.com
Tue May 3 08:22:35 CEST 2016


Hello,


On 02/05/16 16:22, gmele wrote:
> 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 ('sip:xxx at zzzzzzz','yyyyy','zzzzzzzz,'presence',1,1462197118,'');
>
> 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.
It is raw query sent to unixodbc, if oracle doesn't support it, then it
throws error.
>
> Is there the possiblity to split this query in 2: first a select, then an
> insert or update?
>
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.

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.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160503/1325d529/attachment.html>


More information about the sr-users mailing list