diff --git a/dbpool.go b/dbpool.go index 65e7951..92f12cf 100644 --- a/dbpool.go +++ b/dbpool.go @@ -235,7 +235,20 @@ func (this *dbPool) joinWhere(sql *string, params *[]string, whereKv [][]string) } func (this *dbPool) joinUpdateFields(fieldsKv [][]string, params *[]string) string { - return "" + sql := "" + for index, items := range fieldsKv { + suffix := "" + if index + 1 < len(fieldsKv) { + suffix = "," + } + if items[0][0] == '!' { + sql += " `" + items[0][1:] + "`=" + items[1] + suffix + } else { + sql += " `" + items[0] + "`=?" + suffix + *params = append(*params, items[1]) + } + } + return sql } func (this *dbPool) joinInsertFields(fieldsKv [][]string, params *[]string) string {