jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java
author chegar
Mon, 18 Aug 2014 10:59:36 +0100
changeset 25991 e48157b42439
parent 25976 jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java@4de01a56e3ee
parent 25859 jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java@3317bb8137f4
child 27259 8dc38c3bad7e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
     2
 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sql.rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.lang.reflect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Provides implementations for the methods that set and get
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * metadata information about a <code>RowSet</code> object's columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * A <code>RowSetMetaDataImpl</code> object keeps track of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * number of columns in the rowset and maintains an internal array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * of column attributes for each column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * A <code>RowSet</code> object creates a <code>RowSetMetaDataImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * object internally in order to set and retrieve information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * its columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * NOTE: All metadata in a <code>RowSetMetaDataImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * should be considered as unavailable until the <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * that it describes is populated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Therefore, any <code>RowSetMetaDataImpl</code> method that retrieves information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * is defined as having unspecified behavior when it is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * before the <code>RowSet</code> object contains data.
24968
3308660aa3f2 8046389: Add missing @since tag under javax.sql.**
henryjen
parents: 23010
diff changeset
    51
 *
3308660aa3f2 8046389: Add missing @since tag under javax.sql.**
henryjen
parents: 23010
diff changeset
    52
 * @since 1.5
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
public class RowSetMetaDataImpl implements RowSetMetaData,  Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * The number of columns in the <code>RowSet</code> object that created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * this <code>RowSetMetaDataImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private int colCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * An array of <code>ColInfo</code> objects used to store information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * about each column in the <code>RowSet</code> object for which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * this <code>RowSetMetaDataImpl</code> object was created. The first
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * <code>ColInfo</code> object in this array contains information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * the first column in the <code>RowSet</code> object, the second element
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * contains information about the second column, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private ColInfo[] colInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Checks to see that the designated column is a valid column number for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * the <code>RowSet</code> object for which this <code>RowSetMetaDataImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * was created. To be valid, a column number must be greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * <code>0</code> and less than or equal to the number of columns in a row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @throws <code>SQLException</code> with the message "Invalid column index"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *        if the given column number is out of the range of valid column
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *        numbers for the <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private void checkColRange(int col) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        if (col <= 0 || col > colCount) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            throw new SQLException("Invalid column index :"+col);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Checks to see that the given SQL type is a valid column type and throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * <code>SQLException</code> object if it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * To be valid, a SQL type must be one of the constant values
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * in the <code><a href="../../sql/Types.html">java.sql.Types</a></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @param SQLType an <code>int</code> defined in the class <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @throws SQLException if the given <code>int</code> is not a constant defined in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *         class <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    private void checkColType(int SQLType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        try {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9257
diff changeset
   102
            Class<?> c = java.sql.Types.class;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            Field[] publicFields = c.getFields();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            int fieldValue = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            for (int i = 0; i < publicFields.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                fieldValue = publicFields[i].getInt(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                if (fieldValue == SQLType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                 }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            throw new SQLException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        throw new SQLException("Invalid SQL type for column");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Sets to the given number the number of columns in the <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * object for which this <code>RowSetMetaDataImpl</code> object was created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param columnCount an <code>int</code> giving the number of columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *        <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @throws SQLException if the given number is equal to or less than zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public void setColumnCount(int columnCount) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if (columnCount <= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            throw new SQLException("Invalid column count. Cannot be less " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                "or equal to zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
       colCount = columnCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
       // If the colCount is Integer.MAX_VALUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
       // we do not initialize the colInfo object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
       // even if we try to initialize the colCount with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
       // colCount = Integer.MAx_VALUE-1, the colInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
       // initialization fails throwing an ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
       // OutOfMemory Exception. So we do not initialize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
       // colInfo at Integer.MAX_VALUE. This is to pass TCK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
       if(!(colCount == Integer.MAX_VALUE)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            colInfo = new ColInfo[colCount + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
           for (int i=1; i <= colCount; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                 colInfo[i] = new ColInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Sets whether the designated column is automatically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * numbered, thus read-only, to the given <code>boolean</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *        must be between <code>1</code> and the number of columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *        in the rowset, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @param property <code>true</code> if the given column is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *                 automatically incremented; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *                 otherwise
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 14342
diff changeset
   164
     * @throws SQLException if a database access error occurs or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *         the given index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public void setAutoIncrement(int columnIndex, boolean property) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        colInfo[columnIndex].autoIncrement = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * Sets whether the name of the designated column is case sensitive to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * the given <code>boolean</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *        must be between <code>1</code> and the number of columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *        in the rowset, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @param property <code>true</code> to indicate that the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *                 name is case sensitive; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @throws SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *         the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public void setCaseSensitive(int columnIndex, boolean property) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        colInfo[columnIndex].caseSensitive = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Sets whether a value stored in the designated column can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * in a <code>WHERE</code> clause to the given <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *                    must be between <code>1</code> and the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *                    of columns in the rowset, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param property <code>true</code> to indicate that a column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *                 value can be used in a <code>WHERE</code> clause;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *                 <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 14342
diff changeset
   200
     * @throws SQLException if a database access error occurs or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     *         the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public void setSearchable(int columnIndex, boolean property)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        colInfo[columnIndex].searchable = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * Sets whether a value stored in the designated column is a cash
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * value to the given <code>boolean</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * must be between <code>1</code> and the number of columns,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * inclusive between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @param property true if the value is a cash value; false otherwise.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 14342
diff changeset
   217
     * @throws SQLException if a database access error occurs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public void setCurrency(int columnIndex, boolean property)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        colInfo[columnIndex].currency = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * Sets whether a value stored in the designated column can be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * to <code>NULL</code> to the given constant from the interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * <code>ResultSetMetaData</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @param property one of the following <code>ResultSetMetaData</code> constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *                 <code>columnNoNulls</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *                 <code>columnNullable</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *                 <code>columnNullableUnknown</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     *
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 14342
diff changeset
   238
     * @throws SQLException if a database access error occurs,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     *         the given column number is out of bounds, or the value supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *         for the <i>property</i> parameter is not one of the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *         constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *           <code>ResultSetMetaData.columnNoNulls</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *           <code>ResultSetMetaData.columnNullable</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *           <code>ResultSetMetaData.columnNullableUnknown</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public void setNullable(int columnIndex, int property) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if ((property < ResultSetMetaData.columnNoNulls) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            property > ResultSetMetaData.columnNullableUnknown) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                throw new SQLException("Invalid nullable constant set. Must be " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                    "either columnNoNulls, columnNullable or columnNullableUnknown");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        colInfo[columnIndex].nullable = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * Sets whether a value stored in the designated column is a signed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * number to the given <code>boolean</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @param property <code>true</code> to indicate that a column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *                 value is a signed number;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *                 <code>false</code> to indicate that it is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public void setSigned(int columnIndex, boolean property) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        colInfo[columnIndex].signed = property;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Sets the normal maximum number of chars in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * to the given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @param size the maximum size of the column in chars; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *        <code>0</code> or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *        the given column number is out of bounds, or <i>size</i> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *        less than <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    public void setColumnDisplaySize(int columnIndex, int size) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        if (size < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            throw new SQLException("Invalid column display size. Cannot be less " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                "than zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        colInfo[columnIndex].columnDisplaySize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Sets the suggested column label for use in printouts and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * displays, if any, to <i>label</i>. If <i>label</i> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * <code>null</code>, the column label is set to an empty string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * ("").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @param label the column label to be used in printouts and displays; if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     *        column label is <code>null</code>, an empty <code>String</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *        set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     *         or the given column index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public void setColumnLabel(int columnIndex, String label) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        if (label != null) {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   311
            colInfo[columnIndex].columnLabel = label;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        } else {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   313
            colInfo[columnIndex].columnLabel = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * Sets the column name of the designated column to the given name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *      must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @param columnName a <code>String</code> object indicating the column name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *      if the given name is <code>null</code>, an empty <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     *      is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @throws SQLException if a database access error occurs or the given column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *      index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public void setColumnName(int columnIndex, String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        if (columnName != null) {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   331
            colInfo[columnIndex].columnName = columnName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        } else {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   333
            colInfo[columnIndex].columnName = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * Sets the designated column's table's schema name, if any, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * <i>schemaName</i>. If <i>schemaName</i> is <code>null</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * the schema name is set to an empty string ("").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @param schemaName the schema name for the table from which a value in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     *        designated column was derived; may be an empty <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *        or <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *        or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    public void setSchemaName(int columnIndex, String schemaName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        if (schemaName != null ) {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   353
            colInfo[columnIndex].schemaName = schemaName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        } else {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   355
            colInfo[columnIndex].schemaName = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * Sets the total number of decimal digits in a value stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * designated column to the given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param precision the total number of decimal digits; must be <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *        or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *         <i>columnIndex</i> is out of bounds, or <i>precision</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *         is less than <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    public void setPrecision(int columnIndex, int precision) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        if (precision < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            throw new SQLException("Invalid precision value. Cannot be less " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                "than zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        colInfo[columnIndex].colPrecision = precision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * Sets the number of digits to the right of the decimal point in a value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * stored in the designated column to the given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * @param scale the number of digits to the right of the decimal point; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     *        zero or greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     *         <i>columnIndex</i> is out of bounds, or <i>scale</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *         is less than <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public void setScale(int columnIndex, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        if (scale < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            throw new SQLException("Invalid scale size. Cannot be less " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                "than zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        colInfo[columnIndex].colScale = scale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * Sets the name of the table from which the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * was derived to the given table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * @param tableName the column's table name; may be <code>null</code> or an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     *        empty string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    public void setTableName(int columnIndex, String tableName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        if (tableName != null) {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   416
            colInfo[columnIndex].tableName = tableName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        } else {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   418
            colInfo[columnIndex].tableName = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * Sets the catalog name of the table from which the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * column was derived to <i>catalogName</i>. If <i>catalogName</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * is <code>null</code>, the catalog name is set to an empty string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * @param catalogName the column's table's catalog name; if the catalogName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     *        is <code>null</code>, an empty <code>String</code> is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    public void setCatalogName(int columnIndex, String catalogName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        if (catalogName != null)
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   437
            colInfo[columnIndex].catName = catalogName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        else
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   439
            colInfo[columnIndex].catName = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * Sets the SQL type code for values stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * to the given type code from the class <code>java.sql.Types</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @param SQLType the designated column's SQL type, which must be one of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *                constants in the class <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     *         the given column number is out of bounds, or the column type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     *         specified is not one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     *         <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * @see java.sql.Types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    public void setColumnType(int columnIndex, int SQLType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        // examine java.sql.Type reflectively, loop on the fields and check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        // this. Separate out into a private method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        checkColType(SQLType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        colInfo[columnIndex].colType = SQLType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * Sets the type name used by the data source for values stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * designated column to the given type name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * @param typeName the data source-specific type name; if <i>typeName</i> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     *        <code>null</code>, an empty <code>String</code> is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    public void setColumnTypeName(int columnIndex, String typeName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        if (typeName != null) {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   479
            colInfo[columnIndex].colTypeName = typeName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        } else {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   481
            colInfo[columnIndex].colTypeName = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * Retrieves the number of columns in the <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * for which this <code>RowSetMetaDataImpl</code> object was created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * @return the number of columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * @throws SQLException if an error occurs determining the column count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    public int getColumnCount() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        return colCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * Retrieves whether a value stored in the designated column is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * automatically numbered, and thus readonly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     *         must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * @return <code>true</code> if the column is automatically numbered;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    public boolean isAutoIncrement(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        return colInfo[columnIndex].autoIncrement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * Indicates whether the case of the designated column's name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * matters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * @return <code>true</code> if the column name is case sensitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *          <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    public boolean isCaseSensitive(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        return colInfo[columnIndex].caseSensitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     * Indicates whether a value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * can be used in a <code>WHERE</code> clause.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * @return <code>true</code> if a value in the designated column can be used in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     *         <code>WHERE</code> clause; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    public boolean isSearchable(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        return colInfo[columnIndex].searchable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * Indicates whether a value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * is a cash value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * @return <code>true</code> if a value in the designated column is a cash value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    public boolean isCurrency(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        return colInfo[columnIndex].currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * Retrieves a constant indicating whether it is possible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * to store a <code>NULL</code> value in the designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * @return a constant from the <code>ResultSetMetaData</code> interface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     *         either <code>columnNoNulls</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     *         <code>columnNullable</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     *         <code>columnNullableUnknown</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    public int isNullable(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        return colInfo[columnIndex].nullable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * Indicates whether a value stored in the designated column is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * a signed number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     *        must be between <code>1</code> and the number of columns, inclusive
23006
7cb4567eb213 8023022: Some more typos in javadoc
igerasim
parents: 18156
diff changeset
   584
     * @return <code>true</code> if a value in the designated column is a signed
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     *         number; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    public boolean isSigned(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        return colInfo[columnIndex].signed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * Retrieves the normal maximum width in chars of the designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * @return the maximum number of chars that can be displayed in the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     *         column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    public int getColumnDisplaySize(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        return colInfo[columnIndex].columnDisplaySize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    /**
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
   610
     * Retrieves the suggested column title for the designated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * column for use in printouts and displays.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * @return the suggested column name to use in printouts and displays
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
    public String getColumnLabel(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
        return colInfo[columnIndex].columnLabel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * Retrieves the name of the designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * @return the column name of the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    public String getColumnName(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        return colInfo[columnIndex].columnName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * Retrieves the schema name of the table from which the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * in the designated column was derived.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     *         must be between <code>1</code> and the number of columns,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     *         inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * @return the schema name or an empty <code>String</code> if no schema
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     *         name is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
    public String getSchemaName(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        String str ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        if(colInfo[columnIndex].schemaName == null){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
              str = colInfo[columnIndex].schemaName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        return str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * Retrieves the total number of digits for values stored in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     * the designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * @return the precision for values stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
    public int getPrecision(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
        return colInfo[columnIndex].colPrecision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * Retrieves the number of digits to the right of the decimal point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * for values stored in the designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * @return the scale for values stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
    public int getScale(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        return colInfo[columnIndex].colScale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * Retrieves the name of the table from which the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * in the designated column was derived.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * @return the table name or an empty <code>String</code> if no table name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     *         is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    public String getTableName(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        return colInfo[columnIndex].tableName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * Retrieves the catalog name of the table from which the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * in the designated column was derived.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * @return the catalog name of the column's table or an empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     *         <code>String</code> if no catalog name is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    public String getCatalogName(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
        String str ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
        if(colInfo[columnIndex].catName == null){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
           str = colInfo[columnIndex].catName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        return str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * Retrieves the type code (one of the <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * constants) for the SQL type of the value stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * @return an <code>int</code> representing the SQL type of values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * @see java.sql.Types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
    public int getColumnType(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
        return colInfo[columnIndex].colType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     * Retrieves the DBMS-specific type name for values stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * designated column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * @return the type name used by the data source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
    public String getColumnTypeName(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
        return colInfo[columnIndex].colTypeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * Indicates whether the designated column is definitely
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * not writable, thus readonly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * @return <code>true</code> if this <code>RowSet</code> object is read-Only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * and thus not updatable; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    public boolean isReadOnly(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
        return colInfo[columnIndex].readOnly;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * Indicates whether it is possible for a write operation on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * the designated column to succeed. A return value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * <code>true</code> means that a write operation may or may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * not succeed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     *         must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * @return <code>true</code> if a write operation on the designated column may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     *          will succeed; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    public boolean isWritable(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
        checkColRange(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
        return colInfo[columnIndex].writable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * Indicates whether a write operation on the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * will definitely succeed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * @return <code>true</code> if a write operation on the designated column will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     *         definitely succeed; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
    public  boolean isDefinitelyWritable(int columnIndex)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
        throws SQLException { return true;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     * Retrieves the fully-qualified name of the class in the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * programming language to which a value in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * will be mapped.  For example, if the value is an <code>int</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * the class name returned by this method will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * <code>java.lang.Integer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * If the value in the designated column has a custom mapping,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * this method returns the name of the class that implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * <code>SQLData</code>. When the method <code>ResultSet.getObject</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * is called to retrieve a value from the designated column, it will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * create an instance of this class or one of its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * @param columnIndex the first column is 1, the second is 2, and so on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     *        must be between <code>1</code> and the number of columns, inclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * @return the fully-qualified name of the class in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     *        language that would be used by the method <code>RowSet.getObject</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     *        retrieve the value in the specified column. This is the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     *        name used for custom mapping when there is a custom mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     *         or the given column number is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
    public String getColumnClassName(int columnIndex) throws SQLException {
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   832
        String className = String.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
        int sqlType = getColumnType(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
        switch (sqlType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
        case Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
        case Types.DECIMAL:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   840
            className = java.math.BigDecimal.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
        case Types.BIT:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   844
            className = java.lang.Boolean.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
        case Types.TINYINT:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   848
            className = java.lang.Byte.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
        case Types.SMALLINT:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   852
            className = java.lang.Short.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        case Types.INTEGER:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   856
            className = java.lang.Integer.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
        case Types.BIGINT:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   860
            className = java.lang.Long.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
        case Types.REAL:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   864
            className = java.lang.Float.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
        case Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        case Types.DOUBLE:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   869
            className = java.lang.Double.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        case Types.BINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
        case Types.VARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
        case Types.LONGVARBINARY:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   875
            className = "byte[]";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
        case Types.DATE:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   879
            className = java.sql.Date.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
        case Types.TIME:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   883
            className = java.sql.Time.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
        case Types.TIMESTAMP:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   887
            className = java.sql.Timestamp.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
        case Types.BLOB:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   891
            className = java.sql.Blob.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
        case Types.CLOB:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   895
            className = java.sql.Clob.class.getName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
        return className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * Returns an object that implements the given interface to allow access to non-standard methods,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * or standard methods not exposed by the proxy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     * The result may be either the object found to implement the interface or a proxy for that object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * If the receiver implements the interface then that is the object. If the receiver is a wrapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * and the wrapped object implements the interface then that is the object. Otherwise the object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     *  the result of calling <code>unwrap</code> recursively on the wrapped object. If the receiver is not a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     * wrapper and does not implement the interface, then an <code>SQLException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     * @param iface A Class defining an interface that the result must implement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     * @return an object that implements the interface. May be a proxy for the actual implementing object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * @throws java.sql.SQLException If no object found that implements the interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
    public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   917
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   918
        if(isWrapperFor(iface)) {
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   919
            return iface.cast(this);
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   920
        } else {
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   921
            throw new SQLException("unwrap failed for:"+ iface);
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   922
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * Returns true if this either implements the interface argument or is directly or indirectly a wrapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     * for an object that does. Returns false otherwise. If this implements the interface then return true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     * else if this is a wrapper then return the result of recursively calling <code>isWrapperFor</code> on the wrapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     * object. If this does not implement the interface and is not a wrapper, return false.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * This method should be implemented as a low-cost operation compared to <code>unwrap</code> so that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * callers can use this method to avoid expensive <code>unwrap</code> calls that may fail. If this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * returns true then calling <code>unwrap</code> with the same argument should succeed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * @param interfaces a Class defining an interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * @return true if this implements the interface or directly or indirectly wraps an object that does.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * @throws java.sql.SQLException  if an error occurs while determining whether this is a wrapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * for an object with the given interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * @since 1.6
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   939
     */
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   940
    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6692
diff changeset
   941
        return interfaces.isInstance(this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    static final long serialVersionUID = 6893806403181801867L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    private class ColInfo implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
         * The field that indicates whether the value in this column is a number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
         * that is incremented automatically, which makes the value read-only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
         * <code>true</code> means that the value in this column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
         * is automatically numbered; <code>false</code> means that it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
        public boolean autoIncrement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
         * The field that indicates whether the value in this column is case sensitive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
         * <code>true</code> means that it is; <code>false</code> that it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
        public boolean caseSensitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
         * The field that indicates whether the value in this column is a cash value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
         * <code>true</code> means that it is; <code>false</code> that it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
        public boolean currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
         * The field that indicates whether the value in this column is nullable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
         * The possible values are the <code>ResultSet</code> constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
         * <code>columnNoNulls</code>, <code>columnNullable</code>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
         * <code>columnNullableUnknown</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        public int nullable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
         * The field that indicates whether the value in this column is a signed number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
         * <code>true</code> means that it is; <code>false</code> that it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        public boolean signed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
         * The field that indicates whether the value in this column can be used in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
         * a <code>WHERE</code> clause.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
         * <code>true</code> means that it can; <code>false</code> that it cannot.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
        public boolean searchable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
         * The field that indicates the normal maximum width in characters for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
         * this column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        public int columnDisplaySize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
         * The field that holds the suggested column title for this column, to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
         * used in printing and displays.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        public String columnLabel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
         * The field that holds the name of this column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
        public  String columnName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
         * The field that holds the schema name for the table from which this column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
         * was derived.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
        public String schemaName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
         * The field that holds the precision of the value in this column.  For number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
         * types, the precision is the total number of decimal digits; for character types,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
         * it is the maximum number of characters; for binary types, it is the maximum
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
         * length in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        public int colPrecision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
         * The field that holds the scale (number of digits to the right of the decimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
         * point) of the value in this column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
        public int colScale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
         * The field that holds the name of the table from which this column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
         * was derived.  This value may be the empty string if there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
         * table name, such as when this column is produced by a join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
        public String tableName ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
         * The field that holds the catalog name for the table from which this column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
         * was derived.  If the DBMS does not support catalogs, the value may be the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
         * empty string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
        public String catName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
         * The field that holds the type code from the class <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
         * indicating the type of the value in this column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
        public int colType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
        /**
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
  1076
         * The field that holds the type name used by this particular data source
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
         * for the value stored in this column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
        public String colTypeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
        /**
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
  1084
         * The field that holds the updatability boolean per column of a RowSet
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
        public boolean readOnly = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
         * The field that hold the writable boolean per column of a RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
         *@serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
        public boolean writable = true;
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9257
diff changeset
  1096
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9257
diff changeset
  1097
        static final long serialVersionUID = 5490834817919311283L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
}