This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 154413
Collapse All | Expand All

(-)db.metadata.model/nbproject/project.properties (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
test.unit.cp.extra=\
4
test.unit.cp.extra=\
5
    ${nb_all}/db/external/derby-10.2.2.0.jar:\
5
    ${nb_all}/db/external/derby-10.2.2.0.jar:\
6
    ${nb_all}/db.drivers/external/mysql-connector-java-5.1.18-bin.jar
6
    ${nb_all}/db.drivers/external/mysql-connector-java-5.1.23-bin.jar
7
7
8
test.config.stableBTD.includes=**/*Test.class
8
test.config.stableBTD.includes=**/*Test.class
9
test.config.stableBTD.excludes=\
9
test.config.stableBTD.excludes=\
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/api/Autoincrement.java (+49 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.db.metadata.model.api;
44
45
import java.sql.DatabaseMetaData;
46
47
public enum Autoincrement {
48
    AUTOINCREMENT, NOT_AUTOINCREMENT, UNKNOWN;
49
}
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/api/Column.java (+18 lines)
Lines 71-74 Link Here
71
    public int getPosition() {
71
    public int getPosition() {
72
        return impl.getPosition();
72
        return impl.getPosition();
73
    }
73
    }
74
    
75
    /**
76
     * Return whether this column is generated or not
77
     *
78
     * @return whether this column is generated
79
     */
80
    public Generated getGenerated() {
81
        return impl.getGenerated();
74
}
82
}
83
    
84
    /**
85
     * Return whether this column is autoincrement or not
86
     *
87
     * @return whether this column is autoincrement
88
     */
89
    public Autoincrement getAutoincrement() {
90
        return impl.getAutoincrement();
91
    }
92
}
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/api/Generated.java (+49 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.db.metadata.model.api;
44
45
import java.sql.DatabaseMetaData;
46
47
public enum Generated {
48
    GENERATED, NOT_GENERATED, UNKNOWN;
49
}
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCColumn.java (-1 / +18 lines)
Lines 42-47 Link Here
42
42
43
package org.netbeans.modules.db.metadata.model.jdbc;
43
package org.netbeans.modules.db.metadata.model.jdbc;
44
44
45
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
46
import org.netbeans.modules.db.metadata.model.api.Generated;
45
import org.netbeans.modules.db.metadata.model.api.Nullable;
47
import org.netbeans.modules.db.metadata.model.api.Nullable;
46
import org.netbeans.modules.db.metadata.model.api.SQLType;
48
import org.netbeans.modules.db.metadata.model.api.SQLType;
47
import org.netbeans.modules.db.metadata.model.api.Tuple;
49
import org.netbeans.modules.db.metadata.model.api.Tuple;
Lines 56-66 Link Here
56
    private final Tuple parent;
58
    private final Tuple parent;
57
    private final JDBCValue value;
59
    private final JDBCValue value;
58
    private final int position;
60
    private final int position;
61
    private final Generated generated;
62
    private final Autoincrement autoincrement;
59
63
60
    public JDBCColumn(Tuple parent, int position, JDBCValue value) {
64
    public JDBCColumn(Tuple parent, int position, Generated generated, Autoincrement autoincrement, JDBCValue value) {
61
        this.parent = parent;
65
        this.parent = parent;
62
        this.value = value;
66
        this.value = value;
63
        this.position = position;
67
        this.position = position;
68
        this.generated = generated;
69
        this.autoincrement = autoincrement;
64
    }
70
    }
65
71
66
    public final Tuple getParent() {
72
    public final Tuple getParent() {
Lines 115-118 Link Here
115
    public int getPosition() {
121
    public int getPosition() {
116
        return position;
122
        return position;
117
    }
123
    }
124
125
    @Override
126
    public Autoincrement getAutoincrement() {
127
        return autoincrement;
118
}
128
}
129
130
    @Override
131
    public Generated getGenerated() {
132
        return generated;
133
    }
134
    
135
}
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCFunction.java (-1 / +3 lines)
Lines 51-57 Link Here
51
import java.util.logging.Level;
51
import java.util.logging.Level;
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
53
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
54
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
54
import org.netbeans.modules.db.metadata.model.api.Column;
55
import org.netbeans.modules.db.metadata.model.api.Column;
56
import org.netbeans.modules.db.metadata.model.api.Generated;
55
import org.netbeans.modules.db.metadata.model.api.MetadataException;
57
import org.netbeans.modules.db.metadata.model.api.MetadataException;
56
import org.netbeans.modules.db.metadata.model.api.Parameter;
58
import org.netbeans.modules.db.metadata.model.api.Parameter;
57
import org.netbeans.modules.db.metadata.model.api.Schema;
59
import org.netbeans.modules.db.metadata.model.api.Schema;
Lines 123-129 Link Here
123
    }
