- try to fix SQL_CALC_FOUND_ROWS (use transaction)

This commit is contained in:
gazebo
2018-09-15 23:04:46 +08:00
parent 04e105d8d1
commit a8ae37c641
3 changed files with 5 additions and 5 deletions

View File

@@ -155,6 +155,7 @@ func GetStoreSkus(storeID int, keyword string, params map[string]interface{}, of
sqlParams = append(sqlParams, pageSize, offset)
skuNamesInfo = &StoreSkuNamesInfo{}
// globals.SugarLogger.Debug(sqlData)
dao.Begin(db)
if err = dao.GetRows(db, &skuNamesInfo.SkuNames, sqlData, sqlParams...); err == nil {
countInfo := &struct{ Ct int }{}
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
@@ -168,6 +169,7 @@ func GetStoreSkus(storeID int, keyword string, params map[string]interface{}, of
}
}
}
dao.Commit(db)
return skuNamesInfo, err
}