public static String[] join(String[] x, String[] y, boolean[] use) { String[] result = new String[ x.length + countTrue(use) ]; for ( int i=0; i<x.length; i++ ) result[i] = x[i]; int k = x.length; for ( int i=0; i<y.length; i++ ) { if ( use[i] ) result[k++] = y[i]; } return result; }
public static String[] join(String[] x, String[] y, boolean[] use) { String[] result = new String[ x.length + countTrue(use) ]; for ( int i=0; i<x.length; i++ ) result[i] = x[i]; int k = x.length; for ( int i=0; i<y.length; i++ ) { if ( use[i] ) result[k++] = y[i]; } return result; }
/** * Write the index to a JDBC <tt>PreparedStatement</tt> */ protected int writeIndex(PreparedStatement st, Object index, int i, SessionImplementor session) throws HibernateException, SQLException { if (baseIndex!=0) { index = new Integer( ( (Integer) index ).intValue() + baseIndex ); } getIndexType().nullSafeSet( st, index, i, indexColumnIsSettable, session ); return i + ArrayHelper.countTrue(indexColumnIsSettable); }
/** * Write the element to a JDBC <tt>PreparedStatement</tt> */ protected int writeElement(PreparedStatement st, Object elt, int i, SessionImplementor session) throws HibernateException, SQLException { getElementType().nullSafeSet(st, elt, i, elementColumnIsSettable, session); return i + ArrayHelper.countTrue(elementColumnIsSettable); }
public void nullSafeSet( PreparedStatement st, Object value, int begin, boolean[] settable, SessionImplementor session) throws HibernateException, SQLException { Object[] subvalues = nullSafeGetValues( value, session.getEntityMode() ); int loc = 0; for ( int i = 0; i < propertySpan; i++ ) { int len = propertyTypes[i].getColumnSpan( session.getFactory() ); if (len==1) { if ( settable[loc] ) { propertyTypes[i].nullSafeSet( st, subvalues[i], begin, session ); begin++; } } else { boolean[] subsettable = new boolean[len]; System.arraycopy(settable, loc, subsettable, 0, len); propertyTypes[i].nullSafeSet( st, subvalues[i], begin, subsettable, session ); begin += ArrayHelper.countTrue(subsettable); } loc += len; } }
getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session ); index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow...
System.arraycopy( settable, loc, subsettable, 0, len ); propertyTypes[i].nullSafeSet( st, subvalues[i], begin, subsettable, session ); begin += ArrayHelper.countTrue( subsettable );