public void setNull(int parameterIndex, int sqlType) throws SQLException { cstmt.setNull(parameterIndex, sqlType); }
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { cstmt.setNull(parameterName, sqlType, typeName); }
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { cstmt.setNull(parameterIndex, sqlType, typeName); }
public void setNull(String parameterName, int sqlType) throws SQLException { cstmt.setNull(parameterName, sqlType); }
@Override public void setNull(String parameterName, int sqlType) throws SQLException { try { stmt.setNull(parameterName, sqlType); } catch (Throwable t) { throw checkException(t); } }
@Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { try { stmt.setNull(parameterName, sqlType, typeName); } catch (Throwable t) { throw checkException(t); } }
@Override public void setNull(String parameterName, int sqlType) throws SQLException { SQLException e = null; try { delegate.setNull(parameterName, sqlType); } catch (SQLException sqle) { e = sqle; throw e; } finally { eventListener.onAfterCallableStatementSet(statementInformation, parameterName, null, e); } }
@Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { SQLException e = null; try { delegate.setNull(parameterName, sqlType, typeName); } catch (SQLException sqle) { e = sqle; throw e; } finally { eventListener.onAfterCallableStatementSet(statementInformation, parameterName, null, e); } }
@Override public void callableStatement_setNull(CallableStatementProxy statement, String parameterName, int sqlType, String typeName) throws SQLException { if (this.pos < filterSize) { nextFilter().callableStatement_setNull(this, statement, parameterName, sqlType, typeName); return; } statement.getRawObject().setNull(parameterName, sqlType, typeName); }
@Override public void callableStatement_setNull(CallableStatementProxy statement, String parameterName, int sqlType) throws SQLException { if (this.pos < filterSize) { nextFilter().callableStatement_setNull(this, statement, parameterName, sqlType); return; } statement.getRawObject().setNull(parameterName, sqlType); }
@Override public void bind( CallableStatement st, J value, String name, WrapperOptions options) throws SQLException { if ( value == null ) { st.setNull( name, Types.STRUCT, SQL_TYPE_NAME ); } else { final Geometry geometry = javaTypeDescriptor.unwrap( value, Geometry.class, options ); final Object dbGeom = toNative( geometry, st.getConnection() ); st.setObject( name, dbGeom ); } }
@Override protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException { final String valueStr = javaTypeDescriptor.unwrap( value, String.class, options ); if ( valueStr == null || valueStr.trim().isEmpty() ) { st.setNull( name, getSqlType() ); } else { st.setString( name, valueStr ); } } };
@Override public final void bind(CallableStatement st, J value, String name, WrapperOptions options) throws SQLException { final boolean traceEnabled = log.isTraceEnabled(); if ( value == null ) { if ( traceEnabled ) { log.trace( String.format( NULL_BIND_MSG_TEMPLATE, name, JdbcTypeNameMapper.getTypeName( getSqlDescriptor().getSqlType() ) ) ); } st.setNull( name, sqlDescriptor.getSqlType() ); } else { if ( traceEnabled ) { log.trace( String.format( BIND_MSG_TEMPLATE, name, JdbcTypeNameMapper.getTypeName( sqlDescriptor.getSqlType() ), getJavaDescriptor().extractLoggableRepresentation( value ) ) ); } doBind( st, value, name, options ); } }
@Test public void testNullArg() throws Exception { given(callableStatement.execute()).willReturn(false); given(callableStatement.getUpdateCount()).willReturn(-1); given(connection.prepareCall("{call " + NullArg.SQL + "(?)}")).willReturn(callableStatement); NullArg na = new NullArg(dataSource); na.execute((String) null); callableStatement.setNull(1, Types.VARCHAR); }
@Override public void setNull(String parameterName, int sqlType) throws SQLException { SQLException e = null; try { delegate.setNull(parameterName, sqlType); } catch (SQLException sqle) { e = sqle; throw e; } finally { eventListener.onAfterCallableStatementSet(statementInformation, parameterName, null, e); } }
@Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { SQLException e = null; try { delegate.setNull(parameterName, sqlType, typeName); } catch (SQLException sqle) { e = sqle; throw e; } finally { eventListener.onAfterCallableStatementSet(statementInformation, parameterName, null, e); } }
@Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { try { stmt.setNull(parameterName, sqlType, typeName); } catch (Throwable t) { throw checkException(t); } }
@Override public void callableStatement_setNull(CallableStatementProxy statement, String parameterName, int sqlType, String typeName) throws SQLException { if (this.pos < filterSize) { nextFilter().callableStatement_setNull(this, statement, parameterName, sqlType, typeName); return; } statement.getRawObject().setNull(parameterName, sqlType, typeName); }
@Test public void testCallableStatementOnAfterCallableStatementSetNullWithTypeName() throws SQLException { wrappedCallableStatement.setNull(null, 0, "foo"); verify(mockedJdbcListener).onAfterCallableStatementSet(eq(callableStatementInformation), ArgumentMatchers.<String>isNull(), any(), ArgumentMatchers.<SQLException>isNull()); }
@Test public void testCallableStatementOnAfterCallableStatementSetNull() throws SQLException { wrappedCallableStatement.setNull(null, 0); verify(mockedJdbcListener).onAfterCallableStatementSet(eq(callableStatementInformation), ArgumentMatchers.<String>isNull(), any(), ArgumentMatchers.<SQLException>isNull()); }