Top Description Fields Constructors Methods
org.postgresql.core

public Class ResultHandlerBase

extends Object
implements ResultHandler
Class Inheritance
All Implemented Interfaces
org.postgresql.core.ResultHandler
Known Direct Subclasses
org.postgresql.core.SetupQueryRunner.SimpleResultHandler, org.postgresql.jdbc.PgConnection.TransactionCommandHandler, org.postgresql.jdbc.BatchResultHandler, org.postgresql.jdbc.PgResultSet.CursorResultHandler, org.postgresql.jdbc.PgStatement.StatementResultHandler
Static Imports
org.postgresql.util.internal.Nullness.castNonNull

Empty implementation of ResultHandler interface. SQLException#setNextException(SQLException) has O(N) complexity, so this class tracks the last exception object to speedup setNextException.

Field Summary

Modifier and TypeField and Description
private @Nullable SQLException
private @Nullable SQLWarning
private @Nullable SQLException
private @Nullable SQLWarning

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public @Nullable SQLException
getException()

Implements org.postgresql.core.ResultHandler.getException.

Returns the first encountered exception.

public @Nullable SQLWarning
getWarning()

Implements org.postgresql.core.ResultHandler.getWarning.

Returns the first encountered warning.

public void
handleCommandStatus(String
the command status string (e.g. "SELECT") returned by the backend
status
,
long
the number of rows affected by an INSERT, UPDATE, DELETE, FETCH, or MOVE command; -1 if not available.
updateCount
,
long
for a single-row INSERT query, the OID of the newly inserted row; 0 if not available.
insertOID
)

Implements org.postgresql.core.ResultHandler.handleCommandStatus.

Called when a query that did not return a resultset completes.

public void
handleCompletion()

Implements org.postgresql.core.ResultHandler.handleCompletion.

Called before a QueryExecutor method returns.

public void
handleError(SQLException
the error that occurred
error
)

Implements org.postgresql.core.ResultHandler.handleError.

Called when an error occurs.

public void
handleResultRows(Query fromQuery, Field[] fields, List<Tuple> tuples, @Nullable ResultCursor cursor)

public void
handleWarning(SQLWarning
the warning that occurred.
warning
)

Implements org.postgresql.core.ResultHandler.handleWarning.

Called when a warning is emitted.

public void
secureProgress()

Implements org.postgresql.core.ResultHandler.secureProgress.

Callback for batch statements.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstExceptionback to summary
private @Nullable SQLException firstException
firstWarningback to summary
private @Nullable SQLWarning firstWarning
lastExceptionback to summary
private @Nullable SQLException lastException
lastWarningback to summary
private @Nullable SQLWarning lastWarning

Constructor Detail

ResultHandlerBaseback to summary
public ResultHandlerBase()

Method Detail

getExceptionback to summary
public @Nullable SQLException getException()

Implements org.postgresql.core.ResultHandler.getException.

Doc from org.postgresql.core.ResultHandler.getException.

Returns the first encountered exception. The rest are chained via SQLException#setNextException(SQLException)

Returns:@Nullable SQLException

the first encountered exception

Annotations
@Override
getWarningback to summary
public @Nullable SQLWarning getWarning()

Implements org.postgresql.core.ResultHandler.getWarning.

Doc from org.postgresql.core.ResultHandler.getWarning.

Returns the first encountered warning. The rest are chained via SQLException#setNextException(SQLException)

Returns:@Nullable SQLWarning

the first encountered warning

Annotations
@Override
handleCommandStatusback to summary
public void handleCommandStatus(String status, long updateCount, long insertOID)

Implements org.postgresql.core.ResultHandler.handleCommandStatus.

Doc from org.postgresql.core.ResultHandler.handleCommandStatus.

Called when a query that did not return a resultset completes.

Parameters
status:String

the command status string (e.g. "SELECT") returned by the backend

updateCount:long

the number of rows affected by an INSERT, UPDATE, DELETE, FETCH, or MOVE command; -1 if not available.

insertOID:long

for a single-row INSERT query, the OID of the newly inserted row; 0 if not available.

Annotations
@Override
handleCompletionback to summary
public void handleCompletion() throws SQLException

Implements org.postgresql.core.ResultHandler.handleCompletion.

Doc from org.postgresql.core.ResultHandler.handleCompletion.

Called before a QueryExecutor method returns. This method may throw a SQLException if desired; if it does, the QueryExecutor method will propagate that exception to the original caller.

Annotations
@Override
Exceptions
SQLException:
if the handler wishes the original method to throw an exception.
handleErrorback to summary
public void handleError(SQLException error)

Implements org.postgresql.core.ResultHandler.handleError.

Doc from org.postgresql.core.ResultHandler.handleError.

Called when an error occurs. Subsequent queries are abandoned; in general the only calls between a handleError call and a subsequent handleCompletion call are handleError or handleWarning.

Parameters
error:SQLException

the error that occurred

Annotations
@Override
handleResultRowsback to summary
public void handleResultRows(Query fromQuery, Field[] fields, List<Tuple> tuples, @Nullable ResultCursor cursor)
Annotations
@Override
handleWarningback to summary
public void handleWarning(SQLWarning warning)

Implements org.postgresql.core.ResultHandler.handleWarning.

Doc from org.postgresql.core.ResultHandler.handleWarning.

Called when a warning is emitted.

Parameters
warning:SQLWarning

the warning that occurred.

Annotations
@Override
secureProgressback to summary
public void secureProgress()

Implements org.postgresql.core.ResultHandler.secureProgress.

Doc from org.postgresql.core.ResultHandler.secureProgress.

Callback for batch statements. In case batch statement is executed in autocommit==true mode, the executor might commit "as it this it is best", so the result handler should track which statements are executed successfully and which are not.

Annotations
@Override