diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-14 13:57:52 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-14 13:57:52 +0300 |
commit | e40baf0bdaecf3206420fe8c16c33f2c166cb717 (patch) | |
tree | 75d9fe880e8257ea9fd20c095c252d7940cea89d /src/mod_carboncopy_sql.erl | |
parent | Bump xmpp dependency, it's required by previous commit (diff) |
Use cache in front of Redis/SQL RAM backends
Diffstat (limited to 'src/mod_carboncopy_sql.erl')
-rw-r--r-- | src/mod_carboncopy_sql.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mod_carboncopy_sql.erl b/src/mod_carboncopy_sql.erl index 2770d40a..41d9a063 100644 --- a/src/mod_carboncopy_sql.erl +++ b/src/mod_carboncopy_sql.erl @@ -49,7 +49,7 @@ enable(LUser, LServer, LResource, NS) -> ok; Err -> ?ERROR_MSG("failed to update 'carboncopy' table: ~p", [Err]), - Err + {error, db_failure} end. disable(LUser, LServer, LResource) -> @@ -61,19 +61,20 @@ disable(LUser, LServer, LResource) -> ok; Err -> ?ERROR_MSG("failed to delete from 'carboncopy' table: ~p", [Err]), - Err + {error, db_failure} end. list(LUser, LServer) -> case ejabberd_sql:sql_query( LServer, - ?SQL("select @(resource)s, @(namespace)s from carboncopy " + ?SQL("select @(resource)s, @(namespace)s, @(node)s from carboncopy " "where username=%(LUser)s")) of {selected, Rows} -> - Rows; + {ok, [{Resource, NS, binary_to_atom(Node, latin1)} + || {Resource, NS, Node} <- Rows]}; Err -> ?ERROR_MSG("failed to select from 'carboncopy' table: ~p", [Err]), - [] + {error, db_failure} end. %%%=================================================================== @@ -89,5 +90,5 @@ clean_table(LServer) -> ok; Err -> ?ERROR_MSG("failed to clean 'carboncopy' table: ~p", [Err]), - Err + {error, db_failure} end. |