mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Move SQL queries from vcard_odbc to odbc_queries.
This commit is contained in:
parent
fd990cf4d8
commit
b85b63018d
@ -474,12 +474,7 @@ search(LServer, Data) ->
|
|||||||
[{matches, Val}, ?JUD_MATCHES]),
|
[{matches, Val}, ?JUD_MATCHES]),
|
||||||
[" LIMIT ", integer_to_list(?JUD_MATCHES)]
|
[" LIMIT ", integer_to_list(?JUD_MATCHES)]
|
||||||
end,
|
end,
|
||||||
case catch ejabberd_odbc:sql_query(
|
case catch odbc_queries:search_vcard(LServer, MatchSpec, Limit) of
|
||||||
LServer,
|
|
||||||
["select username, fn, family, given, middle, "
|
|
||||||
" nickname, bday, ctry, locality, "
|
|
||||||
" email, orgname, orgunit from vcard_search ",
|
|
||||||
MatchSpec, Limit, ";"]) of
|
|
||||||
{selected, ["username", "fn", "family", "given", "middle",
|
{selected, ["username", "fn", "family", "given", "middle",
|
||||||
"nickname", "bday", "ctry", "locality",
|
"nickname", "bday", "ctry", "locality",
|
||||||
"email", "orgname", "orgunit"],
|
"email", "orgname", "orgunit"],
|
||||||
@ -620,7 +615,4 @@ remove_user(User, Server) when is_binary(User), is_binary(Server) ->
|
|||||||
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
|
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
|
||||||
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
|
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
|
||||||
Username = ejabberd_odbc:escape(LUser),
|
Username = ejabberd_odbc:escape(LUser),
|
||||||
ejabberd_odbc:sql_transaction(
|
odbc_queries:del_vcard(LServer, Username).
|
||||||
LServer,
|
|
||||||
[["delete from vcard where username='", Username, "';"],
|
|
||||||
["delete from vcard_search where lusername='", Username, "';"]]).
|
|
||||||
|
@ -77,6 +77,8 @@
|
|||||||
del_privacy_lists/3,
|
del_privacy_lists/3,
|
||||||
set_vcard/26,
|
set_vcard/26,
|
||||||
get_vcard/2,
|
get_vcard/2,
|
||||||
|
del_vcard/2,
|
||||||
|
search_vcard/3,
|
||||||
escape/1,
|
escape/1,
|
||||||
count_records_where/3,
|
count_records_where/3,
|
||||||
get_roster_version/2,
|
get_roster_version/2,
|
||||||
@ -436,6 +438,21 @@ get_vcard(LServer, Username) ->
|
|||||||
["select vcard from vcard "
|
["select vcard from vcard "
|
||||||
"where username='", Username, "';"]).
|
"where username='", Username, "';"]).
|
||||||
|
|
||||||
|
del_vcard(LServer, Username) ->
|
||||||
|
ejabberd_odbc:sql_transaction(
|
||||||
|
LServer,
|
||||||
|
[["delete from vcard where username='", Username, "';"],
|
||||||
|
["delete from vcard_search where lusername='", Username, "';"]]).
|
||||||
|
|
||||||
|
search_vcard(LServer, MatchSpec, Limit) ->
|
||||||
|
ejabberd_odbc:sql_query(
|
||||||
|
LServer,
|
||||||
|
["select username, fn, family, given, middle, "
|
||||||
|
" nickname, bday, ctry, locality, "
|
||||||
|
" email, orgname, orgunit from vcard_search ",
|
||||||
|
MatchSpec, Limit, ";"]).
|
||||||
|
|
||||||
|
|
||||||
get_default_privacy_list(LServer, Username) ->
|
get_default_privacy_list(LServer, Username) ->
|
||||||
ejabberd_odbc:sql_query(
|
ejabberd_odbc:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
|
Loading…
Reference in New Issue
Block a user