125
    }
124
126
125
    protected JDBCColumn createJDBCColumn(int position, ResultSet rs) throws SQLException {
127
    protected JDBCColumn createJDBCColumn(int position, ResultSet rs) throws SQLException {
126
        return new JDBCColumn(this.getFunction(), position, JDBCValue.createFunctionValue(rs, this.getFunction()));
128
        return new JDBCColumn(this.getFunction(), position, Generated.UNKNOWN, Autoincrement.UNKNOWN, JDBCValue.createFunctionValue(rs, this.getFunction()));
127
    }
129
    }
128
130
129
    protected JDBCParameter createJDBCParameter(int position, ResultSet rs) throws SQLException {
131
    protected JDBCParameter createJDBCParameter(int position, ResultSet rs) throws SQLException {
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCProcedure.java (-1 / +3 lines)
Lines 52-58 Link Here
52
import java.util.logging.Level;
52
import java.util.logging.Level;
53
import java.util.logging.Logger;
53
import java.util.logging.Logger;
54
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
54
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
55
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
55
import org.netbeans.modules.db.metadata.model.api.Column;
56
import org.netbeans.modules.db.metadata.model.api.Column;
57
import org.netbeans.modules.db.metadata.model.api.Generated;
56
import org.netbeans.modules.db.metadata.model.api.MetadataException;
58
import org.netbeans.modules.db.metadata.model.api.MetadataException;
57
import org.netbeans.modules.db.metadata.model.api.Parameter;
59
import org.netbeans.modules.db.metadata.model.api.Parameter;
58
import org.netbeans.modules.db.metadata.model.api.Parameter.Direction;
60
import org.netbeans.modules.db.metadata.model.api.Parameter.Direction;
Lines 127-133 Link Here
127
    }
129
    }
128
130
129
    protected JDBCColumn createJDBCColumn(int position, ResultSet rs) throws SQLException {
131
    protected JDBCColumn createJDBCColumn(int position, ResultSet rs) throws SQLException {
130
        return new JDBCColumn(this.getProcedure(), position, JDBCValue.createProcedureValue(rs, this.getProcedure()));
132
        return new JDBCColumn(this.getProcedure(), position, Generated.UNKNOWN, Autoincrement.UNKNOWN, JDBCValue.createProcedureValue(rs, this.getProcedure()));
131
    }
133
    }
