1515 */
1616package org .apache .ibatis .logging .jdbc ;
1717
18+ import org .apache .ibatis .builder .SqlSourceBuilder ;
19+ import org .apache .ibatis .logging .Log ;
20+ import org .apache .ibatis .reflection .ArrayUtil ;
21+
1822import java .lang .reflect .Method ;
1923import java .sql .Array ;
2024import java .sql .PreparedStatement ;
2125import java .sql .SQLException ;
22- import java .util .ArrayList ;
23- import java .util .Arrays ;
24- import java .util .HashMap ;
25- import java .util .HashSet ;
26- import java .util .List ;
27- import java .util .Map ;
28- import java .util .Set ;
26+ import java .util .*;
2927import java .util .stream .Collectors ;
3028
31- import org .apache .ibatis .builder .SqlSourceBuilder ;
32- import org .apache .ibatis .logging .Log ;
33- import org .apache .ibatis .reflection .ArrayUtil ;
34-
3529/**
3630 * Base class for proxies to do logging.
3731 *
@@ -43,10 +37,10 @@ public abstract class BaseJdbcLogger {
4337 protected static final Set <String > SET_METHODS ;
4438 protected static final Set <String > EXECUTE_METHODS = new HashSet <>();
4539
46- private final Map <Object , Object > columnMap = new HashMap <>();
40+ private final Map <Object , String > columnMap = new HashMap <>();
4741
4842 private final List <Object > columnNames = new ArrayList <>();
49- private final List <Object > columnValues = new ArrayList <>();
43+ private final List <String > columnValues = new ArrayList <>();
5044
5145 protected final Log statementLog ;
5246 protected final int queryStack ;
@@ -75,9 +69,18 @@ public BaseJdbcLogger(Log log, int queryStack) {
7569 }
7670
7771 protected void setColumn (Object key , Object value ) {
78- columnMap .put (key , value );
72+ String valueString = null ;
73+ if (value !=null ){
74+ valueString = objectValueString (value ) +
75+ "(" + value .getClass ().getSimpleName ()+")" ;
76+ } else {
77+ valueString = "null" ;
78+ }
79+
80+
81+ columnMap .put (key , valueString );
7982 columnNames .add (key );
80- columnValues .add (value );
83+ columnValues .add (valueString );
8184 }
8285
8386 protected Object getColumn (Object key ) {
@@ -87,11 +90,7 @@ protected Object getColumn(Object key) {
8790 protected String getParameterValueString () {
8891 List <Object > typeList = new ArrayList <>(columnValues .size ());
8992 for (Object value : columnValues ) {
90- if (value == null ) {
91- typeList .add ("null" );
92- } else {
93- typeList .add (objectValueString (value ) + "(" + value .getClass ().getSimpleName () + ")" );
94- }
93+ typeList .add (value );
9594 }
9695 final String parameters = typeList .toString ();
9796 return parameters .substring (1 , parameters .length () - 1 );
0 commit comments