diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2015-03-23 12:10:27 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2015-03-23 12:10:27 +0000 |
commit | 7c0d021b018b4e8022b4c6343f69e91690e7f0f8 (patch) | |
tree | 1112cf91f6bef0dd5cda0507e9ff78ccd043b96c | |
parent | f1d71d74eb66dc441a8cd8559de9e0454ffb6175 (diff) | |
download | aports-turbo-7c0d021b018b4e8022b4c6343f69e91690e7f0f8.tar.bz2 aports-turbo-7c0d021b018b4e8022b4c6343f69e91690e7f0f8.tar.xz |
fix offset
-rwxr-xr-x | aports.lua | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -104,7 +104,8 @@ function QueryContents(filename, pkgname, arch, page) local offset = (tonumber(page) == nil) and 0 or tonumber(page)*50 local dbh = assert(DBI.Connect('SQLite3', 'db/filelist.db')) local sth = assert(dbh:prepare('select * from filelist where file like ? and pkgname like ? and arch like ? limit ?,50')) - sth:execute(filename, pkgname, arch, offset) + sth:execute(filename, pkgname, arch, (page - 1) * 50) + print((page - 1) * 50) local r = {} for row in sth:rows(true) do r[#r + 1] = { @@ -126,7 +127,7 @@ function QueryPackages(package, arch, page) local sth = assert(dbh:prepare('select name, version, url, lic, desc, arch, repo, maintainer, datetime(build_time, \'unixepoch\') as build_time from apkindex where name like ? and arch like ? ORDER BY build_time DESC limit ?,50')) local offset = (tonumber(page) == nil) and 0 or tonumber(page)*50 local offset = (page - 1) * 50 - sth:execute(package, arch, offset) + sth:execute(package, arch, (page - 1) * 50) local r = {} for row in sth:rows(true) do r[#r+1] = { |