Comparison

plugins/mod_storage_sql.lua @ 7857:db48b1697234

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 23 Jan 2017 19:34:14 +0100
parent 7758:2b305ec8c146
parent 7847:c430932b8113
child 7859:9eb13c14eaab
comparison
equal deleted inserted replaced
7822:4caaa0c185f1 7857:db48b1697234
285 end 285 end
286 286
287 function archive_store:delete(username, query) 287 function archive_store:delete(username, query)
288 query = query or {}; 288 query = query or {};
289 local user,store = username,self.store; 289 local user,store = username,self.store;
290 return engine:transaction(function() 290 local stmt, err = engine:transaction(function()
291 local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;"; 291 local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;";
292 local args = { host, user or "", store, }; 292 local args = { host, user or "", store, };
293 local where = { "`host` = ?", "`user` = ?", "`store` = ?", }; 293 local where = { "`host` = ?", "`user` = ?", "`store` = ?", };
294 if user == true then 294 if user == true then
295 table.remove(args, 2); 295 table.remove(args, 2);
298 archive_where(query, args, where); 298 archive_where(query, args, where);
299 archive_where_id_range(query, args, where); 299 archive_where_id_range(query, args, where);
300 sql_query = sql_query:format(t_concat(where, " AND ")); 300 sql_query = sql_query:format(t_concat(where, " AND "));
301 return engine:delete(sql_query, unpack(args)); 301 return engine:delete(sql_query, unpack(args));
302 end); 302 end);
303 return stmt and stmt:affected() or nil, err;
303 end 304 end
304 305
305 local stores = { 306 local stores = {
306 keyval = keyval_store; 307 keyval = keyval_store;
307 map = map_store; 308 map = map_store;