KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > load > ImportResultSetMetaData


1 /*
2
3    Derby - Class org.apache.derby.impl.load.ImportResultSetMetaData
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (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 JavaDoc;
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 JavaDoc[] columnNames;
33   private final int[] columnWidths;
34
35   public ImportResultSetMetaData(int numberOfColumns, String JavaDoc[] columnNames,
36   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 JavaDoc 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     public int getColumnDisplaySize(int column) {
58     if (columnWidths == null)
59        return Limits.DB2_VARCHAR_MAXWIDTH;
60     else
61        return columnWidths[column-1];
62   }
63 }
64
Popular Tags