Software /
code /
prosody
Comparison
plugins/mod_storage_sql2.lua @ 6001:34f43c8167e5
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Jan 2014 03:26:04 +0000 |
parent | 5996:e7efa9703a3f |
child | 6013:918ab89cb68d |
comparison
equal
deleted
inserted
replaced
5994:82555ae620dd | 6001:34f43c8167e5 |
---|---|
220 if value == nil then -- COMPAT early versions | 220 if value == nil then -- COMPAT early versions |
221 when, with, value, key = key, when, with, value | 221 when, with, value, key = key, when, with, value |
222 end | 222 end |
223 local user,store = username,self.store; | 223 local user,store = username,self.store; |
224 return engine:transaction(function() | 224 return engine:transaction(function() |
225 local key = key or uuid.generate(); | 225 if key then |
226 engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, user or "", store, key); | |
227 else | |
228 key = uuid.generate(); | |
229 end | |
226 local t, value = serialize(value); | 230 local t, value = serialize(value); |
227 engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND KEY=?", host, user or "", store, key); | |
228 engine:insert("INSERT INTO `prosodyarchive` (`host`, `user`, `store`, `when`, `with`, `key`, `type`, `value`) VALUES (?,?,?,?,?,?,?,?)", host, user or "", store, when, with, key, t, value); | 231 engine:insert("INSERT INTO `prosodyarchive` (`host`, `user`, `store`, `when`, `with`, `key`, `type`, `value`) VALUES (?,?,?,?,?,?,?,?)", host, user or "", store, when, with, key, t, value); |
229 return key; | 232 return key; |
230 end); | 233 end); |
231 end | 234 end |
232 | 235 |