Comparison

plugins/mod_storage_sql.lua @ 8031:ef838b7f8f53

mod_storage_sql: Sensible defaults for 'when' and 'with' arguments
author Kim Alvefur <zash@zash.se>
date Sat, 01 Apr 2017 19:04:54 +0200
parent 8029:e859f279add4
child 8032:aa9f198cb3c9
comparison
equal deleted inserted replaced
8030:bd3527198308 8031:ef838b7f8f53
182 total = true; 182 total = true;
183 }; 183 };
184 archive_store.__index = archive_store 184 archive_store.__index = archive_store
185 function archive_store:append(username, key, value, when, with) 185 function archive_store:append(username, key, value, when, with)
186 local user,store = username,self.store; 186 local user,store = username,self.store;
187 when = when or os.time();
188 with = with or "";
187 local ok, key = engine:transaction(function() 189 local ok, key = engine:transaction(function()
188 if key then 190 if key then
189 engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, user or "", store, key); 191 engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, user or "", store, key);
190 else 192 else
191 key = uuid.generate(); 193 key = uuid.generate();