# HG changeset patch # User Kim Alvefur # Date 1388961514 -3600 # Node ID 4c41404d9eec0f89cd00daab5b54e40c45508f36 # Parent f365d3c8fd2c92e5df5a7a6135a5914ec24eab34 mod_storage_sql2: Fix syntax error in subquery (Thanks Lance) diff -r f365d3c8fd2c -r 4c41404d9eec plugins/mod_storage_sql2.lua --- a/plugins/mod_storage_sql2.lua Mon Dec 30 23:49:23 2013 +0100 +++ b/plugins/mod_storage_sql2.lua Sun Jan 05 23:38:34 2014 +0100 @@ -263,12 +263,12 @@ 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` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" + 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` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" + 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