]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3527 this fixes part of the problem with MSSQL
authorJeff Lenk <jeff@jefflenk.com>
Wed, 31 Aug 2011 21:04:20 +0000 (16:04 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Wed, 31 Aug 2011 21:04:20 +0000 (16:04 -0500)
src/include/switch_core_db.h
src/mod/endpoints/mod_sofia/sofia_presence.c
src/switch_core_sqldb.c

index 6ea9b4a3fb827de9e750d07550a547aa7742c102..3e92e2bdacbc88e79d7d42278ecf0f769fef3dca 100644 (file)
@@ -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:
index a85138b8f63f6fa2aecbf47066341aaa5e82c048..0a63edb690ef75dc8af809f43316cbd15db68875 100644 (file)
@@ -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);
                                
index 665b496c01226289e406c24de576a346c10daa21..60e6c4743bb41b1eaa22aeab337ad6cb8222105e 100644 (file)
@@ -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