## com.mysql.jdbc
Class ResultSetMetaData

    java.lang.Object
      com.mysql.jdbc.ResultSetMetaData

All Implemented Interfaces:
  java.sql.ResultSetMetaData, java.sql.Wrapper

    public class ResultSetMetaData

extends java.lang.Object
implements java.sql.ResultSetMetaData

A ResultSetMetaData object can be used to find out about the types and properties of the columns in a ResultSet

See Also:
  `ResultSetMetaData`

Field Summary
`(package private) Field[]` `fields`
`(package private) boolean` `useOldAliasBehavior`

Fields inherited from interface java.sql.ResultSetMetaData
`columnNoNulls, columnNullable, columnNullableUnknown`

Constructor Summary
`ResultSetMetaData(Field[] fields, boolean useOldAliasBehavior, ExceptionInterceptor exceptionInterceptor)` Initialise for a result with a tuple set and a field descriptor set

Method Summary
`java.lang.String` `getCatalogName(int column)` What's a column's table's catalog name?
`(package private) static java.lang.String` `getClassNameForJavaType(int javaType, boolean isUnsigned, int mysqlTypeIfKnown, boolean isBinaryOrBlob, boolean isOpaqueBinary)`
`java.lang.String` `getColumnCharacterEncoding(int column)` What's the Java character encoding name for the given column?
`java.lang.String` `getColumnCharacterSet(int column)` What's the MySQL character set name for the given column?
`java.lang.String` `getColumnClassName(int column)` JDBC 2.0 Return the fully qualified name of the Java class whose instances are manufactured if ResultSet.getObject() is called to retrieve a value from the column.
`int` `getColumnCount()` Whats the number of columns in the ResultSet?
`int` `getColumnDisplaySize(int column)` What is the column's normal maximum width in characters?
`java.lang.String` `getColumnLabel(int column)` What is the suggested column title for use in printouts and displays?
`java.lang.String` `getColumnName(int column)` What's a column's name?
`int` `getColumnType(int column)` What is a column's SQL Type?
`java.lang.String` `getColumnTypeName(int column)` Whats is the column's data source specific type name?
`protected Field` `getField(int columnIndex)` Returns the field instance for the given column index
`int` `getPrecision(int column)` What is a column's number of decimal digits.
`int` `getScale(int column)` What is a column's number of digits to the right of the decimal point?
`java.lang.String` `getSchemaName(int column)` What is a column's table's schema?
`java.lang.String` `getTableName(int column)` Whats a column's table's name?
`boolean` `isAutoIncrement(int column)` Is the column automatically numbered (and thus read-only)
`boolean` `isCaseSensitive(int column)` Does a column's case matter?
`boolean` `isCurrency(int column)` Is the column a cash value?
`boolean` `isDefinitelyWritable(int column)` Will a write on this column definately succeed?
`int` `isNullable(int column)` Can you put a NULL in this column?
`boolean` `isReadOnly(int column)` Is the column definitely not writable?
`boolean` `isSearchable(int column)` Can the column be used in a WHERE clause?
`boolean` `isSigned(int column)` Is the column a signed number?
`boolean` `isWrapperFor(java.lang.Class<?> iface)` Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.
`boolean` `isWritable(int column)` Is it possible for a write on the column to succeed?
`java.lang.String` `toString()` Returns a string representation of this object
`java.lang.Object` `unwrap(java.lang.Class<?> iface)` Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.sql.Wrapper
`unwrap`

Field Detail

### fields

    Field[] fields

### useOldAliasBehavior

    boolean useOldAliasBehavior

Constructor Detail

### ResultSetMetaData

    public ResultSetMetaData(Field[] fields,
                             boolean useOldAliasBehavior,
                             ExceptionInterceptor exceptionInterceptor)

  Initialise for a result with a tuple set and a field descriptor set

  Parameters:
    `fields` - the array of field descriptors

Method Detail

