01: /*
02:
03: Derby - Class org.apache.derby.impl.load.ImportResultSetMetaData
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.impl.load;
23:
24: import java.sql.SQLException;
25: import org.apache.derby.vti.VTIMetaDataTemplate;
26:
27: import org.apache.derby.iapi.reference.Limits;
28:
29: class ImportResultSetMetaData extends VTIMetaDataTemplate {
30:
31: private final int numberOfColumns;
32: private final String[] columnNames;
33: private final int[] columnWidths;
34:
35: public ImportResultSetMetaData(int numberOfColumns,
36: String[] columnNames, int[] columnWidths) {
37: this .numberOfColumns = numberOfColumns;
38: this .columnNames = columnNames;
39: this .columnWidths = columnWidths;
40: }
41:
42: public int getColumnCount() {
43: return numberOfColumns;
44: }
45:
46: public String getColumnName(int column) {
47: return columnNames[column - 1];
48: }
49:
50: public int getColumnType(int column) {
51: return java.sql.Types.VARCHAR;
52: }
53:
54: public int isNullable(int column) {
55: return columnNullableUnknown;
56: }
57:
58: public int getColumnDisplaySize(int column) {
59: if (columnWidths == null)
60: return Limits.DB2_VARCHAR_MAXWIDTH;
61: else
62: return columnWidths[column - 1];
63: }
64: }
|