| 60 | } |
| 61 | |
| 62 | func (in *traceInterceptor) RowsNext(c context.Context, rows driver.Rows, dest []driver.Value) error { |
| 63 | err := rows.Next(dest) |
| 64 | if err == io.EOF { |
| 65 | // For all cases, we call Next() n+1 times, the first to populate the initial dest, then eventually |
| 66 | // it will io.EOF. If we log on each Next() call we log the last element twice, so don't. |
| 67 | return err |
| 68 | } |
| 69 | cols := rows.Columns() |
| 70 | logrus.Debug(strings.Join(cols, " | ")) |
| 71 | |
| 72 | b := strings.Builder{} |
| 73 | for i, val := range dest { |
| 74 | b.WriteString(fmt.Sprintf("%q", val)) |
| 75 | if i+1 <= len(dest)-1 { |
| 76 | b.WriteString(" | ") |
| 77 | } |
| 78 | } |
| 79 | logrus.Debug(b.String()) |
| 80 | return err |
| 81 | } |
| 82 | |
| 83 | func trackGoID(query string) { |
| 84 | thisGoID := goid() |