3 Commits

2 changed files with 5 additions and 3 deletions
Split View
  1. +2
    -0
      db.go
  2. +3
    -3
      transaction.go

+ 2
- 0
db.go View File

@ -406,6 +406,7 @@ func GetRow(dbName, table_name, alias string, titles string, join [][]string, wh
}
if err != nil {
log.Println("DB error:", err)
rows.Close()
return count, info, err
}
@ -436,6 +437,7 @@ func GetRow(dbName, table_name, alias string, titles string, join [][]string, wh
}
rows.Close()
if rowerr != nil {
log.Println("DB row error:", rowerr)
return count, info, rowerr
}
return count, info, nil


+ 3
- 3
transaction.go View File

@ -25,7 +25,7 @@ func TxInsert(tx *sql.Tx, dbname, table string, data map[string]string) (int64,
if strings.Contains(table, "select ") {
dbName = table
} else {
dbName = getTableName(dbName, table)
dbName = getTableName(dbname, table)
}
if len(data) < 1 {
return 0, errors.New("参数错误,没有要写入的数据")
@ -186,7 +186,7 @@ func TxPreUpdate(tx *sql.Tx, dbname, table string, data []string, where []string
if strings.Contains(table, "select ") {
dbName = table
} else {
dbName = getTableName(dbName, table)
dbName = getTableName(dbname, table)
}
if len(where) < 1 {
@ -228,7 +228,7 @@ func TxDelete(tx *sql.Tx, dbname, table string, where map[string]string, del_cou
if strings.Contains(table, "select ") {
dbName = table
} else {
dbName = getTableName(dbName, table)
dbName = getTableName(dbname, table)
}
if len(where) < 1 {
return count, errors.New("参数错误,没有删除条件")


Loading…
Cancel
Save