db icon indicating copy to clipboard operation
db copied to clipboard

TotalEntries and TotalPages are always 1 with SQLite

Open coolerfall opened this issue 5 years ago • 2 comments

paginator := session.SQL().Select(.....).Where(...).Paginate(10)
err := paginator.Page(uint(page)).All(&books)
if err != nil {
    return 0, nil
}
// the total here is always 1
total, err := paginator.TotalPages()
if err != nil {
    return 0, err
}

but it's correct if with:

paginator := session.Collection("book").Find().Paginate(10)
// the total is correct
total, err := paginator.TotalPages()
if err != nil {
    return 0, err
}

coolerfall avatar Dec 03 '20 02:12 coolerfall

Hello @coolerfall,

I could not replicate this issue, I added an additional test for the paginator here: https://github.com/upper/db/pull/609

Could you provide more data on how to replicate?

xiam avatar Dec 05 '20 16:12 xiam

@xiam I worked with v4.4.0. I select record with SQL() and got 10 records for example, but TotalEntries() give me 1, and TotalPages is 1 too.

coolerfall avatar Dec 07 '20 02:12 coolerfall