- dao.GetLastTotalRowCount

This commit is contained in:
gazebo
2018-12-21 11:07:18 +08:00
parent acb073cb92
commit c7577e6005
5 changed files with 26 additions and 40 deletions

View File

@@ -170,6 +170,7 @@ func ExecuteSQL(db *DaoDB, sql string, params ...interface{}) (num int64, err er
return num, err
}
// 此函数要求db在事务中否则可能导致取得到的是另一个连接的数据
func GetLastTotalRowCount(db *DaoDB) int {
countInfo := &struct{ Ct int }{}
if err := GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {