Software /
code /
prosody
Comparison
plugins/mod_storage_sql2.lua @ 6013:918ab89cb68d
mod_storage_sql2: archive:delete() with username = true deletes for all users
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Feb 2014 15:12:13 +0100 |
parent | 5996:e7efa9703a3f |
child | 6060:de4c83feb064 |
comparison
equal
deleted
inserted
replaced
6012:7e8a624272bf | 6013:918ab89cb68d |
---|---|
323 local user,store = username,self.store; | 323 local user,store = username,self.store; |
324 return engine:transaction(function() | 324 return engine:transaction(function() |
325 local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;"; | 325 local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;"; |
326 local args = { host, user or "", store, }; | 326 local args = { host, user or "", store, }; |
327 local where = { "`host` = ?", "`user` = ?", "`store` = ?", }; | 327 local where = { "`host` = ?", "`user` = ?", "`store` = ?", }; |
328 if user == true then | |
329 table.remove(args, 2); | |
330 table.remove(where, 2); | |
331 end | |
328 archive_where(query, args, where); | 332 archive_where(query, args, where); |
329 archive_where_id_range(query, args, where); | 333 archive_where_id_range(query, args, where); |
330 sql_query = sql_query:format(t_concat(where, " AND ")); | 334 sql_query = sql_query:format(t_concat(where, " AND ")); |
331 module:log("debug", sql_query); | 335 module:log("debug", sql_query); |
332 return engine:delete(sql_query, unpack(args)); | 336 return engine:delete(sql_query, unpack(args)); |