25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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", "!server_host=%(LServer)s",
"fn=%(FN)s", "fn=%(FN)s",
"lfn=%(LFN)s", "lfn=%(LFN)s",
"family=%(Family)s", "\"family\"=%(Family)s",
"lfamily=%(LFamily)s", "lfamily=%(LFamily)s",
"given=%(Given)s", "given=%(Given)s",
"lgiven=%(LGiven)s", "lgiven=%(LGiven)s",
@ -136,7 +136,7 @@ search(LServer, Data, AllowReturnAll, MaxMatch) ->
end, end,
case catch ejabberd_sql:sql_query( case catch ejabberd_sql:sql_query(
LServer, LServer,
[<<"select username, fn, family, given, " [<<"select username, fn, \"family\", given, "
"middle, nickname, bday, ctry, " "middle, nickname, bday, ctry, "
"locality, email, orgname, orgunit " "locality, email, orgname, orgunit "
"from vcard_search ">>, "from vcard_search ">>,
@ -227,7 +227,7 @@ export(_Server) ->
"server_host=%(LServer)s", "server_host=%(LServer)s",
"fn=%(FN)s", "fn=%(FN)s",
"lfn=%(LFN)s", "lfn=%(LFN)s",
"family=%(Family)s", "\"family\"=%(Family)s",
"lfamily=%(LFamily)s", "lfamily=%(LFamily)s",
"given=%(Given)s", "given=%(Given)s",
"lgiven=%(LGiven)s", "lgiven=%(LGiven)s",