summaryrefslogtreecommitdiff
path: root/src/odbc/odbc_queries.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2011-04-14 23:11:37 +0200
committerBadlop <badlop@process-one.net>2011-04-14 23:11:37 +0200
commit4f1ececbd17cdc6ff19a42d5c7cacb32744800c7 (patch)
tree64565ea53074e8d481a0cace8c9877e7426b36f8 /src/odbc/odbc_queries.erl
parentThe responses to HEAD must have empty Body (diff)
Try to improve support for roster_version in MSSQL (EJAB-1437)
Diffstat (limited to '')
-rw-r--r--src/odbc/odbc_queries.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/odbc/odbc_queries.erl b/src/odbc/odbc_queries.erl
index 3e3a2942..b614fd79 100644
--- a/src/odbc/odbc_queries.erl
+++ b/src/odbc/odbc_queries.erl
@@ -90,6 +90,8 @@
-define(generic, true).
-endif.
+-include("ejabberd.hrl").
+
%% Almost a copy of string:join/2.
%% We use this version because string:join/2 is relatively
%% new function (introduced in R12B-0).
@@ -882,8 +884,14 @@ count_records_where(LServer, Table, WhereClause) ->
["select count(*) from ", Table, " with (nolock) ", WhereClause]).
get_roster_version(LServer, LUser) ->
- ejabberd_odbc:sql_query(LServer,
- ["select version from dbo.roster_version with (nolock) where username = '", LUser, "'"]).
-set_roster_version(LUser, Version) ->
- update_t("dbo.roster_version", ["username", "version"], [LUser, Version], ["username = '", LUser, "'"]).
+ ejabberd_odbc:sql_query(
+ LServer,
+ ["EXECUTE dbo.get_roster_version '", LUser, "'"]).
+
+set_roster_version(Username, Version) ->
+ %% This function doesn't know the vhost, so we hope it's the first one defined:
+ LServer = ?MYNAME,
+ ejabberd_odbc:sql_query(
+ LServer,
+ ["EXECUTE dbo.set_roster_version '", Username, "', '", Version, "'"]).
-endif.