public static String fillLogParams ( String sql , Map < Object , Object > logParams ) { StringBuilder result = new StringBuilder ( ) ; Map < Object , Object > tmpLogParam = ( logParams == null ? new HashMap < Object , Object > ( ) : logParams ) ; Iterator < Object > it = tmpLogParam . values ( ) . iterator ( ) ; boolean inQuote = false ; boolean inQuote2 = false ; char [ ] sqlChar = sql != null ? sql . toCharArray ( ) : new char [ ] { } ; for ( int i = 0 ; i < sqlChar . length ; i ++ ) { if ( sqlChar [ i ] == ' ' ) { inQuote = ! inQuote ; } if ( sqlChar [ i ] == ' ' ) { inQuote2 = ! inQuote2 ; } if ( sqlChar [ i ] == ' ' && ! ( inQuote || inQuote2 ) ) { if ( it . hasNext ( ) ) { result . append ( prettyPrint ( it . next ( ) ) ) ; } else { result . append ( ' ' ) ; } } else { result . append ( sqlChar [ i ] ) ; } } return result . toString ( ) ; }
Returns sql statement used in this prepared statement together with the parameters .