home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / ResultSetMetaData.java < prev    next >
Text File  |  1997-05-20  |  7KB  |  227 lines

  1. /*
  2.  * @(#)ResultSetMetaData.java    1.5 97/02/11
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.sql;
  24.  
  25. /**
  26.  * A ResultSetMetaData object can be used to find out about the types 
  27.  * and properties of the columns in a ResultSet.
  28.  */
  29.  
  30. public interface ResultSetMetaData {
  31.  
  32.     /**
  33.      * What's the number of columns in the ResultSet?
  34.      *
  35.      * @return the number
  36.      * @exception SQLException if a database-access error occurs.
  37.      */
  38.     int getColumnCount() throws SQLException;
  39.  
  40.     /**
  41.      * Is the column automatically numbered, thus read-only?
  42.      *
  43.      * @param column the first column is 1, the second is 2, ...
  44.      * @return true if so
  45.      * @exception SQLException if a database-access error occurs.
  46.      */
  47.     boolean isAutoIncrement(int column) throws SQLException;
  48.  
  49.     /**
  50.      * Does a column's case matter?
  51.      *
  52.      * @param column the first column is 1, the second is 2, ...
  53.      * @return true if so
  54.      * @exception SQLException if a database-access error occurs.
  55.      */
  56.     boolean isCaseSensitive(int column) throws SQLException;    
  57.  
  58.     /**
  59.      * Can the column be used in a where clause?
  60.      *
  61.      * @param column the first column is 1, the second is 2, ...
  62.      * @return true if so
  63.      * @exception SQLException if a database-access error occurs.
  64.      */
  65.     boolean isSearchable(int column) throws SQLException;
  66.  
  67.     /**
  68.      * Is the column a cash value?
  69.      *
  70.      * @param column the first column is 1, the second is 2, ...
  71.      * @return true if so
  72.      * @exception SQLException if a database-access error occurs.
  73.      */
  74.     boolean isCurrency(int column) throws SQLException;
  75.  
  76.     /**
  77.      * Can you put a NULL in this column?        
  78.      *
  79.      * @param column the first column is 1, the second is 2, ...
  80.      * @return columnNoNulls, columnNullable or columnNullableUnknown
  81.      * @exception SQLException if a database-access error occurs.
  82.      */
  83.     int isNullable(int column) throws SQLException;
  84.  
  85.     /**
  86.      * Does not allow NULL values.
  87.      */
  88.     int columnNoNulls = 0;
  89.  
  90.     /**
  91.      * Allows NULL values.
  92.      */
  93.     int columnNullable = 1;
  94.  
  95.     /**
  96.      * Nullability unknown.
  97.      */
  98.     int columnNullableUnknown = 2;
  99.  
  100.     /**
  101.      * Is the column a signed number?
  102.      *
  103.      * @param column the first column is 1, the second is 2, ...
  104.      * @return true if so
  105.      * @exception SQLException if a database-access error occurs.
  106.      */
  107.     boolean isSigned(int column) throws SQLException;
  108.  
  109.     /**
  110.      * What's the column's normal max width in chars?
  111.      *
  112.      * @param column the first column is 1, the second is 2, ...
  113.      * @return max width
  114.      * @exception SQLException if a database-access error occurs.
  115.      */
  116.     int getColumnDisplaySize(int column) throws SQLException;
  117.  
  118.     /**
  119.      * What's the suggested column title for use in printouts and
  120.      * displays?
  121.      *
  122.      * @param column the first column is 1, the second is 2, ...
  123.      * @return true if so 
  124.      * @exception SQLException if a database-access error occurs.
  125.      */
  126.     String getColumnLabel(int column) throws SQLException;    
  127.  
  128.     /**
  129.      * What's a column's name?
  130.      *
  131.      * @param column the first column is 1, the second is 2, ...
  132.      * @return column name
  133.      * @exception SQLException if a database-access error occurs.
  134.      */
  135.     String getColumnName(int column) throws SQLException;
  136.  
  137.     /**
  138.      * What's a column's table's schema?
  139.      *
  140.      * @param column the first column is 1, the second is 2, ...
  141.      * @return schema name or "" if not applicable
  142.      * @exception SQLException if a database-access error occurs.
  143.      */
  144.     String getSchemaName(int column) throws SQLException;
  145.  
  146.     /**
  147.      * What's a column's number of decimal digits?
  148.      *
  149.      * @param column the first column is 1, the second is 2, ...
  150.      * @return precision
  151.      * @exception SQLException if a database-access error occurs.
  152.      */
  153.     int getPrecision(int column) throws SQLException;
  154.  
  155.     /**
  156.      * What's a column's number of digits to right of the decimal point?
  157.      *
  158.      * @param column the first column is 1, the second is 2, ...
  159.      * @return scale
  160.      * @exception SQLException if a database-access error occurs.
  161.      */
  162.     int getScale(int column) throws SQLException;    
  163.  
  164.     /**
  165.      * What's a column's table name? 
  166.      *
  167.      * @return table name or "" if not applicable
  168.      * @exception SQLException if a database-access error occurs.
  169.      */
  170.     String getTableName(int column) throws SQLException;
  171.  
  172.     /**
  173.      * What's a column's table's catalog name?
  174.      *
  175.      * @param column the first column is 1, the second is 2, ...
  176.      * @return column name or "" if not applicable.
  177.      * @exception SQLException if a database-access error occurs.
  178.      */
  179.     String getCatalogName(int column) throws SQLException;
  180.  
  181.     /**
  182.      * What's a column's SQL type?
  183.      *
  184.      * @param column the first column is 1, the second is 2, ...
  185.      * @return SQL type
  186.      * @exception SQLException if a database-access error occurs.
  187.      * @see Types
  188.      */
  189.     int getColumnType(int column) throws SQLException;
  190.  
  191.     /**
  192.      * What's a column's data source specific type name?
  193.      *
  194.      * @param column the first column is 1, the second is 2, ...
  195.      * @return type name
  196.      * @exception SQLException if a database-access error occurs.
  197.      */
  198.     String getColumnTypeName(int column) throws SQLException;
  199.  
  200.     /**
  201.      * Is a column definitely not writable?
  202.      *
  203.      * @param column the first column is 1, the second is 2, ...
  204.      * @return true if so
  205.      * @exception SQLException if a database-access error occurs.
  206.      */
  207.     boolean isReadOnly(int column) throws SQLException;
  208.  
  209.     /**
  210.      * Is it possible for a write on the column to succeed?
  211.      *
  212.      * @param column the first column is 1, the second is 2, ...
  213.      * @return true if so
  214.      * @exception SQLException if a database-access error occurs.
  215.      */
  216.     boolean isWritable(int column) throws SQLException;
  217.  
  218.     /**
  219.      * Will a write on the column definitely succeed?    
  220.      *
  221.      * @param column the first column is 1, the second is 2, ...
  222.      * @return true if so
  223.      * @exception SQLException if a database-access error occurs.
  224.      */
  225.     boolean isDefinitelyWritable(int column) throws SQLException;
  226. }
  227.