use of io.r2dbc.spi.R2dbcException in project jOOQ by jOOQ.
the class DataAccessException method sqlState.
/**
* Retrieve the {@link SQLException#getSQLState()} or
* {@link R2dbcException#getSqlState()} from {@link #getCause()}, if this
* <code>DataAccessException</code> was caused by a {@link SQLException} or
* {@link R2dbcException}.
*/
public String sqlState() {
SQLException s = getCause(SQLException.class);
if (s != null)
return s.getSQLState();
R2dbcException r = getCause(R2dbcException.class);
if (r != null)
return r.getSqlState();
return "00000";
}
use of io.r2dbc.spi.R2dbcException in project jOOQ by jOOQ.
the class DataAccessException method sqlStateClass.
/**
* Decode the {@link SQLException#getSQLState()} or
* {@link R2dbcException#getSqlState()} from {@link #getCause()} into
* {@link SQLStateClass}, if this <code>DataAccessException</code> was
* caused by a {@link SQLException} or {@link R2dbcException}.
*/
public SQLStateClass sqlStateClass() {
SQLException s = getCause(SQLException.class);
if (s != null)
if (s.getSQLState() != null)
return SQLStateClass.fromCode(s.getSQLState());
else if (s.getSQLState() == null && "org.sqlite.SQLiteException".equals(s.getClass().getName()))
return SQLStateClass.fromSQLiteVendorCode(s.getErrorCode());
R2dbcException r = getCause(R2dbcException.class);
if (r != null)
if (r.getSqlState() != null)
return SQLStateClass.fromCode(r.getSqlState());
return SQLStateClass.NONE;
}
Aggregations