- try to fix SQL_CALC_FOUND_ROWS (use transaction)
This commit is contained in:
@@ -183,12 +183,14 @@ func GetStores(keyword string, params map[string]interface{}, offset, pageSize i
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
retVal = &StoresInfo{}
|
||||
db := dao.GetDB()
|
||||
dao.Begin(db)
|
||||
if err = dao.GetRows(db, &retVal.Stores, sql, sqlParams...); err == nil {
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
retVal.TotalCount = countInfo.Ct
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user