@Override public String toString() { return getSql(); }
UpdateRow ur = new UpdateRow( new TableName( mainTable ) ); ur.addPreparedArgument( "version", null ); ur.addPreparedArgument( "status", null ); ur.addPreparedArgument( recordColumn, rec.getAsByteArray() ); ur.setWhereClause( idColumn + " = " + Integer.toString( requestedId ) ); LOG.debug( stmt.toString() ); ur.performUpdate( conn );
public void performUpdate( Connection conn ) throws SQLException { if ( LOG.isDebugEnabled() ) { LOG.debug( "Updating: " + this ); } String sql = getSql(); PreparedStatement stmt = null; stmt = conn.prepareStatement( sql ); int columnId = 1; for ( Entry<SQLIdentifier, Object> entry : columnToObject.entrySet() ) { if ( entry.getValue() != null ) { LOG.debug( "- Argument " + entry.getKey() + " = " + entry.getValue() + " (" + entry.getValue().getClass() + ")" ); if ( entry.getValue() instanceof ParticleConversion<?> ) { ParticleConversion<?> conversion = (ParticleConversion<?>) entry.getValue(); conversion.setParticle( stmt, columnId++ ); } else { stmt.setObject( columnId++, entry.getValue() ); } } else { LOG.debug( "- Argument " + entry.getKey() + " = NULL" ); stmt.setObject( columnId++, null ); } } stmt.execute(); stmt.close(); } }