mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-19 22:28:45 +05:00
GetStoredCdrs.Count temporary fix until gorm analyses our reported issue
This commit is contained in:
@@ -955,13 +955,18 @@ func (self *SQLStorage) GetStoredCdrs(qryFltr *utils.CdrsFilter) ([]*utils.Store
|
||||
if qryFltr.PaginatorLimit != 0 {
|
||||
q = q.Limit(qryFltr.PaginatorLimit)
|
||||
}
|
||||
/* ToDo: Fix as soon as issue on Gorm analyzed: https://github.com/jinzhu/gorm/issues/354
|
||||
if qryFltr.Count {
|
||||
var cnt int64
|
||||
fmt.Printf("Rows is: %+v\n", rows)
|
||||
//fmt.Printf("Counting, got count: %+v\n", q.Count())
|
||||
if err := q.Count(&cnt).Error; err != nil {
|
||||
fmt.Printf("Counting, got error %s", err.Error())
|
||||
return nil, 0, err
|
||||
}
|
||||
return nil, cnt, nil
|
||||
}
|
||||
*/
|
||||
// Execute query
|
||||
rows, err := q.Rows()
|
||||
if err != nil {
|
||||
@@ -996,6 +1001,9 @@ func (self *SQLStorage) GetStoredCdrs(qryFltr *utils.CdrsFilter) ([]*utils.Store
|
||||
}
|
||||
cdrs = append(cdrs, storCdr)
|
||||
}
|
||||
if qryFltr.Count { // Emulate Count for now
|
||||
return nil, int64(len(cdrs)), nil
|
||||
}
|
||||
return cdrs, 0, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user