OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 25 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 81
Line 55... Line 55...
55
        this.setAll(res);
55
        this.setAll(res);
56
    }
56
    }
57
 
57
 
58
    private final int getCount(SQLElement elem) {
58
    private final int getCount(SQLElement elem) {
59
        if (!this.counts.containsKey(elem)) {
59
        if (!this.counts.containsKey(elem)) {
60
            final SQLSelect sel = new SQLSelect(elem.getTable().getBase());
60
            final SQLSelect sel = new SQLSelect();
61
            sel.addSelectFunctionStar("count");
61
            sel.addSelectFunctionStar("count");
62
            sel.setWhere(new Where(elem.getTable().getField(elem.getParentForeignField()), this.getIds()));
62
            sel.setWhere(new Where(elem.getParentForeignField(), this.getIds()));
63
            final Number count = (Number) elem.getTable().getBase().getDataSource().executeScalar(sel.asString());
63
            final Number count = (Number) elem.getTable().getBase().getDataSource().executeScalar(sel.asString());
64
            this.counts.put(elem, count);
64
            this.counts.put(elem, count);
65
        }
65
        }
66
        return this.counts.get(elem).intValue();
66
        return this.counts.get(elem).intValue();
67
    }
67
    }