public String formatSQL ( Object obj , Object expr ) { String sql = null ; // Check whether an SQL statement has been provided if ( expr instanceof String ) { sql = ( String ) expr ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "SQL retrieved from state = " + sql ) ; } } else if ( obj != null ) { sql = toString ( obj ) ; if ( sql != null ) { if ( sql . startsWith ( "prep" ) ) { sql = sql . replaceFirst ( "prep[0-9]*: " , "" ) ; } sql = sql . replaceAll ( "X'.*'" , BINARY_SQL_MARKER ) ; } if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "SQL derived from context = " + sql ) ; } } return sql ; }
This method attempts to return a SQL statement . If an expression is supplied and is string it will be used . Otherwise the method will attempt to derive an expression from the supplied object .