数据库错误操作优化

This commit is contained in:
hoteas 2022-08-18 13:40:02 +08:00
parent 253cad35ef
commit 6d9af149ad

View File

@ -81,7 +81,7 @@ func (that *HotimeDBBuilder) Update(qu ...interface{}) int64 {
} }
if lth > 1 { if lth > 1 {
for k := 1; k < lth; k++ { for k := 1; k < lth; k++ {
data[ObjToStr(k-1)] = qu[k] data[ObjToStr(qu[k-1])] = qu[k]
k++ k++
} }
} }
@ -126,7 +126,7 @@ func (that *HotimeDBBuilder) Join(qu ...interface{}) *HotimeDBBuilder {
} }
if lth > 1 { if lth > 1 {
for k := 1; k < lth; k++ { for k := 1; k < lth; k++ {
data[ObjToStr(k-1)] = qu[k] data[ObjToStr(qu[k-1])] = qu[k]
k++ k++
} }
} }
@ -155,7 +155,7 @@ func (that *HotimeDBBuilder) And(qu ...interface{}) *HotimeDBBuilder {
if lth > 1 { if lth > 1 {
where = Map{} where = Map{}
for k := 1; k < lth; k++ { for k := 1; k < lth; k++ {
where[ObjToStr(k-1)] = qu[k] where[ObjToStr(qu[k-1])] = qu[k]
k++ k++
} }
} }
@ -187,7 +187,7 @@ func (that *HotimeDBBuilder) Or(qu ...interface{}) *HotimeDBBuilder {
if lth > 1 { if lth > 1 {
where = Map{} where = Map{}
for k := 1; k < lth; k++ { for k := 1; k < lth; k++ {
where[ObjToStr(k-1)] = qu[k] where[ObjToStr(qu[k-1])] = qu[k]
k++ k++
} }
} }
@ -218,7 +218,7 @@ func (that *HotimeDBBuilder) Where(qu ...interface{}) *HotimeDBBuilder {
if lth > 1 { if lth > 1 {
where = Map{} where = Map{}
for k := 1; k < lth; k++ { for k := 1; k < lth; k++ {
where[ObjToStr(k-1)] = qu[k] where[ObjToStr(qu[k-1])] = qu[k]
k++ k++
} }
} }
@ -703,9 +703,9 @@ func (that *HoTimeDB) Select(table string, qu ...interface{}) []Map {
} }
if reflect.ValueOf(qu[0]).Type().String() == "common.Slice" { if reflect.ValueOf(qu[0]).Type().String() == "common.Slice" {
qu0 := ObjToSlice(qu[0])
for key, _ := range testQuData { for key, _ := range qu0 {
v := testQuData.GetMap(key) v := qu0.GetMap(key)
for k1, v1 := range v { for k1, v1 := range v {
testQu = append(testQu, k1) testQu = append(testQu, k1)
testQuData[k1] = v1 testQuData[k1] = v1