25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Escape 'family' field in SQL requests

This is needed for compatibility with CockroachDB, because
'FAMILY' is a reserved keyword in this database.
This commit is contained in:
Evgeny Khramtsov 2019-10-28 12:19:24 +03:00
parent e2b79ea0b6
commit f51ba687e2

View File

@ -102,7 +102,7 @@ set_vcard(LUser, LServer, VCARD,
"!server_host=%(LServer)s",
"fn=%(FN)s",
"lfn=%(LFN)s",
"family=%(Family)s",
"\"family\"=%(Family)s",
"lfamily=%(LFamily)s",
"given=%(Given)s",
"lgiven=%(LGiven)s",
@ -136,7 +136,7 @@ search(LServer, Data, AllowReturnAll, MaxMatch) ->
end,
case catch ejabberd_sql:sql_query(
LServer,
[<<"select username, fn, family, given, "
[<<"select username, fn, \"family\", given, "
"middle, nickname, bday, ctry, "
"locality, email, orgname, orgunit "
"from vcard_search ">>,
@ -227,7 +227,7 @@ export(_Server) ->
"server_host=%(LServer)s",
"fn=%(FN)s",
"lfn=%(LFN)s",
"family=%(Family)s",
"\"family\"=%(Family)s",
"lfamily=%(LFamily)s",
"given=%(Given)s",
"lgiven=%(LGiven)s",