Class Field
java.lang.Object
com.mysql.jdbc.Field
Field is a class used to describe fields in a ResultSet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected int -
Constructor Summary
ConstructorsConstructorDescriptionField(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 serversField(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 serversConstructor used by DatabaseMetaData methods.Used by prepared statements to re-use result set data conversion methods when generating bound parmeter retrieval instance for statement interceptors. -
Method Summary
Modifier and TypeMethodDescriptionint(package private) intReturns the Java encoding (if known) for this field.longintintgetName()intReturns amount of correction that should be applied to the precision value.intgetTable()protected booleanbooleanbooleanisBinary()booleanisBlob()booleanboolean(package private) boolean(package private) booleanboolean(package private) booleanIs this field _definitely_ not writable?protected booleanbooleanbooleanbooleanvoidsetConnection(MySQLConnection conn) voidsetEncoding(String javaEncodingName, Connection conn) (package private) voidsetMysqlType(int type) voidprotected voidsetUseOldNameMetadata(boolean useOldNameMetadata) toString()
-
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
Used by prepared statements to re-use result set data conversion methods when generating bound parmeter retrieval instance for statement interceptors.- Parameters:
tableName- not usedcolumnName- not usedcharsetIndex- the MySQL collation/character set indexjdbcType- from java.sql.Typeslength- length in characters or bytes (for BINARY data).
-
-
Method Details
-
getEncoding
Returns the Java encoding (if known) for this field.- Returns:
- the Java encoding
- Throws:
SQLException
-
setEncoding
- Throws:
SQLException
-
getCollationIndex
- Throws:
SQLException
-
getCollation
- Throws:
SQLException
-
getColumnLabel
- Throws:
SQLException
-
getDatabaseName
- Throws:
SQLException
-
getDecimals
int getDecimals() -
getFullName
- Throws:
SQLException
-
getFullOriginalName
- Throws:
SQLException
-
getLength
public long getLength() -
getMaxBytesPerCharacter
- Throws:
SQLException
-
getMysqlType
public int getMysqlType() -
getName
- Throws:
SQLException
-
getNameNoAliases
- Throws:
SQLException
-
getOriginalName
- Throws:
SQLException
-
getOriginalTableName
- 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
- Throws:
SQLException
-
getTableName
- Throws:
SQLException
-
getTableNameNoAliases
- Throws:
SQLException
-
isAutoIncrement
public boolean isAutoIncrement() -
isBinary
public boolean isBinary() -
isBlob
public boolean isBlob() -
isMultipleKey
public boolean isMultipleKey() -
isNotNull
boolean isNotNull() -
isOpaqueBinary
- Throws:
SQLException
-
isPrimaryKey
public boolean isPrimaryKey() -
isReadOnly
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
-
setMysqlType
void setMysqlType(int type) -
setUseOldNameMetadata
protected void setUseOldNameMetadata(boolean useOldNameMetadata) -
toString
-
isSingleBit
protected boolean isSingleBit() -
getvalueNeedsQuoting
protected boolean getvalueNeedsQuoting()
-