Field
Date: 2018-05-06

com.mysql.jdbc

## Class Field

- java.lang.Object
- - com.mysql.jdbc.Field

-     public class Field
      extends java.lang.Object

  Field is a class used to describe fields in a ResultSet

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `defaultValueLength`
    `protected int` | `defaultValueStart`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Field(MySQLConnection conn, byte[] buffer, int databaseNameStart, int databaseNameLength, int tableNameStart, int tableNameLength, int originalTableNameStart, int originalTableNameLength, int nameStart, int nameLength, int originalColumnNameStart, int originalColumnNameLength, long length, int mysqlType, short colFlag, int colDecimals, int defaultValueStart, int defaultValueLength, int charsetIndex)` Constructor used when communicating with 4.1 and newer servers
    `Field(MySQLConnection conn, byte[] buffer, int nameStart, int nameLength, int tableNameStart, int tableNameLength, int length, int mysqlType, short colFlag, int colDecimals)` Constructor used when communicating with pre 4.1 servers
    `Field(java.lang.String tableName, java.lang.String columnName, int jdbcType, int length)` Constructor used by DatabaseMetaData methods.
    `Field(java.lang.String tableName, java.lang.String columnName, int charsetIndex, int jdbcType, int length)` Used by prepared statements to re-use result set data conversion methods when generating bound parmeter retrieval instance for statement interceptors.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCollation()`
    `java.lang.String` | `getColumnLabel()`
    `java.lang.String` | `getDatabaseName()`
    `(package private) int` | `getDecimals()`
    `java.lang.String` | `getEncoding()` Returns the Java encoding (if known) for this field.
    `java.lang.String` | `getFullName()`
    `java.lang.String` | `getFullOriginalName()`
    `long` | `getLength()`
    `int` | `getMaxBytesPerCharacter()`
    `int` | `getMysqlType()`
    `java.lang.String` | `getName()`
    `java.lang.String` | `getNameNoAliases()`
    `java.lang.String` | `getOriginalName()`
    `java.lang.String` | `getOriginalTableName()`
    `int` | `getPrecisionAdjustFactor()` Returns amount of correction that should be applied to the precision value.
    `int` | `getSQLType()`
    `java.lang.String` | `getTable()`
    `java.lang.String` | `getTableName()`
    `java.lang.String` | `getTableNameNoAliases()`
    `protected boolean` | `getvalueNeedsQuoting()`
    `boolean` | `isAutoIncrement()`
    `boolean` | `isBinary()`
    `boolean` | `isBlob()`
    `boolean` | `isMultipleKey()`
    `(package private) boolean` | `isNotNull()`
    `(package private) boolean` | `isOpaqueBinary()`
    `boolean` | `isPrimaryKey()`
    `(package private) boolean` | `isReadOnly()` Is this field _definitely_ not writable?
    `protected boolean` | `isSingleBit()`
    `boolean` | `isUniqueKey()`
    `boolean` | `isUnsigned()`
    `boolean` | `isZeroFill()`
    `void` | `setConnection(MySQLConnection conn)`
    `void` | `setEncoding(java.lang.String javaEncodingName, Connection conn)`
    `(package private) void` | `setMysqlType(int type)`
    `void` | `setUnsigned()`
    `protected void` | `setUseOldNameMetadata(boolean useOldNameMetadata)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### defaultValueLength

          protected int defaultValueLength

    - #### defaultValueStart

          protected int defaultValueStart

  - ### Constructor Detail

    - #### Field

          Field(MySQLConnection conn,
               byte[] buffer,
               int databaseNameStart,
               int databaseNameLength,
               int tableNameStart,
               int tableNameLength,
               int originalTableNameStart,
               int originalTableNameLength,
               int nameStart,
               int nameLength,
               int originalColumnNameStart,
               int originalColumnNameLength,
               long length,
               int mysqlType,
               short colFlag,
               int colDecimals,
               int defaultValueStart,
               int defaultValueLength,
               int charsetIndex)
          throws java.sql.SQLException

      Constructor used when communicating with 4.1 and newer servers
      Throws:
        `java.sql.SQLException`

    - #### Field

          Field(MySQLConnection conn,
               byte[] buffer,
               int nameStart,
               int nameLength,
               int tableNameStart,
               int tableNameLength,
               int length,
               int mysqlType,
               short colFlag,
               int colDecimals)
          throws java.sql.SQLException

      Constructor used when communicating with pre 4.1 servers
      Throws:
        `java.sql.SQLException`

    - #### Field

          Field(java.lang.String tableName,
               java.lang.String columnName,
               int jdbcType,
               int length)

      Constructor used by DatabaseMetaData methods.

    - #### Field

          Field(java.lang.String tableName,
               java.lang.String columnName,
               int charsetIndex,
               int jdbcType,
               int length)

      Used by prepared statements to re-use result set data conversion methods when generating bound parmeter retrieval instance for statement interceptors.
      Parameters:
        `tableName` - not used
        `columnName` - not used
        `charsetIndex` - the MySQL collation/character set index
        `jdbcType` - from java.sql.Types
        `length` - length in characters or bytes (for BINARY data).

  - ### Method Detail

    - #### getEncoding

          public java.lang.String getEncoding()
                                       throws java.sql.SQLException

      Returns the Java encoding (if known) for this field.
      Returns:
        the Java encoding
      Throws:
        `java.sql.SQLException`

    - #### setEncoding

          public void setEncoding(java.lang.String javaEncodingName,
                         Connection conn)
                           throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getCollation

          public java.lang.String getCollation()
                                        throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getColumnLabel

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

      Throws:
        `java.sql.SQLException`

    - #### getDatabaseName

          public java.lang.String getDatabaseName()
                                           throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getDecimals

          int getDecimals()

    - #### getFullName

          public java.lang.String getFullName()
                                       throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getFullOriginalName

          public java.lang.String getFullOriginalName()
                                               throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getLength

          public long getLength()

    - #### getMaxBytesPerCharacter

          public int getMaxBytesPerCharacter()
                                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getMysqlType

          public int getMysqlType()

    - #### getName

          public java.lang.String getName()
                                   throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getNameNoAliases

          public java.lang.String getNameNoAliases()
                                            throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getOriginalName

          public java.lang.String getOriginalName()
                                           throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getOriginalTableName

          public java.lang.String getOriginalTableName()
                                                throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getPrecisionAdjustFactor

          public int getPrecisionAdjustFactor()

      Returns amount of correction that should be applied to the precision value. Different versions of MySQL report different precision values.
      Returns:
        the amount to adjust precision value by.

    - #### getSQLType

          public int getSQLType()

    - #### getTable

          public java.lang.String getTable()
                                    throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getTableName

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

      Throws:
        `java.sql.SQLException`

    - #### getTableNameNoAliases

          public java.lang.String getTableNameNoAliases()
                                                 throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### isAutoIncrement

          public boolean isAutoIncrement()

    - #### isBinary

          public boolean isBinary()

    - #### isBlob

          public boolean isBlob()

    - #### isMultipleKey

          public boolean isMultipleKey()

    - #### isNotNull

          boolean isNotNull()

    - #### isOpaqueBinary

          boolean isOpaqueBinary()
                           throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### isPrimaryKey

          public boolean isPrimaryKey()

    - #### isReadOnly

          boolean isReadOnly()
                       throws java.sql.SQLException

      Is this field _definitely_ not writable?
      Returns:
        true if this field can not be written to in an INSERT/UPDATE statement.
      Throws:
        `java.sql.SQLException`

    - #### isUniqueKey

          public boolean isUniqueKey()

    - #### isUnsigned

          public boolean isUnsigned()

    - #### setUnsigned

          public void setUnsigned()

    - #### isZeroFill

          public boolean isZeroFill()

    - #### setConnection

          public void setConnection(MySQLConnection conn)

    - #### setMysqlType

          void setMysqlType(int type)

    - #### setUseOldNameMetadata

          protected void setUseOldNameMetadata(boolean useOldNameMetadata)

    - #### toString

          public java.lang.String toString()

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

    - #### isSingleBit

          protected boolean isSingleBit()

    - #### getvalueNeedsQuoting

          protected boolean getvalueNeedsQuoting()