Comparison

plugins/mod_storage_sql.lua @ 10032:de5ab807e438

mod_storage_sql: Fix to use correct arguments to archive id lookup
author Kim Alvefur <zash@zash.se>
date Tue, 28 May 2019 00:47:50 +0200
parent 10031:17c175ad65f9
child 10033:ca8333d1a7fe
comparison
equal deleted inserted replaced
10031:17c175ad65f9 10032:de5ab807e438
334 WHERE "key" = ? AND "host" = ? AND "user" = ? AND "store" = ? 334 WHERE "key" = ? AND "host" = ? AND "user" = ? AND "store" = ?
335 LIMIT 1; 335 LIMIT 1;
336 ]]; 336 ]];
337 if query.after then -- keys better be unique! 337 if query.after then -- keys better be unique!
338 local after_id = nil; 338 local after_id = nil;
339 for row in engine:select(id_lookup_sql, query.after, host, user or "", store) do 339 for row in engine:select(id_lookup_sql, query.after, args[1], args[2], args[3]) do
340 after_id = row[1]; 340 after_id = row[1];
341 end 341 end
342 if not after_id then 342 if not after_id then
343 return nil, "item-not-found"; 343 return nil, "item-not-found";
344 end 344 end
345 where[#where+1] = '"sort_id" > ?'; 345 where[#where+1] = '"sort_id" > ?';
346 args[#args+1] = after_id; 346 args[#args+1] = after_id;
347 end 347 end
348 if query.before then 348 if query.before then
349 local before_id = nil; 349 local before_id = nil;
350 for row in engine:select(id_lookup_sql, query.after, host, user or "", store) do 350 for row in engine:select(id_lookup_sql, query.after, args[1], args[2], args[3]) do
351 before_id = row[1]; 351 before_id = row[1];
352 end 352 end
353 if not before_id then 353 if not before_id then
354 return nil, "item-not-found"; 354 return nil, "item-not-found";
355 end 355 end