home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / sql / ResultSetMetaData.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  7.8 KB  |  242 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)ResultSetMetaData.java    1.15 98/09/25
  3.  * 
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.sql;
  16.  
  17. /**
  18.  * An object that can be used to find out about the types 
  19.  * and properties of the columns in a ResultSet.
  20.  */
  21.  
  22. public interface ResultSetMetaData {
  23.  
  24.     /**
  25.      * Returns the number of columns in this ResultSet.
  26.      *
  27.      * @return the number of columns
  28.      * @exception SQLException if a database access error occurs
  29.      */
  30.     int getColumnCount() throws SQLException;
  31.  
  32.     /**
  33.      * Indicates whether the column is automatically numbered, thus read-only.
  34.      *
  35.      * @param column the first column is 1, the second is 2, ...
  36.      * @return true if so
  37.      * @exception SQLException if a database access error occurs
  38.      */
  39.     boolean isAutoIncrement(int column) throws SQLException;
  40.  
  41.     /**
  42.      * Indicates whether a column's case matters.
  43.      *
  44.      * @param column the first column is 1, the second is 2, ...
  45.      * @return true if so
  46.      * @exception SQLException if a database access error occurs
  47.      */
  48.     boolean isCaseSensitive(int column) throws SQLException;    
  49.  
  50.     /**
  51.      * Indicates whether the column can be used in a where clause.
  52.      *
  53.      * @param column the first column is 1, the second is 2, ...
  54.      * @return true if so
  55.      * @exception SQLException if a database access error occurs
  56.      */
  57.     boolean isSearchable(int column) throws SQLException;
  58.  
  59.     /**
  60.      * Indicates whether the column is a cash value.
  61.      *
  62.      * @param column the first column is 1, the second is 2, ...
  63.      * @return true if so
  64.      * @exception SQLException if a database access error occurs
  65.      */
  66.     boolean isCurrency(int column) throws SQLException;
  67.  
  68.     /**
  69.      * Indicates the nullability of values in the designated column.        
  70.      *
  71.      * @param column the first column is 1, the second is 2, ...
  72.      * @return the nullability status of the given column; one of columnNoNulls,
  73.      *          columnNullable or columnNullableUnknown
  74.      * @exception SQLException if a database access error occurs
  75.      */
  76.     int isNullable(int column) throws SQLException;
  77.  
  78.     /**
  79.      * Column does not allow NULL values.
  80.      */
  81.     int columnNoNulls = 0;
  82.  
  83.     /**
  84.      * Column allows NULL values.
  85.      */
  86.     int columnNullable = 1;
  87.  
  88.     /**
  89.      * Nullability of column values is unknown.
  90.      */
  91.     int columnNullableUnknown = 2;
  92.  
  93.     /**
  94.      * Indicates whether values in the column are signed numbers.
  95.      *
  96.      * @param column the first column is 1, the second is 2, ...
  97.      * @return true if so
  98.      * @exception SQLException if a database access error occurs
  99.      */
  100.     boolean isSigned(int column) throws SQLException;
  101.  
  102.     /**
  103.      * Indicates the column's normal max width in chars.
  104.      *
  105.      * @param column the first column is 1, the second is 2, ...
  106.      * @return the normal maximum number of characters allowed as the width
  107.      *          of the designated column
  108.      * @exception SQLException if a database access error occurs
  109.      */
  110.     int getColumnDisplaySize(int column) throws SQLException;
  111.  
  112.     /**
  113.      * Gets the suggested column title for use in printouts and
  114.      * displays.
  115.      *
  116.      * @param column the first column is 1, the second is 2, ...
  117.      * @return the suggested column title
  118.      * @exception SQLException if a database access error occurs
  119.      */
  120.     String getColumnLabel(int column) throws SQLException;    
  121.  
  122.     /**
  123.      * Gets a column's name.
  124.      *
  125.      * @param column the first column is 1, the second is 2, ...
  126.      * @return column name
  127.      * @exception SQLException if a database access error occurs
  128.      */
  129.     String getColumnName(int column) throws SQLException;
  130.  
  131.     /**
  132.      * Gets a column's table's schema.
  133.      *
  134.      * @param column the first column is 1, the second is 2, ...
  135.      * @return schema name or "" if not applicable
  136.      * @exception SQLException if a database access error occurs
  137.      */
  138.     String getSchemaName(int column) throws SQLException;
  139.  
  140.     /**
  141.      * Gets a column's number of decimal digits.
  142.      *
  143.      * @param column the first column is 1, the second is 2, ...
  144.      * @return precision
  145.      * @exception SQLException if a database access error occurs
  146.      */
  147.     int getPrecision(int column) throws SQLException;
  148.  
  149.     /**
  150.      * Gets a column's number of digits to right of the decimal point.
  151.      *
  152.      * @param column the first column is 1, the second is 2, ...
  153.      * @return scale
  154.      * @exception SQLException if a database access error occurs
  155.      */
  156.     int getScale(int column) throws SQLException;    
  157.  
  158.     /**
  159.      * Gets a column's table name. 
  160.      *
  161.      * @param column the first column is 1, the second is 2, ...
  162.      * @return table name or "" if not applicable
  163.      * @exception SQLException if a database access error occurs
  164.      */
  165.     String getTableName(int column) throws SQLException;
  166.  
  167.     /**
  168.      * Gets a column's table's catalog name.
  169.      *
  170.      * @param column the first column is 1, the second is 2, ...
  171.      * @return column name or "" if not applicable.
  172.      * @exception SQLException if a database access error occurs
  173.      */
  174.     String getCatalogName(int column) throws SQLException;
  175.  
  176.     /**
  177.      * Retrieves a column's SQL type.
  178.      *
  179.      * @param column the first column is 1, the second is 2, ...
  180.      * @return SQL type from java.sql.Types
  181.      * @exception SQLException if a database access error occurs
  182.      * @see Types
  183.      */
  184.     int getColumnType(int column) throws SQLException;
  185.  
  186.     /**
  187.      * Retrieves a column's database-specific type name.
  188.      *
  189.      * @param column the first column is 1, the second is 2, ...
  190.      * @return type name used by the database. If the column type is
  191.      * a user-defined type, then a fully-qualified type name is returned.
  192.      * @exception SQLException if a database access error occurs
  193.      */
  194.     String getColumnTypeName(int column) throws SQLException;
  195.  
  196.     /**
  197.      * Indicates whether a column is definitely not writable.
  198.      *
  199.      * @param column the first column is 1, the second is 2, ...
  200.      * @return true if so
  201.      * @exception SQLException if a database access error occurs
  202.      */
  203.     boolean isReadOnly(int column) throws SQLException;
  204.  
  205.     /**
  206.      * Indicates whether it is possible for a write on the column to succeed.
  207.      *
  208.      * @param column the first column is 1, the second is 2, ...
  209.      * @return true if so
  210.      * @exception SQLException if a database access error occurs
  211.      */
  212.     boolean isWritable(int column) throws SQLException;
  213.  
  214.     /**
  215.      * Indicates whether a write on the column will definitely succeed.    
  216.      *
  217.      * @param column the first column is 1, the second is 2, ...
  218.      * @return true if so
  219.      * @exception SQLException if a database access error occurs
  220.      */
  221.     boolean isDefinitelyWritable(int column) throws SQLException;
  222.  
  223.     //--------------------------JDBC 2.0-----------------------------------
  224.  
  225.     /**
  226.      * JDBC 2.0
  227.      *
  228.      * <p>Returns the fully-qualified name of the Java class whose instances 
  229.      * are manufactured if the method <code>ResultSet.getObject</code>
  230.      * is called to retrieve a value 
  231.      * from the column.  <code>ResultSet.getObject</code> may return a subclass of the
  232.      * class returned by this method.
  233.      *
  234.      * @return the fully-qualified name of the class in the Java programming
  235.      *         language that would be used by the method 
  236.      * <code>ResultSet.getObject</code> to retrieve the value in the specified
  237.      * column. This is the class name used for custom mapping.
  238.      * @exception SQLException if a database access error occurs
  239.      */
  240.     String getColumnClassName(int column) throws SQLException;
  241. }
  242.