### getCatalogName

    public java.lang.String getCatalogName(int column)
                                    throws java.sql.SQLException

  What's a column's table's catalog name?

  Specified by:
    `getCatalogName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    catalog name, or "" if not applicable
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getColumnCharacterEncoding

    public java.lang.String getColumnCharacterEncoding(int column)
                                                throws java.sql.SQLException

  What's the Java character encoding name for the given column?

  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the Java character encoding name for the given column, or null if no Java character encoding maps to the MySQL character set for the given column.
  Throws:
    `java.sql.SQLException` - if an invalid column index is given.

### getColumnCharacterSet

    public java.lang.String getColumnCharacterSet(int column)
                                           throws java.sql.SQLException

  What's the MySQL character set name for the given column?

  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the MySQL character set name for the given column
  Throws:
    `java.sql.SQLException` - if an invalid column index is given.

### getColumnClassName

    public java.lang.String getColumnClassName(int column)
                                        throws java.sql.SQLException

  JDBC 2.0

  Return the fully qualified name of the Java class whose instances are manufactured if ResultSet.getObject() is called to retrieve a value from the column. ResultSet.getObject() may return a subClass of the class returned by this method.

  Specified by:
    `getColumnClassName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the column number to retrieve information for
  Returns:
    the fully qualified name of the Java class whose instances are manufactured if ResultSet.getObject() is called to retrieve a value from the column.
  Throws:
    `java.sql.SQLException` - if an error occurs

### getColumnCount

    public int getColumnCount()
                       throws java.sql.SQLException

  Whats the number of columns in the ResultSet?

  Specified by:
    `getColumnCount` in interface `java.sql.ResultSetMetaData`
  Returns:
    the number
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getColumnDisplaySize

    public int getColumnDisplaySize(int column)
                             throws java.sql.SQLException

  What is the column's normal maximum width in characters?

  Specified by:
    `getColumnDisplaySize` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the maximum width
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getColumnLabel

    public java.lang.String getColumnLabel(int column)
                                    throws java.sql.SQLException

  What is the suggested column title for use in printouts and displays?

  Specified by:
    `getColumnLabel` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the column label
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getColumnName

    public java.lang.String getColumnName(int column)
                                   throws java.sql.SQLException

  What's a column's name?

  Specified by:
    `getColumnName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the column name
  Throws:
    `java.sql.SQLException` - if a databvase access error occurs

### getColumnType

    public int getColumnType(int column)
                      throws java.sql.SQLException

  What is a column's SQL Type? (java.sql.Type int)

  Specified by:
    `getColumnType` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the java.sql.Type value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `Types`

### getColumnTypeName

    public java.lang.String getColumnTypeName(int column)
                                       throws java.sql.SQLException

  Whats is the column's data source specific type name?

  Specified by:
    `getColumnTypeName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    the type name
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getField

    protected Field getField(int columnIndex)
                      throws java.sql.SQLException

  Returns the field instance for the given column index

  Parameters:
    `columnIndex` - the column number to retrieve a field instance for
  Returns:
    the field instance for the given column index
  Throws:
    `java.sql.SQLException` - if an error occurs

