diff options
Diffstat (limited to 'rddb')
-rw-r--r-- | rddb/rddb.go | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/rddb/rddb.go b/rddb/rddb.go index b963972..2a1c743 100644 --- a/rddb/rddb.go +++ b/rddb/rddb.go @@ -314,10 +314,9 @@ type getShowCartListRequest struct { } type JingleListEntry struct { - Group string - Title string - ActiveCart int - InactiveCart int + Group string + Title string + Cart int } type JingleList []JingleListEntry @@ -347,9 +346,8 @@ type getJingleListRequest struct { } type getJingleCutListResult struct { - active CartListEntry - inactive CartListEntry - err error + cart CartListEntry + err error } type getJingleCutListRequest struct { @@ -488,7 +486,7 @@ func (d *db) init() (err error) { if d.getCutInfoStmt, err = d.dbh.Prepare("select CUT_NAME,EVERGREEN,DESCRIPTION,LENGTH,ORIGIN_DATETIME,PLAY_COUNTER,LAST_PLAY_DATETIME from CUTS where CART_NUMBER = ?"); err != nil { return } - if d.getJingleListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { + if d.getJingleListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { return } if d.getPoolListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,DROPBOXES.PATH,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { @@ -746,7 +744,7 @@ func (d *db) getJingleList(username string) (result getJingleListResult) { var jingle JingleListEntry var params string - if result.err = rows.Scan(&jingle.Group, ¶ms, &jingle.ActiveCart, &jingle.InactiveCart, &jingle.Title); result.err != nil { + if result.err = rows.Scan(&jingle.Group, ¶ms, &jingle.Cart, &jingle.Title); result.err != nil { return } if params[0] != 'J' { @@ -759,10 +757,7 @@ func (d *db) getJingleList(username string) (result getJingleListResult) { } func (d *db) getJingleCutList(jingle JingleListEntry) (result getJingleCutListResult) { - if result.active, result.err = d.getCartInfo(uint(jingle.ActiveCart)); result.err != nil { - return - } - if result.inactive, result.err = d.getCartInfo(uint(jingle.InactiveCart)); result.err != nil { + if result.cart, result.err = d.getCartInfo(uint(jingle.Cart)); result.err != nil { return } return @@ -1065,7 +1060,7 @@ func (d *DB) GetJingleList(username string) (JingleList, error) { return res.jingles, nil } -func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, CartListEntry, error) { +func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, error) { resCh := make(chan getJingleCutListResult) req := getJingleCutListRequest{} req.jingle = jingle @@ -1073,7 +1068,7 @@ func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, CartListEn d.getJingleCutListChan <- req res := <-resCh - return res.active, res.inactive, res.err + return res.cart, res.err } func (d *DB) GetPoolList(username string) (PoolList, error) { |