diff options
author | Kim Alvefur <zash@zash.se> | 2013-12-25 15:28:55 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-12-25 15:28:55 +0100 |
commit | 4725039181bd51b83fe84035d36743bdb955c822 (patch) | |
tree | a31ddd00ce08f2d557aef5d5098f55d8f373db6a /plugins | |
parent | 7ca6c7391e4429585879f5c9a8d434e9c23b5f5f (diff) | |
download | prosody-4725039181bd51b83fe84035d36743bdb955c822.tar.gz prosody-4725039181bd51b83fe84035d36743bdb955c822.zip |
mod_storage_sql2: Include user, host and store in id lookup
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql2.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua index e03b1fd6..bec35292 100644 --- a/plugins/mod_storage_sql2.lua +++ b/plugins/mod_storage_sql2.lua @@ -256,14 +256,16 @@ local function archive_where(query, args, where) end end local function archive_where_id_range(query, args, where) + local args_len = #args -- Before or after specific item, exclusive if query.after then -- keys better be unique! - where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? LIMIT 1)" - args[#args+1] = query.after + where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" + args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.after, args[1], args[2], args[3]; + args_len = args_len + 4 end if query.before then - where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? LIMIT 1)" - args[#args+1] = query.before + where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" + args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.before, args[1], args[2], args[3]; end end |