Changeset

7847:c430932b8113

mod_storage_sql: Return number of affected items from archive:delete
author Kim Alvefur <zash@zash.se>
date Tue, 22 Nov 2016 18:13:21 +0100
parents 7846:22275bc5744a
children 7848:efe5232793aa
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Sat Nov 19 18:29:08 2016 +0100
+++ b/plugins/mod_storage_sql.lua	Tue Nov 22 18:13:21 2016 +0100
@@ -287,7 +287,7 @@
 function archive_store:delete(username, query)
 	query = query or {};
 	local user,store = username,self.store;
-	return engine:transaction(function()
+	local stmt, err = engine:transaction(function()
 		local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;";
 		local args = { host, user or "", store, };
 		local where = { "`host` = ?", "`user` = ?", "`store` = ?", };
@@ -300,6 +300,7 @@
 		sql_query = sql_query:format(t_concat(where, " AND "));
 		return engine:delete(sql_query, unpack(args));
 	end);
+	return stmt and stmt:affected() or nil, err;
 end
 
 local stores = {