/** * Convert an SQLException using the current converter, doing some logging first. * * @param sqlException The exception to convert * @param message An error message. * @param sql The SQL being executed when the exception occurred * * @return The converted exception */ public JDBCException convert(SQLException sqlException, String message, String sql) { logExceptions( sqlException, message + " [" + sql + "]" ); return sqlExceptionConverter.convert( sqlException, message, sql ); }
@Override protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { try { return toCallableStatement( statement ).getInt( parameterPosition ); } catch (SQLException sqle) { sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" ); throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle ); } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ( "findColumn".equals( method.getName() ) ) { return findColumn( (String) args[0] ); } if ( isFirstArgColumnLabel( method ) ) { Method columnIndexMethod = NAME_TO_INDEX_METHOD_MAPPING.get( new ResultSetMethodKey( method.getName(), method.getParameterTypes() ) ); if ( columnIndexMethod != null ) { try { final Integer columnIndex = findColumn( (String) args[0] ); return invokeMethod( columnIndexMethod, buildColumnIndexMethodArgs( args, columnIndex ) ); } catch ( SQLException ex ) { final String msg = "Exception getting column index for column: [" + args[0] + "].\nReverting to using: [" + args[0] + "] as first argument for method: [" + method + "]"; SQL_EXCEPTION_HELPER.logExceptions( ex, msg ); } } } return invokeMethod( method, args ); }
/** * Convert an SQLException using the current converter, doing some logging first. * * @param sqlException The exception to convert * @param message An error message. * @param sql The SQL being executed when the exception occurred * * @return The converted exception */ public JDBCException convert(SQLException sqlException, String message, String sql) { logExceptions( sqlException, message + " [" + sql + "]" ); return sqlExceptionConverter.convert( sqlException, message, sql ); }
/** * Convert an SQLException using the current converter, doing some logging first. * * @param sqlException The exception to convert * @param message An error message. * @param sql The SQL being executed when the exception occurred * @return The converted exception */ public JDBCException convert( SQLException sqlException, String message, String sql ) { logExceptions(sqlException, message + " [" + sql + "]"); return sqlExceptionConverter.convert(sqlException, message, sql); }
/** * Convert an SQLException using the current converter, doing some logging first. * * @param sqlException The exception to convert * @param message An error message. * @param sql The SQL being executed when the exception occurred * @return The converted exception */ public JDBCException convert( SQLException sqlException, String message, String sql ) { logExceptions(sqlException, message + " [" + sql + "]"); return sqlExceptionConverter.convert(sqlException, message, sql); }
@Override protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { try { return toCallableStatement( statement ).getInt( parameterPosition ); } catch( SQLException sqle ) { sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" ); throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle ); } }
@Override protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { try { return toCallableStatement( statement ).getInt( parameterPosition ); } catch( SQLException sqle ) { sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" ); throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle ); } }
@Override protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { try { return toCallableStatement( statement ).getInt( parameterPosition ); } catch (SQLException sqle) { sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" ); throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle ); } }
@Override @SuppressWarnings( {"UnnecessaryBoxing"}) public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ( "findColumn".equals( method.getName() ) ) { return Integer.valueOf( findColumn( ( String ) args[0] ) ); } if ( isFirstArgColumnLabel( method, args ) ) { try { int columnIndex = findColumn( ( String ) args[0] ); return invokeMethod( locateCorrespondingColumnIndexMethod( method ), buildColumnIndexMethodArgs( args, columnIndex ) ); } catch ( SQLException ex ) { StringBuffer buf = new StringBuffer() .append( "Exception getting column index for column: [" ) .append( args[0] ) .append( "].\nReverting to using: [" ) .append( args[0] ) .append( "] as first argument for method: [" ) .append( method ) .append( "]" ); sqlExceptionHelper.logExceptions( ex, buf.toString() ); } catch ( NoSuchMethodException ex ) { LOG.unableToSwitchToMethodUsingColumnIndex( method ); } } return invokeMethod( method, args ); }
@Override @SuppressWarnings( {"UnnecessaryBoxing"}) public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ( "findColumn".equals( method.getName() ) ) { return Integer.valueOf( findColumn( ( String ) args[0] ) ); } if ( isFirstArgColumnLabel( method, args ) ) { try { int columnIndex = findColumn( ( String ) args[0] ); return invokeMethod( locateCorrespondingColumnIndexMethod( method ), buildColumnIndexMethodArgs( args, columnIndex ) ); } catch ( SQLException ex ) { StringBuffer buf = new StringBuffer() .append( "Exception getting column index for column: [" ) .append( args[0] ) .append( "].\nReverting to using: [" ) .append( args[0] ) .append( "] as first argument for method: [" ) .append( method ) .append( "]" ); sqlExceptionHelper.logExceptions( ex, buf.toString() ); } catch ( NoSuchMethodException ex ) { LOG.unableToSwitchToMethodUsingColumnIndex( method ); } } return invokeMethod( method, args ); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ( "findColumn".equals( method.getName() ) ) { return findColumn( (String) args[0] ); } if ( isFirstArgColumnLabel( method ) ) { Method columnIndexMethod = NAME_TO_INDEX_METHOD_MAPPING.get( new ResultSetMethodKey( method.getName(), method.getParameterTypes() ) ); if ( columnIndexMethod != null ) { try { final Integer columnIndex = findColumn( (String) args[0] ); return invokeMethod( columnIndexMethod, buildColumnIndexMethodArgs( args, columnIndex ) ); } catch ( SQLException ex ) { final String msg = "Exception getting column index for column: [" + args[0] + "].\nReverting to using: [" + args[0] + "] as first argument for method: [" + method + "]"; SQL_EXCEPTION_HELPER.logExceptions( ex, msg ); } } } return invokeMethod( method, args ); }