### getPrecision

    public int getPrecision(int column)
                     throws java.sql.SQLException

  What is a column's number of decimal digits.

  Specified by:
    `getPrecision` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    the precision
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getScale

    public int getScale(int column)
                 throws java.sql.SQLException

  What is a column's number of digits to the right of the decimal point?

  Specified by:
    `getScale` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    the scale
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getSchemaName

    public java.lang.String getSchemaName(int column)
                                   throws java.sql.SQLException

  What is a column's table's schema? This relies on us knowing the table name. The JDBC specification allows us to return "" if this is not applicable.

  Specified by:
    `getSchemaName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    the Schema
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getTableName

    public java.lang.String getTableName(int column)
                                  throws java.sql.SQLException

  Whats a column's table's name?

  Specified by:
    `getTableName` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    column name, or "" if not applicable
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isAutoIncrement

    public boolean isAutoIncrement(int column)
                            throws java.sql.SQLException

  Is the column automatically numbered (and thus read-only)

  Specified by:
    `isAutoIncrement` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isCaseSensitive

    public boolean isCaseSensitive(int column)
                            throws java.sql.SQLException

  Does a column's case matter?

  Specified by:
    `isCaseSensitive` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isCurrency

    public boolean isCurrency(int column)
                       throws java.sql.SQLException

  Is the column a cash value?

  Specified by:
    `isCurrency` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    true if its a cash column
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isDefinitelyWritable

    public boolean isDefinitelyWritable(int column)
                                 throws java.sql.SQLException

  Will a write on this column definately succeed?

  Specified by:
    `isDefinitelyWritable` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc..
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isNullable

    public int isNullable(int column)
                   throws java.sql.SQLException

  Can you put a NULL in this column?

  Specified by:
    `isNullable` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    one of the columnNullable values
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isReadOnly

    public boolean isReadOnly(int column)
                       throws java.sql.SQLException

  Is the column definitely not writable?

  Specified by:
    `isReadOnly` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isSearchable

    public boolean isSearchable(int column)
                         throws java.sql.SQLException

  Can the column be used in a WHERE clause? Basically for this, I split the functions into two types: recognised types (which are always useable), and OTHER types (which may or may not be useable). The OTHER types, for now, I will assume they are useable. We should really query the catalog to see if they are useable.

  Specified by:
    `isSearchable` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    true if they can be used in a WHERE clause
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isSigned

    public boolean isSigned(int column)
                     throws java.sql.SQLException

  Is the column a signed number?

  Specified by:
    `isSigned` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2...
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### isWritable

    public boolean isWritable(int column)
                       throws java.sql.SQLException

  Is it possible for a write on the column to succeed?

  Specified by:
    `isWritable` in interface `java.sql.ResultSetMetaData`
  Parameters:
    `column` - the first column is 1, the second is 2, etc.
  Returns:
    true if so
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### toString

    public java.lang.String toString()

  Returns a string representation of this object

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    ...

### getClassNameForJavaType

    static java.lang.String getClassNameForJavaType(int javaType,
                                                    boolean isUnsigned,
                                                    int mysqlTypeIfKnown,
                                                    boolean isBinaryOrBlob,
                                                    boolean isOpaqueBinary)

### isWrapperFor

    public boolean isWrapperFor(java.lang.Class<?> iface)
                         throws java.sql.SQLException

  Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling `isWrapperFor` on the wrapped object. If this does not implement the interface and is not a wrapper, return false. This method should be implemented as a low-cost operation compared to `unwrap` so that callers can use this method to avoid expensive `unwrap` calls that may fail. If this method returns true then calling `unwrap` with the same argument should succeed.

  Specified by:
    `isWrapperFor` in interface `java.sql.Wrapper`
  Parameters:
    `interfaces` - a Class defining an interface.
  Returns:
    true if this implements the interface or directly or indirectly wraps an object that does.
  Throws:
    `java.sql.SQLException` - if an error occurs while determining whether this is a wrapper for an object with the given interface.
  Since:
    1.6

### unwrap

    public java.lang.Object unwrap(java.lang.Class<?> iface)
                            throws java.sql.SQLException

  Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. The result may be either the object found to implement the interface or a proxy for that object. If the receiver implements the interface then that is the object. If the receiver is a wrapper and the wrapped object implements the interface then that is the object. Otherwise the object is the result of calling `unwrap` recursively on the wrapped object. If the receiver is not a wrapper and does not implement the interface, then an `SQLException` is thrown.

  Parameters:
    `iface` - A Class defining an interface that the result must implement.
  Returns:
    an object that implements the interface. May be a proxy for the actual implementing object.
  Throws:
    `java.sql.SQLException` - If no object found that implements the interface
  Since:
    1.6