use of java.sql.SQLWarning in project jaybird by FirebirdSQL.
the class AbstractWireOperations method processResponseWarnings.
/**
* Checks if the response included a warning and signals that warning to the
* WarningMessageCallback.
*
* @param response
* Response to process
*/
public final void processResponseWarnings(final Response response, WarningMessageCallback warningCallback) {
if (warningCallback == null) {
warningCallback = defaultWarningMessageCallback;
}
if (response instanceof GenericResponse) {
GenericResponse genericResponse = (GenericResponse) response;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") SQLException exception = genericResponse.getException();
if (exception != null && exception instanceof SQLWarning) {
warningCallback.processWarning((SQLWarning) exception);
}
}
}
use of java.sql.SQLWarning in project jaybird by FirebirdSQL.
the class OOConnection method setHoldability.
@Override
public void setHoldability(int holdability) {
if (holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT)
return;
final String message = "Holdability not modified. OpenOffice/LibreOffice compatibility always uses HOLD_CURSORS_OVER_COMMIT";
log.debug(message);
addWarning(new SQLWarning(message));
}
use of java.sql.SQLWarning in project presto by prestodb.
the class TestJdbcWarnings method testStatementWarnings.
@Test
public void testStatementWarnings() throws SQLException {
assertFalse(statement.execute("CREATE SCHEMA blackhole.test_schema"));
SQLWarning warning = statement.getWarnings();
assertNotNull(warning);
TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS);
TestingWarningCollector warningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig);
List<PrestoWarning> expectedWarnings = warningCollector.getWarnings();
assertStartsWithExpectedWarnings(warning, fromPrestoWarnings(expectedWarnings));
statement.clearWarnings();
assertNull(statement.getWarnings());
}
use of java.sql.SQLWarning in project presto by prestodb.
the class TestJdbcWarnings method fromPrestoWarnings.
private static SQLWarning fromPrestoWarnings(List<PrestoWarning> warnings) {
requireNonNull(warnings, "warnings is null");
assertFalse(warnings.isEmpty());
Iterator<PrestoWarning> iterator = warnings.iterator();
PrestoSqlWarning first = new PrestoSqlWarning(iterator.next());
SQLWarning current = first;
while (iterator.hasNext()) {
current.setNextWarning(new PrestoSqlWarning(iterator.next()));
current = current.getNextWarning();
}
return first;
}
use of java.sql.SQLWarning in project killbill by killbill.
the class EntitySqlDaoWrapperInvocationHandler method printSQLWarnings.
private void printSQLWarnings() {
if (logger.isDebugEnabled()) {
try {
SQLWarning warning = handle.getConnection().getWarnings();
while (warning != null) {
logger.debug("[SQL WARNING] {}", warning);
warning = warning.getNextWarning();
}
handle.getConnection().clearWarnings();
} catch (final SQLException e) {
logger.debug("Error whilst retrieving SQL warnings", e);
}
}
}
Aggregations