OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 17 Rev 182
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 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.sql.changer.convert;
14
 package org.openconcerto.sql.changer.convert;
15
 
15
 
16
import static java.util.Collections.singletonList;
16
import static java.util.Collections.singletonList;
-
 
17
 
17
import org.openconcerto.sql.changer.Changer;
18
import org.openconcerto.sql.changer.Changer;
18
import org.openconcerto.sql.model.ConnectionHandlerNoSetup;
19
import org.openconcerto.sql.model.ConnectionHandlerNoSetup;
19
import org.openconcerto.sql.model.DBSystemRoot;
20
import org.openconcerto.sql.model.DBSystemRoot;
20
import org.openconcerto.sql.model.SQLDataSource;
21
import org.openconcerto.sql.model.SQLDataSource;
21
import org.openconcerto.sql.model.SQLSelect;
-
 
22
import org.openconcerto.sql.model.SQLSystem;
22
import org.openconcerto.sql.model.SQLSystem;
23
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.sql.model.SQLTable;
24
import org.openconcerto.sql.model.graph.Link;
24
import org.openconcerto.sql.model.graph.Link;
25
import org.openconcerto.sql.utils.AlterTable;
25
import org.openconcerto.sql.utils.AlterTable;
26
import org.openconcerto.sql.utils.SQLUtils;
26
import org.openconcerto.sql.utils.SQLUtils;
Line 65... Line 65...
65
                                final String dropIndex = new AlterTable(refLink.getSource()).dropForeignConstraint(refLink.getName()).asString();
65
                                final String dropIndex = new AlterTable(refLink.getSource()).dropForeignConstraint(refLink.getName()).asString();
66
                                getStream().println(dropIndex);
66
                                getStream().println(dropIndex);
67
                                getDS().execute(dropIndex);
67
                                getDS().execute(dropIndex);
68
                            }
68
                            }
69
 
69
 
70
                            final String alter = SQLSelect.quote("ALTER TABLE %n CHANGE COLUMN %n %i " + getSyntax().getPrimaryIDDefinitionShort(), t, t.getKey(), newName);
70
                            final String alter = t.getBase().quote("ALTER TABLE %n CHANGE COLUMN %n %i " + getSyntax().getPrimaryIDDefinitionShort(), t, t.getKey(), newName);
71
                            getStream().println(alter);
71
                            getStream().println(alter);
72
                            getDS().execute(alter);
72
                            getDS().execute(alter);
73
                            t.fetchFields();
73
                            t.fetchFields();
74
 
74
 
75
                            for (final Link l : referentLinks) {
75
                            for (final Link l : referentLinks) {