public static void toStringSqlArgs(final StringBuilder sb, Iterable<Object[]> args) { // then we're doing a batch query for (Object[] rowOfArgs : args) { toStringSqlArgs(sb, rowOfArgs); } }
toStringSqlArgs(sb, rowOfArgs);
private static PalantirSqlException wrapSQLExceptionWithVerboseLogging(final SQLException sqlEx, String sql, Object[] args) { try { StringBuilder why = new StringBuilder(); why.append("While attempting to execute the SQL '" + sql + "' we caught a SQLException.\n" + //$NON-NLS-1$ //$NON-NLS-2$ "The SQL was executed with the following bind args:\n"); //$NON-NLS-1$ BasicSQLUtils.toStringSqlArgs(why, args); why.append("End of verbose SQLException error message"); //$NON-NLS-1$ return PalantirSqlException.create(new VerboseSQLException(sqlEx, why.toString())); } catch (Throwable e) { // make sure we don't interfere with the real error SqlLoggers.LOGGER.error("Trapped an exception while printing out information about an exception. " + //$NON-NLS-1$ "No client requests were harmed.", e); //$NON-NLS-1$ SqlLoggers.LOGGER.error("Printing SQLException now so it doesn't get lost", sqlEx); //$NON-NLS-1$ } return PalantirSqlException.create(sqlEx); }
private static PalantirSqlException wrapSQLExceptionWithVerboseLogging(final PalantirSqlException sqlEx, String sql, Object[] args) { try { if (sqlEx.getCause() == null || !(sqlEx.getCause() instanceof SQLException)) { return sqlEx; } StringBuilder why = new StringBuilder(); why.append("While attempting to execute the SQL '" + sql + "' we caught a SQLException.\n" + //$NON-NLS-1$ //$NON-NLS-2$ "The SQL was executed with the following bind args:\n"); //$NON-NLS-1$ BasicSQLUtils.toStringSqlArgs(why, args); why.append("End of verbose SQLException error message"); //$NON-NLS-1$ return PalantirSqlException.create(new VerboseSQLException((SQLException) sqlEx.getCause(), why.toString())); } catch (Throwable e) { // make sure we don't interfere with the real error SqlLoggers.LOGGER.error("Trapped an exception while printing out information about an exception. " + //$NON-NLS-1$ "No client requests were harmed.", e); //$NON-NLS-1$ SqlLoggers.LOGGER.error("Printing SQLException now so it doesn't get lost", sqlEx); //$NON-NLS-1$ } return sqlEx; }
public static void toStringSqlArgs(final StringBuilder sb, Iterable<Object[]> args) { // then we're doing a batch query for (Object[] rowOfArgs : args) { toStringSqlArgs(sb, rowOfArgs); } }
toStringSqlArgs(sb, rowOfArgs);
private static PalantirSqlException wrapSQLExceptionWithVerboseLogging(final SQLException sqlEx, String sql, Object[] args) { try { StringBuilder why = new StringBuilder(); why.append("While attempting to execute the SQL '" + sql + "' we caught a SQLException.\n" + //$NON-NLS-1$ //$NON-NLS-2$ "The SQL was executed with the following bind args:\n"); //$NON-NLS-1$ BasicSQLUtils.toStringSqlArgs(why, args); why.append("End of verbose SQLException error message"); //$NON-NLS-1$ return PalantirSqlException.create(new VerboseSQLException(sqlEx, why.toString())); } catch (Throwable e) { // make sure we don't interfere with the real error SqlLoggers.LOGGER.error("Trapped an exception while printing out information about an exception. " + //$NON-NLS-1$ "No client requests were harmed.", e); //$NON-NLS-1$ SqlLoggers.LOGGER.error("Printing SQLException now so it doesn't get lost", sqlEx); //$NON-NLS-1$ } return PalantirSqlException.create(sqlEx); }
private static PalantirSqlException wrapSQLExceptionWithVerboseLogging(final PalantirSqlException sqlEx, String sql, Object[] args) { try { if (sqlEx.getCause() == null || !(sqlEx.getCause() instanceof SQLException)) { return sqlEx; } StringBuilder why = new StringBuilder(); why.append("While attempting to execute the SQL '" + sql + "' we caught a SQLException.\n" + //$NON-NLS-1$ //$NON-NLS-2$ "The SQL was executed with the following bind args:\n"); //$NON-NLS-1$ BasicSQLUtils.toStringSqlArgs(why, args); why.append("End of verbose SQLException error message"); //$NON-NLS-1$ return PalantirSqlException.create(new VerboseSQLException((SQLException) sqlEx.getCause(), why.toString())); } catch (Throwable e) { // make sure we don't interfere with the real error SqlLoggers.LOGGER.error("Trapped an exception while printing out information about an exception. " + //$NON-NLS-1$ "No client requests were harmed.", e); //$NON-NLS-1$ SqlLoggers.LOGGER.error("Printing SQLException now so it doesn't get lost", sqlEx); //$NON-NLS-1$ } return sqlEx; }