Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
9 |
* language governing permissions and limitations under the License.
|
9 |
* language governing permissions and limitations under the License.
|
Line 20... |
Line 20... |
20 |
import org.openconcerto.utils.CollectionUtils;
|
20 |
import org.openconcerto.utils.CollectionUtils;
|
21 |
import org.openconcerto.utils.Tuple2;
|
21 |
import org.openconcerto.utils.Tuple2;
|
22 |
import org.openconcerto.utils.cc.ITransformer;
|
22 |
import org.openconcerto.utils.cc.ITransformer;
|
23 |
|
23 |
|
24 |
import java.util.ArrayList;
|
24 |
import java.util.ArrayList;
|
- |
|
25 |
import java.util.Arrays;
|
25 |
import java.util.Collection;
|
26 |
import java.util.Collection;
|
26 |
import java.util.Collections;
|
27 |
import java.util.Collections;
|
27 |
import java.util.HashMap;
|
28 |
import java.util.HashMap;
|
28 |
import java.util.HashSet;
|
29 |
import java.util.HashSet;
|
29 |
import java.util.List;
|
30 |
import java.util.List;
|
Line 45... |
Line 46... |
45 |
|
46 |
|
46 |
public static final ArchiveMode UNARCHIVED = ArchiveMode.UNARCHIVED;
|
47 |
public static final ArchiveMode UNARCHIVED = ArchiveMode.UNARCHIVED;
|
47 |
public static final ArchiveMode ARCHIVED = ArchiveMode.ARCHIVED;
|
48 |
public static final ArchiveMode ARCHIVED = ArchiveMode.ARCHIVED;
|
48 |
public static final ArchiveMode BOTH = ArchiveMode.BOTH;
|
49 |
public static final ArchiveMode BOTH = ArchiveMode.BOTH;
|
49 |
|
50 |
|
50 |
/**
|
- |
|
51 |
* Quote %-escaped parameters. %% : %, %s : quoteString, %i : quote, %f : quote(getFullName()),
|
- |
|
52 |
* %n : quote(getName()).
|
- |
|
53 |
*
|
- |
|
54 |
* @param pattern a string with %, eg "SELECT * FROM %n where %f like '%%a%%'".
|
- |
|
55 |
* @param params the parameters, eg [ /TENSION/, |TENSION.LABEL| ].
|
- |
|
56 |
* @return pattern with % replaced, eg SELECT * FROM "TENSION" where "TENSION.LABEL" like '%a%'.
|
- |
|
57 |
*/
|
- |
|
58 |
public static final String quote(final String pattern, final Object... params) {
|
- |
|
59 |
return SQLBase.quoteStd(pattern, params);
|
- |
|
60 |
}
|
- |
|
61 |
|
- |
|
62 |
// [String], eg : [SITE.ID_SITE, AVG(AGE)]
|
51 |
// [String], eg : [SITE.ID_SITE, AVG(AGE)]
|
63 |
private final List<String> select;
|
52 |
private final List<String> select;
|
64 |
// names of columns (explicit aliases and field names), e.g. [ID_SITE, null]
|
53 |
// names of columns (explicit aliases and field names), e.g. [ID_SITE, null]
|
65 |
private final List<String> selectNames;
|
54 |
private final List<String> selectNames;
|
66 |
// e.g. : [|SITE.ID_SITE|], known fields in this select (addRawSelect)
|
55 |
// e.g. : [|SITE.ID_SITE|], known fields in this select (addRawSelect)
|
Line 509... |
Line 498... |
509 |
*/
|
498 |
*/
|
510 |
public SQLSelect addSelect(final FieldRef f) {
|
499 |
public SQLSelect addSelect(final FieldRef f) {
|
511 |
return this.addSelect(f, null);
|
500 |
return this.addSelect(f, null);
|
512 |
}
|
501 |
}
|
513 |
|
502 |
|
- |
|
503 |
public final SQLSelect addAllSelect(final FieldRef... s) {
|
- |
|
504 |
return this.addAllSelect(Arrays.asList(s));
|
- |
|
505 |
}
|
- |
|
506 |
|
514 |
/**
|
507 |
/**
|
515 |
* Permet d'ajouter plusieurs champs.
|
508 |
* Permet d'ajouter plusieurs champs.
|
516 |
*
|
509 |
*
|
517 |
* @param s une collection de FieldRef.
|
510 |
* @param s une collection de FieldRef.
|
518 |
* @return this pour pouvoir chaîner.
|
511 |
* @return this pour pouvoir chaîner.
|