diff --git a/logger.go b/logger.go index 117b0403..4324a2e4 100644 --- a/logger.go +++ b/logger.go @@ -7,6 +7,7 @@ import ( "os" "reflect" "regexp" + "strconv" "time" "unicode" ) @@ -87,6 +88,7 @@ var LogFormatter = func(values ...interface{}) (messages []interface{}) { } messages = append(messages, sql) + messages = append(messages, fmt.Sprintf(" \n\033[36;31m[%v]\033[0m ", strconv.FormatInt(values[5].(int64), 10)+" rows affected or returned ")) } else { messages = append(messages, "\033[31;1m") messages = append(messages, values[2:]...) diff --git a/main.go b/main.go index 97cff7db..0f2fd1f5 100644 --- a/main.go +++ b/main.go @@ -702,7 +702,7 @@ func (s *DB) GetErrors() []error { //////////////////////////////////////////////////////////////////////////////// func (s *DB) clone() *DB { - db := DB{ + db := &DB{ db: s.db, parent: s.parent, logger: s.logger, @@ -723,8 +723,8 @@ func (s *DB) clone() *DB { db.search = s.search.clone() } - db.search.db = &db - return &db + db.search.db = db + return db } func (s *DB) print(v ...interface{}) { @@ -739,6 +739,6 @@ func (s *DB) log(v ...interface{}) { func (s *DB) slog(sql string, t time.Time, vars ...interface{}) { if s.logMode == 2 { - s.print("sql", fileWithLineNum(), NowFunc().Sub(t), sql, vars) + s.print("sql", fileWithLineNum(), NowFunc().Sub(t), sql, vars, s.RowsAffected) } }