Comparison

plugins/mod_storage_sql2.lua @ 5979:4c41404d9eec

mod_storage_sql2: Fix syntax error in subquery (Thanks Lance)
author Kim Alvefur <zash@zash.se>
date Sun, 05 Jan 2014 23:38:34 +0100
parent 5969:0a3b8003ac9c
child 5985:98ed9fe368ac
comparison
equal deleted inserted replaced
5972:f365d3c8fd2c 5979:4c41404d9eec
261 end 261 end
262 local function archive_where_id_range(query, args, where) 262 local function archive_where_id_range(query, args, where)
263 local args_len = #args 263 local args_len = #args
264 -- Before or after specific item, exclusive 264 -- Before or after specific item, exclusive
265 if query.after then -- keys better be unique! 265 if query.after then -- keys better be unique!
266 where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" 266 where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?` AND user` = ?` AND store` = ? LIMIT 1)"
267 args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.after, args[1], args[2], args[3]; 267 args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.after, args[1], args[2], args[3];
268 args_len = args_len + 4 268 args_len = args_len + 4
269 end 269 end
270 if query.before then 270 if query.before then
271 where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)" 271 where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?` AND user` = ?` AND store` = ? LIMIT 1)"
272 args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.before, args[1], args[2], args[3]; 272 args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.before, args[1], args[2], args[3];
273 end 273 end
274 end 274 end
275 275
276 function archive_store:find(username, query) 276 function archive_store:find(username, query)