132
134
133
    protected JDBCParameter createJDBCParameter(int position, ResultSet rs) throws SQLException {
135
    protected JDBCParameter createJDBCParameter(int position, ResultSet rs) throws SQLException {
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCTable.java (-1 / +21 lines)
Lines 148-160 Link Here
148
    protected JDBCColumn createJDBCColumn(ResultSet rs) throws SQLException {
148
    protected JDBCColumn createJDBCColumn(ResultSet rs) throws SQLException {
149
        int position = 0;
149
        int position = 0;
150
        JDBCValue jdbcValue;
150
        JDBCValue jdbcValue;
151
        Autoincrement autoincrement = Autoincrement.UNKNOWN;
152
        Generated generated = Generated.UNKNOWN;
151
        if (isOdbc(rs)) {
153
        if (isOdbc(rs)) {
152
            jdbcValue = JDBCValue.createTableColumnValueODBC(rs, this.getTable());
154
            jdbcValue = JDBCValue.createTableColumnValueODBC(rs, this.getTable());
153
        } else {
155
        } else {
156
            // Check existence of relevant columns
157
            if (rs.getMetaData().getColumnCount() >= 23) {
158
                String autoincrementString = rs.getString("IS_AUTOINCREMENT");
159
                if ("YES".equalsIgnoreCase(autoincrementString)) {
160
                    autoincrement = Autoincrement.AUTOINCREMENT;
161
                } else if ("NO".equalsIgnoreCase(autoincrementString)) {
162
                    autoincrement = Autoincrement.NOT_AUTOINCREMENT;
163
                }
164
            }
165
            if (rs.getMetaData().getColumnCount() >= 24) {
166
                String generatedcolumnString = rs.getString("IS_GENERATEDCOLUMN");
167
                if ("YES".equalsIgnoreCase(generatedcolumnString)) {
168
                    generated = Generated.GENERATED;
169
                } else if ("NO".equalsIgnoreCase(generatedcolumnString)) {
170
                    generated = Generated.NOT_GENERATED;
171
                }
172
            }
154
            position = rs.getInt("ORDINAL_POSITION");
173
            position = rs.getInt("ORDINAL_POSITION");
155
            jdbcValue = JDBCValue.createTableColumnValue(rs, this.getTable());
174
            jdbcValue = JDBCValue.createTableColumnValue(rs, this.getTable());
156
        }
175
        }
157
        return new JDBCColumn(this.getTable(), position, jdbcValue);
176
177
        return new JDBCColumn(this.getTable(), position, generated, autoincrement, jdbcValue);
158
    }
178
    }
159
179
160
    /** Returns true if this table is under ODBC connection. In such a case
180
    /** Returns true if this table is under ODBC connection. In such a case
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCView.java (-1 / +22 lines)
Lines 51-57 Link Here
51
import java.util.logging.Level;
51
import java.util.logging.Level;
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
53
import org.netbeans.modules.db.metadata.model.MetadataUtilities;
54
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
54
import org.netbeans.modules.db.metadata.model.api.Column;
55
import org.netbeans.modules.db.metadata.model.api.Column;
56
import org.netbeans.modules.db.metadata.model.api.Generated;
55
import org.netbeans.modules.db.metadata.model.api.MetadataException;
57
import org.netbeans.modules.db.metadata.model.api.MetadataException;
56
import org.netbeans.modules.db.metadata.model.api.Schema;
58
import org.netbeans.modules.db.metadata.model.api.Schema;
57
import org.netbeans.modules.db.metadata.model.spi.ViewImplementation;
59
import org.netbeans.modules.db.metadata.model.spi.ViewImplementation;
Lines 99-106 Link Here
99
101
100
    protected JDBCColumn createJDBCColumn(ResultSet rs) throws SQLException {
102
    protected JDBCColumn createJDBCColumn(ResultSet rs) throws SQLException {
101
        int ordinalPosition = rs.getInt("ORDINAL_POSITION");
103
        int ordinalPosition = rs.getInt("ORDINAL_POSITION");
102
        return new JDBCColumn(this.getView(), ordinalPosition, JDBCValue.createTableColumnValue(rs, this.getView()));
104
        Autoincrement autoincrement = Autoincrement.UNKNOWN;
105
        Generated generated = Generated.UNKNOWN;
106
        // Check existence of relevant columns
107
        if( rs.getMetaData().getColumnCount() >= 23 ) {
108
            String autoincrementString = rs.getString("IS_AUTOINCREMENT");
109
            if("YES".equalsIgnoreCase(autoincrementString)) {
110
                autoincrement = Autoincrement.AUTOINCREMENT;
111
            } else if("NO".equalsIgnoreCase(autoincrementString)) {
112
                autoincrement = Autoincrement.NOT_AUTOINCREMENT;
103
    }
113
    }
114
        }
115
        if( rs.getMetaData().getColumnCount() >= 24 ) {
116
            String generatedcolumnString = rs.getString("IS_GENERATEDCOLUMN");
117
            if("YES".equalsIgnoreCase(generatedcolumnString)) {
118
                generated = Generated.GENERATED;
119
            } else if("NO".equalsIgnoreCase(generatedcolumnString)) {
120
                generated = Generated.NOT_GENERATED;
121
            }
122
        }
123
        return new JDBCColumn(this.getView(), ordinalPosition, generated, autoincrement, JDBCValue.createTableColumnValue(rs, this.getView()));
124
    }
104
125
105
    protected void createColumns() {
126
    protected void createColumns() {
106
        Map<String, Column> newColumns = new LinkedHashMap<String, Column>();
127
        Map<String, Column> newColumns = new LinkedHashMap<String, Column>();
(-)db.metadata.model/src/org/netbeans/modules/db/metadata/model/spi/ColumnImplementation.java (+20 lines)
Lines 43-49 Link Here
43
package org.netbeans.modules.db.metadata.model.spi;
43
package org.netbeans.modules.db.metadata.model.spi;
44
44
45
import org.netbeans.modules.db.metadata.model.MetadataAccessor;
45
import org.netbeans.modules.db.metadata.model.MetadataAccessor;
46
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
46
import org.netbeans.modules.db.metadata.model.api.Column;
47
import org.netbeans.modules.db.metadata.model.api.Column;
48
import org.netbeans.modules.db.metadata.model.api.Generated;
47
import org.netbeans.modules.db.metadata.model.api.Tuple;
49
import org.netbeans.modules.db.metadata.model.api.Tuple;
48
50
49
/**
51
/**
Lines 64-67 Link Here
64
    public abstract Tuple getParent();
66
    public abstract Tuple getParent();
65
67
66
    public abstract int getPosition();
68
    public abstract int getPosition();
69
    
70
    /**
71
     * Implementers are expected to override this method,
72
     * for compatibility this gets a dummy implementation
73
     * returning UNKNOWN
74
     */
75
    public Generated getGenerated() {
76
        return Generated.UNKNOWN;
67
}
77
}
78
    
79
    /**
80
     * Implementers are expected to override this method,
81
     * for compatibility this gets a dummy implementation
82
     * returning UNKNOWN
83
     */
84
    public Autoincrement getAutoincrement() {
85
        return Autoincrement.UNKNOWN;
86
    }
87
}
(-)db.metadata.model/test/unit/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCMetadataDerbyTest.java (-1 / +16 lines)
Lines 48-53 Link Here
48
import java.util.Arrays;
48
import java.util.Arrays;
49
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.HashSet;
50
import java.util.HashSet;
51
import static junit.framework.Assert.assertTrue;
52
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
51
import org.netbeans.modules.db.metadata.model.api.Catalog;
53
import org.netbeans.modules.db.metadata.model.api.Catalog;
52
import org.netbeans.modules.db.metadata.model.api.Column;
54
import org.netbeans.modules.db.metadata.model.api.Column;
53
import org.netbeans.modules.db.metadata.model.api.ForeignKey;
55
import org.netbeans.modules.db.metadata.model.api.ForeignKey;
Lines 83-89 Link Here
83
        conn = DriverManager.getConnection("jdbc:derby:" + getWorkDirPath() + "/test;create=true");
