Skip to content

Commit

Permalink
change scan tid data-type to int64 to test on ORACLE
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Jul 1, 2022
1 parent cf20517 commit 13aa701
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions dbs/dbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,14 @@ func QueryRow(table, id, attr string, val interface{}) (int64, error) {
// in SQLite the ids are int64 while on ORACLE they are float64
var err error
var tid int64
if DBOWNER == "sqlite" {
err = DB.QueryRow(stm, val).Scan(&tid)
} else { // ORACLE case
var otid float64
err = DB.QueryRow(stm, val).Scan(&otid)
tid = int64(otid)
}
err = DB.QueryRow(stm, val).Scan(&tid)
// if DBOWNER == "sqlite" {
// err = DB.QueryRow(stm, val).Scan(&tid)
// } else { // ORACLE case
// var otid float64
// err = DB.QueryRow(stm, val).Scan(&otid)
// tid = int64(otid)
// }
if err != nil {
if utils.VERBOSE > 1 {
log.Printf("fail to get id for %s, %v, error %v", stm, val, err)
Expand All @@ -620,13 +621,14 @@ func GetID(tx *sql.Tx, table, id, attr string, val ...interface{}) (int64, error
// in SQLite the ids are int64 while on ORACLE they are float64
var err error
var tid int64
if DBOWNER == "sqlite" {
err = tx.QueryRow(stm, val...).Scan(&tid)
} else { // ORACLE
var otid float64
err = tx.QueryRow(stm, val...).Scan(&tid)
tid = int64(otid)
}
err = tx.QueryRow(stm, val...).Scan(&tid)
// if DBOWNER == "sqlite" {
// err = tx.QueryRow(stm, val...).Scan(&tid)
// } else { // ORACLE
// var otid float64
// err = tx.QueryRow(stm, val...).Scan(&tid)
// tid = int64(otid)
// }
if err != nil {
if utils.VERBOSE > 1 {
log.Printf("fail to get id for %s, %v, error %v", stm, val, err)
Expand Down

0 comments on commit 13aa701

Please sign in to comment.