OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Rev 182 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
Line 1004... Line 1004...
1004
    static public enum ValueOperation {
1004
    static public enum ValueOperation {
1005
        CONVERT, CHECK, PASS
1005
        CONVERT, CHECK, PASS
1006
    }
1006
    }
1007
 
1007
 
1008
    // TODO support java.time.LocalDateTime in Java 8
1008
    // TODO support java.time.LocalDateTime in Java 8
1009
    static private <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) {
1009
    public static <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) {
1010
        final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest);
1010
        final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest);
1011
        if (conv == null)
1011
        if (conv == null)
1012
            throw new IllegalArgumentException("No convertor to " + dest + " from " + source);
1012
            throw new IllegalArgumentException("No convertor to " + dest + " from " + source);
1013
        assert source == value.getClass();
1013
        assert source == value.getClass();
1014
        @SuppressWarnings("unchecked")
1014
        @SuppressWarnings("unchecked")
Line 2445... Line 2445...
2445
     */
2445
     */
2446
    public static final int insertCount(final SQLTable t, final String sql) throws SQLException {
2446
    public static final int insertCount(final SQLTable t, final String sql) throws SQLException {
2447
        return insert(t, sql, ReturnMode.NO_FIELDS).getCount();
2447
        return insert(t, sql, ReturnMode.NO_FIELDS).getCount();
2448
    }
2448
    }
2449
 
2449
 
2450
    // if scalar is null primary keys aren't fetched
-
 
2451
    private static final Insertion<?> insert(final SQLTable t, final String sql, final ReturnMode mode) throws SQLException {
2450
    private static final Insertion<?> insert(final SQLTable t, final String sql, final ReturnMode mode) throws SQLException {
2452
        return new Inserter(t).insert(sql, mode, true);
2451
        return new Inserter(t).insert(sql, mode, true);
2453
    }
2452
    }
2454
 
2453
 
2455
    /**
2454
    /**