85
        conn = DriverManager.getConnection("jdbc:derby:" + getWorkDirPath() + "/test;create=true");
84
        stmt = conn.createStatement();
86
        stmt = conn.createStatement();
85
        stmt.executeUpdate("CREATE TABLE FOO (" +
87
        stmt.executeUpdate("CREATE TABLE FOO (" +
86
                "ID INT NOT NULL, " +
88
                "ID INT NOT NULL GENERATED ALWAYS AS IDENTITY, " +
87
                "FOO_NAME VARCHAR(16), " +
89
                "FOO_NAME VARCHAR(16), " +
88
                "CONSTRAINT FOO_PK PRIMARY KEY (ID, FOO_NAME))");
90
                "CONSTRAINT FOO_PK PRIMARY KEY (ID, FOO_NAME))");
89
        stmt.executeUpdate("CREATE TABLE BAR (" +
91
        stmt.executeUpdate("CREATE TABLE BAR (" +
Lines 281-284 Link Here
281
        assertEquals(col1, pkcols[1]);
283
        assertEquals(col1, pkcols[1]);
282
        assertEquals(col2, pkcols[0]);
284
        assertEquals(col2, pkcols[0]);
283
    }
285
    }
286
287
    public void testAutoincrementDetection() {
288
        Schema schema = metadata.getDefaultSchema();
289
        Table table = schema.getTable("FOO");
290
        assertTrue(table.getColumn("ID").getAutoincrement() == Autoincrement.AUTOINCREMENT);
291
        assertTrue(table.getColumn("FOO_NAME").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
292
        table = schema.getTable("BAR");
293
        assertTrue(table.getColumn("i+d").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
294
        assertTrue(table.getColumn("FOO_ID").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
295
        assertTrue(table.getColumn("FOO_NAME").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
296
        assertTrue(table.getColumn("BAR_NAME").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
297
        assertTrue(table.getColumn("DEC_COL").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
284
}
298
}
299
}
(-)db.metadata.model/test/unit/src/org/netbeans/modules/db/metadata/model/jdbc/JDBCMetadataMySQLTest.java (+20 lines)
Lines 48-53 Link Here
48
import java.util.Arrays;
48
import java.util.Arrays;
49
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.HashSet;
50
import java.util.HashSet;
51
import org.netbeans.modules.db.metadata.model.api.Autoincrement;
51
import org.netbeans.modules.db.metadata.model.api.Catalog;
52
import org.netbeans.modules.db.metadata.model.api.Catalog;
52
import org.netbeans.modules.db.metadata.model.api.Column;
53
import org.netbeans.modules.db.metadata.model.api.Column;
53
import org.netbeans.modules.db.metadata.model.api.ForeignKey;
54
import org.netbeans.modules.db.metadata.model.api.ForeignKey;
Lines 399-402 Link Here
399
        assertEquals(2, col.getScale());
400
        assertEquals(2, col.getScale());
400
        assertEquals("JDBCColumn[name=bar_digit, type=DECIMAL, length=0, precision=12, radix=10, scale=2, nullable=NOT_NULLABLE, ordinal_position=4]", col.toString());
401
        assertEquals("JDBCColumn[name=bar_digit, type=DECIMAL, length=0, precision=12, radix=10, scale=2, nullable=NOT_NULLABLE, ordinal_position=4]", col.toString());
401
    }
402
    }
403
404
    public void testAutoincrementDetection() {
405
        Schema schema = metadata.getDefaultSchema();
406
        Table table = schema.getTable("groucho");
407
        assertTrue(table.getColumn("id").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
408
        assertTrue(table.getColumn("id2").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
409
        table = schema.getTable("foo");
410
        assertTrue(table.getColumn("id").getAutoincrement() == Autoincrement.AUTOINCREMENT);
411
        assertTrue(table.getColumn("FOO_NAME").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
412
        assertTrue(table.getColumn("harpo_id").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
413
        table = schema.getTable("bar");
414
        assertTrue(table.getColumn("i+d").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
415
        assertTrue(table.getColumn("foo_id").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
416
        assertTrue(table.getColumn("bar_name").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
417
        assertTrue(table.getColumn("bar_digit").getAutoincrement() == Autoincrement.NOT_AUTOINCREMENT);
418
        Catalog c = metadata.getCatalog("test2");
419
        table = c.getSyntheticSchema().getTable("harpo");
420
        assertTrue(table.getColumn("id").getAutoincrement() == Autoincrement.AUTOINCREMENT);
402
}
421
}
422
}

Return to bug 154413