From 882ebd67773200c4dd9c1e598f1d8d6c16706cc1 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 31 Aug 2011 16:04:20 -0500 Subject: [PATCH] FS-3527 this fixes part of the problem with MSSQL --- src/include/switch_core_db.h | 2 ++ src/mod/endpoints/mod_sofia/sofia_presence.c | 3 ++- src/switch_core_sqldb.c | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index 6ea9b4a3fb..3e92e2bdac 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -540,6 +540,8 @@ SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db); * literal. */ +SWITCH_DECLARE(char*)switch_sql_concat(); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index a85138b8f6..0a63edb690 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -702,7 +702,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "from sip_registrations " "left join sip_dialogs on " - "sip_dialogs.presence_id = sip_registrations.sip_user || '@' || sip_registrations.sip_host " + "sip_dialogs.presence_id = sip_registrations.sip_user %q '@' %q sip_registrations.sip_host " "or (sip_dialogs.sip_from_user = sip_registrations.sip_user " "and sip_dialogs.sip_from_host = sip_registrations.sip_host) " @@ -713,6 +713,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " "or sip_registrations.presence_hosts like '%%%q%%'))", dh.status, dh.rpid, + switch_sql_concat(), switch_sql_concat(), probe_euser, probe_host, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 665b496c01..60e6c4743b 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -2114,6 +2114,14 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream) switch_mutex_unlock(sql_manager.dbh_mutex); } +SWITCH_DECLARE(char*)switch_sql_concat() +{ + if(runtime.odbc_dbtype == DBTYPE_MSSQL) + return "+"; + + return "||"; +} + /* For Emacs: * Local Variables: * mode:c