1 /* 2 * Copyright 2002-2005 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.jdbc.support.rowset; 18 19 import org.springframework.jdbc.InvalidResultSetAccessException; 20 21 /** 22 * Meta data interface for Spring's SqlRowSet, 23 * analogous to <code>javax.sql.ResultSetMetaData</code> 24 * 25 * <p>The main difference to the standard JDBC RowSetMetaData is that an SQLException 26 * is never thrown here. This allows a SqlRowSetMetaData to be used without having 27 * to deal with checked exceptions. A SqlRowSetMetaData will throw Spring's 28 * <code>org.springframework.jdbc.InvalidResultSetAccessException</code> 29 * instead (when appropriate). 30 * 31 * @author Thomas Risberg 32 * @since 1.2 33 * @see SqlRowSet#getMetaData 34 * @see java.sql.ResultSetMetaData 35 * @see org.springframework.jdbc.InvalidResultSetAccessException 36 */ 37 public interface SqlRowSetMetaData { 38 39 /** 40 * Retrieves the catalog name of the table that served as the source for the specified column. 41 * @param columnIndex the index of the column 42 * @return the catalog name 43 * @see java.sql.ResultSetMetaData#getCatalogName(int) 44 */ 45 String getCatalogName(int columnIndex) throws InvalidResultSetAccessException; 46 47 /** 48 * Retrieves the fully qualified class that the specified column will be mapped to. 49 * @param columnIndex the index of the column 50 * @return the class name as a String 51 * @see java.sql.ResultSetMetaData#getColumnClassName(int) 52 */ 53 String getColumnClassName(int columnIndex) throws InvalidResultSetAccessException; 54 55 /** 56 * Retrives the number of columns in the RowSet. 57 * @return the number of columns 58 * @see java.sql.ResultSetMetaData#getColumnCount() 59 */ 60 int getColumnCount() throws InvalidResultSetAccessException; 61 62 /** 63 * Return the column names of the table that the result set represents. 64 * @return the column names 65 */ 66 String[] getColumnNames() throws InvalidResultSetAccessException; 67 68 /** 69 * Retrieves the maximum width of the designated column. 70 * @param columnIndex the index of the column 71 * @return the width of the column 72 * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int) 73 */ 74 int getColumnDisplaySize(int columnIndex) throws InvalidResultSetAccessException; 75 76 /** 77 * Retrieve the suggested column title for the column specified. 78 * @param columnIndex the index of the column 79 * @return the column title 80 * @see java.sql.ResultSetMetaData#getColumnLabel(int) 81 */ 82 String getColumnLabel(int columnIndex) throws InvalidResultSetAccessException; 83 84 /** 85 * Retrieve the column name for the indicated column. 86 * @param columnIndex the index of the column 87 * @return the column name 88 * @see java.sql.ResultSetMetaData#getColumnName(int) 89 */ 90 String getColumnName(int columnIndex) throws InvalidResultSetAccessException; 91 92 /** 93 * Retrieve the SQL type code for the indicated column. 94 * @param columnIndex the index of the column 95 * @return the SQL type code 96 * @see java.sql.ResultSetMetaData#getColumnType(int) 97 * @see java.sql.Types 98 */ 99 int getColumnType(int columnIndex) throws InvalidResultSetAccessException; 100 101 /** 102 * Retrieves the DBMS-specific type name for the indicated column. 103 * @param columnIndex the index of the column 104 * @return the type name 105 * @see java.sql.ResultSetMetaData#getColumnTypeName(int) 106 */ 107 String getColumnTypeName(int columnIndex) throws InvalidResultSetAccessException; 108 109 /** 110 * Retrieves the precision for the indicated column. 111 * @param columnIndex the index of the column 112 * @return the precision 113 * @see java.sql.ResultSetMetaData#getPrecision(int) 114 */ 115 int getPrecision(int columnIndex) throws InvalidResultSetAccessException; 116 117 /** 118 * Retrieves the scale of the indicated column. 119 * @param columnIndex the index of the column 120 * @return the scale 121 * @see java.sql.ResultSetMetaData#getScale(int) 122 */ 123 int getScale(int columnIndex) throws InvalidResultSetAccessException; 124 125 /** 126 * Retrieves the schema name of the table that served as the source for the specified column. 127 * @param columnIndex the index of the column 128 * @return the schema name 129 * @see java.sql.ResultSetMetaData#getSchemaName(int) 130 */ 131 String getSchemaName(int columnIndex) throws InvalidResultSetAccessException; 132 133 /** 134 * Retrieves the name of the table that served as the source for the specified column. 135 * @param columnIndex the index of the column 136 * @return the name of the table 137 * @see java.sql.ResultSetMetaData#getTableName(int) 138 */ 139 String getTableName(int columnIndex) throws InvalidResultSetAccessException; 140 141 /** 142 * Indicates whether the case of the designated column is significant. 143 * @param columnIndex the index of the column 144 * @return true if the case sensitive, false otherwise 145 * @see java.sql.ResultSetMetaData#isCaseSensitive(int) 146 */ 147 boolean isCaseSensitive(int columnIndex) throws InvalidResultSetAccessException; 148 149 /** 150 * Indicates whether the designated column contains a currency value. 151 * @param columnIndex the index of the column 152 * @return true if the value is a currency value, false otherwise 153 * @see java.sql.ResultSetMetaData#isCurrency(int) 154 */ 155 boolean isCurrency(int columnIndex) throws InvalidResultSetAccessException; 156 157 /** 158 * Indicates whether the designated column contains a signed number. 159 * @param columnIndex the index of the column 160 * @return true if the column contains a signed number, false otherwise 161 * @see java.sql.ResultSetMetaData#isSigned(int) 162 */ 163 boolean isSigned(int columnIndex) throws InvalidResultSetAccessException; 164 165 } 166