001: /*
002: * Copyright 2002-2005 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.springframework.jdbc.support.rowset;
018:
019: import org.springframework.jdbc.InvalidResultSetAccessException;
020:
021: /**
022: * Meta data interface for Spring's SqlRowSet,
023: * analogous to <code>javax.sql.ResultSetMetaData</code>
024: *
025: * <p>The main difference to the standard JDBC RowSetMetaData is that an SQLException
026: * is never thrown here. This allows a SqlRowSetMetaData to be used without having
027: * to deal with checked exceptions. A SqlRowSetMetaData will throw Spring's
028: * <code>org.springframework.jdbc.InvalidResultSetAccessException</code>
029: * instead (when appropriate).
030: *
031: * @author Thomas Risberg
032: * @since 1.2
033: * @see SqlRowSet#getMetaData
034: * @see java.sql.ResultSetMetaData
035: * @see org.springframework.jdbc.InvalidResultSetAccessException
036: */
037: public interface SqlRowSetMetaData {
038:
039: /**
040: * Retrieves the catalog name of the table that served as the source for the specified column.
041: * @param columnIndex the index of the column
042: * @return the catalog name
043: * @see java.sql.ResultSetMetaData#getCatalogName(int)
044: */
045: String getCatalogName(int columnIndex)
046: throws InvalidResultSetAccessException;
047:
048: /**
049: * Retrieves the fully qualified class that the specified column will be mapped to.
050: * @param columnIndex the index of the column
051: * @return the class name as a String
052: * @see java.sql.ResultSetMetaData#getColumnClassName(int)
053: */
054: String getColumnClassName(int columnIndex)
055: throws InvalidResultSetAccessException;
056:
057: /**
058: * Retrives the number of columns in the RowSet.
059: * @return the number of columns
060: * @see java.sql.ResultSetMetaData#getColumnCount()
061: */
062: int getColumnCount() throws InvalidResultSetAccessException;
063:
064: /**
065: * Return the column names of the table that the result set represents.
066: * @return the column names
067: */
068: String[] getColumnNames() throws InvalidResultSetAccessException;
069:
070: /**
071: * Retrieves the maximum width of the designated column.
072: * @param columnIndex the index of the column
073: * @return the width of the column
074: * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
075: */
076: int getColumnDisplaySize(int columnIndex)
077: throws InvalidResultSetAccessException;
078:
079: /**
080: * Retrieve the suggested column title for the column specified.
081: * @param columnIndex the index of the column
082: * @return the column title
083: * @see java.sql.ResultSetMetaData#getColumnLabel(int)
084: */
085: String getColumnLabel(int columnIndex)
086: throws InvalidResultSetAccessException;
087:
088: /**
089: * Retrieve the column name for the indicated column.
090: * @param columnIndex the index of the column
091: * @return the column name
092: * @see java.sql.ResultSetMetaData#getColumnName(int)
093: */
094: String getColumnName(int columnIndex)
095: throws InvalidResultSetAccessException;
096:
097: /**
098: * Retrieve the SQL type code for the indicated column.
099: * @param columnIndex the index of the column
100: * @return the SQL type code
101: * @see java.sql.ResultSetMetaData#getColumnType(int)
102: * @see java.sql.Types
103: */
104: int getColumnType(int columnIndex)
105: throws InvalidResultSetAccessException;
106:
107: /**
108: * Retrieves the DBMS-specific type name for the indicated column.
109: * @param columnIndex the index of the column
110: * @return the type name
111: * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
112: */
113: String getColumnTypeName(int columnIndex)
114: throws InvalidResultSetAccessException;
115:
116: /**
117: * Retrieves the precision for the indicated column.
118: * @param columnIndex the index of the column
119: * @return the precision
120: * @see java.sql.ResultSetMetaData#getPrecision(int)
121: */
122: int getPrecision(int columnIndex)
123: throws InvalidResultSetAccessException;
124:
125: /**
126: * Retrieves the scale of the indicated column.
127: * @param columnIndex the index of the column
128: * @return the scale
129: * @see java.sql.ResultSetMetaData#getScale(int)
130: */
131: int getScale(int columnIndex)
132: throws InvalidResultSetAccessException;
133:
134: /**
135: * Retrieves the schema name of the table that served as the source for the specified column.
136: * @param columnIndex the index of the column
137: * @return the schema name
138: * @see java.sql.ResultSetMetaData#getSchemaName(int)
139: */
140: String getSchemaName(int columnIndex)
141: throws InvalidResultSetAccessException;
142:
143: /**
144: * Retrieves the name of the table that served as the source for the specified column.
145: * @param columnIndex the index of the column
146: * @return the name of the table
147: * @see java.sql.ResultSetMetaData#getTableName(int)
148: */
149: String getTableName(int columnIndex)
150: throws InvalidResultSetAccessException;
151:
152: /**
153: * Indicates whether the case of the designated column is significant.
154: * @param columnIndex the index of the column
155: * @return true if the case sensitive, false otherwise
156: * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
157: */
158: boolean isCaseSensitive(int columnIndex)
159: throws InvalidResultSetAccessException;
160:
161: /**
162: * Indicates whether the designated column contains a currency value.
163: * @param columnIndex the index of the column
164: * @return true if the value is a currency value, false otherwise
165: * @see java.sql.ResultSetMetaData#isCurrency(int)
166: */
167: boolean isCurrency(int columnIndex)
168: throws InvalidResultSetAccessException;
169:
170: /**
171: * Indicates whether the designated column contains a signed number.
172: * @param columnIndex the index of the column
173: * @return true if the column contains a signed number, false otherwise
174: * @see java.sql.ResultSetMetaData#isSigned(int)
175: */
176: boolean isSigned(int columnIndex)
177: throws InvalidResultSetAccessException;
178:
179: }
|