added distinct field parameter

This commit is contained in:
Radu Ioan Fericean
2014-02-17 01:09:37 +02:00
parent 4154a3beef
commit dec4ebf2f1
12 changed files with 14 additions and 14 deletions

View File

@@ -85,8 +85,8 @@ func (self *SQLStorage) GetTPIds() ([]string, error) {
return ids, nil
}
func (self *SQLStorage) GetTPTableIds(tpid, table string, filters map[string]string) ([]string, error) {
qry := fmt.Sprintf("SELECT DISTINCT tag FROM %s where tpid='%s'", table, tpid)
func (self *SQLStorage) GetTPTableIds(tpid, table, distinct string, filters map[string]string) ([]string, error) {
qry := fmt.Sprintf("SELECT DISTINCT %s FROM %s where tpid='%s'", distinct, table, tpid)
for key, value := range filters {
if key != "" && value != "" {
qry += fmt.Sprintf(" AND %s='%s'", key, value)
@@ -936,7 +936,7 @@ func (self *SQLStorage) GetTpActions(tpid, tag string) (map[string][]*utils.TPAc
ExpiryTime: expirationDate,
DestinationId: destinations_tag,
RatingSubject: rating_subject,
SharedGroup: shared_group,
SharedGroup: shared_group,
BalanceWeight: balance_weight,
ExtraParameters: extra_parameters,
Weight: weight,