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 277... |
Line 277... |
277 |
|
277 |
|
278 |
public static String catToString(List<? extends ChangeTable<?>> cts, final String r) {
|
278 |
public static String catToString(List<? extends ChangeTable<?>> cts, final String r) {
|
279 |
return cat(cts, new ChangeRootNameTransformer(r), true).get(0);
|
279 |
return cat(cts, new ChangeRootNameTransformer(r), true).get(0);
|
280 |
}
|
280 |
}
|
281 |
|
281 |
|
- |
|
282 |
static public String getForeignColumDefaultValue(final SQLTable foreignTable) {
|
- |
|
283 |
return foreignTable.getKey().getType().toString(foreignTable.getUndefinedIDNumber());
|
- |
|
284 |
}
|
- |
|
285 |
|
282 |
// allow to factor column name from table and FCSpec
|
286 |
// allow to factor column name from table and FCSpec
|
283 |
public static final class ForeignColSpec {
|
287 |
public static final class ForeignColSpec {
|
284 |
|
288 |
|
285 |
static public ForeignColSpec fromCreateTable(SQLCreateTableBase<?> createTable) {
|
289 |
static public ForeignColSpec fromCreateTable(SQLCreateTableBase<?> createTable) {
|
286 |
final List<String> primaryKey = createTable.getPrimaryKey();
|
290 |
final List<String> primaryKey = createTable.getPrimaryKey();
|
Line 294... |
Line 298... |
294 |
}
|
298 |
}
|
295 |
|
299 |
|
296 |
static public ForeignColSpec fromTable(SQLTable foreignTable, final boolean absolute) {
|
300 |
static public ForeignColSpec fromTable(SQLTable foreignTable, final boolean absolute) {
|
297 |
if (foreignTable == null)
|
301 |
if (foreignTable == null)
|
298 |
throw new NullPointerException("null table");
|
302 |
throw new NullPointerException("null table");
|
299 |
final String defaultVal = foreignTable.getKey().getType().toString(foreignTable.getUndefinedIDNumber());
|
303 |
final String defaultVal = getForeignColumDefaultValue(foreignTable);
|
300 |
final SQLName n = absolute ? foreignTable.getSQLName() : new SQLName(foreignTable.getName());
|
304 |
final SQLName n = absolute ? foreignTable.getSQLName() : new SQLName(foreignTable.getName());
|
301 |
return new ForeignColSpec(null, n, foreignTable.getKey().getName(), defaultVal);
|
305 |
return new ForeignColSpec(null, n, foreignTable.getKey().getName(), defaultVal);
|
302 |
}
|
306 |
}
|
303 |
|
307 |
|
304 |
private String fk;
|
308 |
private String fk;
|