summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/rddb.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-12-14 04:02:37 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-12-14 04:02:37 (GMT)
commit775a762b0c3d67d2ea19f288bec8c2ce857ec198 (patch)
treef6bbd0ad61db7b6b005b4aa151f6ea615b365486 /src/helsinki.at/rhimport/rddb.go
parent54ee84d1a3287a837a9c2df92ae1cf3223c06377 (diff)
added more sophisticated import options - still needs testing
Diffstat (limited to 'src/helsinki.at/rhimport/rddb.go')
-rw-r--r--src/helsinki.at/rhimport/rddb.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/helsinki.at/rhimport/rddb.go b/src/helsinki.at/rhimport/rddb.go
index 0a9e21e..b693c47 100644
--- a/src/helsinki.at/rhimport/rddb.go
+++ b/src/helsinki.at/rhimport/rddb.go
@@ -63,14 +63,15 @@ type getGroupOfCartRequest struct {
type getShowInfoResult struct {
title string
- carts []int
+ group string
+ carts []uint
norm_lvl int
trim_lvl int
err error
}
type getShowInfoRequest struct {
- showid int
+ showid uint
response chan getShowInfoResult
}
@@ -135,7 +136,7 @@ func (self *RdDb) init(conf *Config) (err error) {
if self.getGroupOfCartStmt, err = self.dbh.Prepare("select NAME,DEFAULT_LOW_CART,DEFAULT_HIGH_CART from GROUPS where DEFAULT_LOW_CART <= ? and DEFAULT_HIGH_CART >= ?;"); err != nil {
return
}
- if self.getShowInfoStmt, err = self.dbh.Prepare("select CART.TITLE,CART.MACROS,DROPBOXES.NORMALIZATION_LEVEL,DROPBOXES.AUTOTRIM_LEVEL,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART from CART, DROPBOXES, GROUPS where CART.NUMBER = DROPBOXES.TO_CART and GROUPS.NAME = DROPBOXES.GROUP_NAME and CART.NUMBER = ?;"); err != nil {
+ if self.getShowInfoStmt, err = self.dbh.Prepare("select CART.TITLE,CART.MACROS,DROPBOXES.GROUP_NAME,DROPBOXES.NORMALIZATION_LEVEL,DROPBOXES.AUTOTRIM_LEVEL,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART from CART, DROPBOXES, GROUPS where CART.NUMBER = DROPBOXES.TO_CART and GROUPS.NAME = DROPBOXES.GROUP_NAME and CART.NUMBER = ?;"); err != nil {
return
}
if self.checkMusicGroupStmt, err = self.dbh.Prepare("select count(*) from DROPBOXES where GROUP_NAME = ? and SET_USER_DEFINED like \"M;%\";"); err != nil {
@@ -199,7 +200,7 @@ func (self *RdDb) getLogTableName(log string) string {
return strings.Replace(log, " ", "_", -1) + "_LOG" // TODO: this should get escaped for mySQL but golang doesn't support it!!!
}
-func (self *RdDb) getShowCarts(log string, low_cart, high_cart int) (carts []int, err error) {
+func (self *RdDb) getShowCarts(log string, low_cart, high_cart int) (carts []uint, err error) {
q := fmt.Sprintf("select CART_NUMBER from %s where CART_NUMBER >= %d and CART_NUMBER <= %d order by COUNT;", self.getLogTableName(log), low_cart, high_cart)
var rows *sql.Rows
if rows, err = self.dbh.Query(q); err != nil {
@@ -207,7 +208,7 @@ func (self *RdDb) getShowCarts(log string, low_cart, high_cart int) (carts []int
}
defer rows.Close()
for rows.Next() {
- var cart int
+ var cart uint
if err = rows.Scan(&cart); err != nil {
return
}
@@ -217,10 +218,10 @@ func (self *RdDb) getShowCarts(log string, low_cart, high_cart int) (carts []int
return
}
-func (self *RdDb) getShowInfo(showid int) (result getShowInfoResult) {
+func (self *RdDb) getShowInfo(showid uint) (result getShowInfoResult) {
var macros string
var low_cart, high_cart int
- result.err = self.getShowInfoStmt.QueryRow(showid).Scan(&result.title, &macros, &result.norm_lvl, &result.trim_lvl, &low_cart, &high_cart)
+ result.err = self.getShowInfoStmt.QueryRow(showid).Scan(&result.title, &macros, &result.group, &result.norm_lvl, &result.trim_lvl, &low_cart, &high_cart)
if result.err != nil {
if result.err == sql.ErrNoRows {
result.err = fmt.Errorf("show '%d' not found", showid)