Comparison

plugins/mod_storage_sql2.lua @ 5985:98ed9fe368ac

mod_storage_sql2: Fix SQL syntax
author Kim Alvefur <zash@zash.se>
date Sat, 18 Jan 2014 19:33:33 +0100
parent 5979:4c41404d9eec
child 5995:aa7534a877fe
comparison
equal deleted inserted replaced
5984:c68e2b11d691 5985:98ed9fe368ac
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)