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 | da4f11269dfc8f0157c94aa9c5f8e3eb2c5bc134 (patch) | |
tree | a31ddd00ce08f2d557aef5d5098f55d8f373db6a /plugins | |
parent | ece61cbae173be6abb4750578252f72c57b8eb8c (diff) | |
download | prosody-da4f11269dfc8f0157c94aa9c5f8e3eb2c5bc134.tar.gz prosody-da4f11269dfc8f0157c94aa9c5f8e3eb2c5bc134.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 |