use of com.palantir.nexus.db.ResourceCreationLocation in project atlasdb by palantir.
the class BasicSQL method selectLightResultSetSpecifyingDBType.
protected AgnosticLightResultSet selectLightResultSetSpecifyingDBType(final Connection c, final FinalSQLString sql, Object[] vs, final DBType dbType, @Nullable Integer fetchSize) throws PalantirSqlException, PalantirInterruptedException {
if (SqlLoggers.LOGGER.isTraceEnabled()) {
SqlLoggers.LOGGER.trace("SQL light result set selection query: {}", sql.getQuery());
}
// $NON-NLS-1$
final ResourceCreationLocation alrsCreationException = new ResourceCreationLocation("This is where the AgnosticLightResultSet wrapper was created");
PreparedStatementVisitor<AgnosticLightResultSet> preparedStatementVisitor = ps -> {
// $NON-NLS-1$
final ResourceCreationLocation creationException = new ResourceCreationLocation("This is where the ResultsSet was created", alrsCreationException);
final ResultSetVisitor<AgnosticLightResultSet> resultSetVisitor = rs -> {
try {
return new AgnosticLightResultSetImpl(rs, dbType, rs.getMetaData(), ps, // $NON-NLS-1$
"selectList", sql, getSqlTimer(), creationException);
} catch (Exception e) {
closeSilently(rs);
BasicSQLUtils.throwUncheckedIfSQLException(e);
throw Throwables.throwUncheckedException(e);
}
};
try {
return runCancellably(ps, resultSetVisitor, sql, AutoClose.FALSE, fetchSize);
} catch (Exception e) {
closeSilently(ps);
BasicSQLUtils.throwUncheckedIfSQLException(e);
throw Throwables.throwUncheckedException(e);
}
};
return wrapPreparedStatement(c, sql, vs, preparedStatementVisitor, // $NON-NLS-1$
"selectList", // don't close the ps
AutoClose.FALSE);
}
use of com.palantir.nexus.db.ResourceCreationLocation in project atlasdb by palantir.
the class SQL method fromResultSet.
public AgnosticLightResultSet fromResultSet(PreparedStatement preparedStatement, ResultSet resultSet, DBType dbType, String queryString) {
FinalSQLString sqlString = SQLString.getUnregisteredQuery(queryString);
String timingModule = "visitResultSet";
ResultSetMetaData metaData = ResultSets.getMetaData(resultSet);
SqlTimer sqlTimer = getSqlTimer();
// $NON-NLS-1$
ResourceCreationLocation creationException = new ResourceCreationLocation("This is where the ResultsSet was created");
return new AgnosticLightResultSetImpl(resultSet, dbType, metaData, preparedStatement, timingModule, sqlString, sqlTimer, creationException);
}
Aggregations