Class Field

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

public class Field extends Object
Field is a class used to describe fields in a ResultSet
  • Field Details

    • defaultValueLength

      protected int defaultValueLength
    • defaultValueStart

      protected int defaultValueStart
  • Constructor Details

    • 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 SQLException
      Constructor used when communicating with 4.1 and newer servers
      Throws:
      SQLException
    • Field

      Field(MySQLConnection conn, byte[] buffer, int nameStart, int nameLength, int tableNameStart, int tableNameLength, int length, int mysqlType, short colFlag, int colDecimals) throws SQLException
      Constructor used when communicating with pre 4.1 servers
      Throws:
      SQLException
    • Field

      Field(String tableName, String columnName, int jdbcType, int length)
      Constructor used by DatabaseMetaData methods.
    • Field

      Field(String tableName, 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 Details

    • getEncoding

      public String getEncoding() throws SQLException
      Returns the Java encoding (if known) for this field.
      Returns:
      the Java encoding
      Throws:
      SQLException
    • setEncoding

      public void setEncoding(String javaEncodingName, Connection conn) throws SQLException
      Throws:
      SQLException
    • getCollationIndex

      public int getCollationIndex() throws SQLException
      Throws:
      SQLException
    • getCollation

      public String getCollation() throws SQLException
      Throws:
      SQLException
    • getColumnLabel

      public String getColumnLabel() throws SQLException
      Throws:
      SQLException
    • getDatabaseName

      public String getDatabaseName() throws SQLException
      Throws:
      SQLException
    • getDecimals

      int getDecimals()
    • getFullName

      public String getFullName() throws SQLException
      Throws:
      SQLException
    • getFullOriginalName

      public String getFullOriginalName() throws SQLException
      Throws:
      SQLException
    • getLength

      public long getLength()
    • getMaxBytesPerCharacter

      public int getMaxBytesPerCharacter() throws SQLException
      Throws:
      SQLException
    • getMysqlType

      public int getMysqlType()
    • getName

      public String getName() throws SQLException
      Throws:
      SQLException
    • getNameNoAliases

      public String getNameNoAliases() throws SQLException
      Throws:
      SQLException
    • getOriginalName

      public String getOriginalName() throws SQLException
      Throws:
      SQLException
    • getOriginalTableName

      public String getOriginalTableName() throws SQLException
      Throws:
      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 String getTable() throws SQLException
      Throws:
      SQLException
    • getTableName

      public String getTableName() throws SQLException
      Throws:
      SQLException
    • getTableNameNoAliases

      public String getTableNameNoAliases() throws SQLException
      Throws:
      SQLException
    • isAutoIncrement

      public boolean isAutoIncrement()
    • isBinary

      public boolean isBinary()
    • isBlob

      public boolean isBlob()
    • isMultipleKey

      public boolean isMultipleKey()
    • isNotNull

      boolean isNotNull()
    • isOpaqueBinary

      boolean isOpaqueBinary() throws SQLException
      Throws:
      SQLException
    • isPrimaryKey

      public boolean isPrimaryKey()
    • isReadOnly

      boolean isReadOnly() throws SQLException
      Is this field _definitely_ not writable?
      Returns:
      true if this field can not be written to in an INSERT/UPDATE statement.
      Throws:
      SQLException
    • isUniqueKey

      public boolean isUniqueKey()
    • isUnsigned

      public boolean isUnsigned()
    • setUnsigned

      public void setUnsigned()
    • isZeroFill

      public boolean isZeroFill()
    • isCharsetApplicableType

      public boolean isCharsetApplicableType()
    • setConnection

      public void setConnection(MySQLConnection conn)
    • setMysqlType

      void setMysqlType(int type)
    • setUseOldNameMetadata

      protected void setUseOldNameMetadata(boolean useOldNameMetadata)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isSingleBit

      protected boolean isSingleBit()
    • getvalueNeedsQuoting

      protected boolean getvalueNeedsQuoting()