public enum MysqlType extends Enum<MysqlType> implements SQLType
Enum Constant and Description |
---|
BIGINT
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer.
|
BIGINT_UNSIGNED
BIGINT[(M)] UNSIGNED [ZEROFILL]
|
BINARY
BINARY(M)
The BINARY type is similar to the CHAR type, but stores binary byte strings rather than nonbinary character strings.
|
BIT
BIT[(M)]
A bit-field type.
|
BLOB
BLOB[(M)]
A BLOB column with a maximum length of 65,535 (216 - 1) bytes.
|
BOOLEAN
BOOL, BOOLEAN
These types are synonyms for TINYINT(1).
|
CHAR
[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]
A fixed-length string that is always right-padded with spaces to the specified length when stored.
|
DATE
DATE
A date.
|
DATETIME
DATETIME[(fsp)]
A date and time combination.
|
DECIMAL
DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]
A packed "exact" fixed-point number.
|
DECIMAL_UNSIGNED
DECIMAL[(M[,D])] UNSIGNED [ZEROFILL]
|
DOUBLE
DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]
A normal-size (double-precision) floating-point number.
|
DOUBLE_UNSIGNED
DOUBLE[(M,D)] UNSIGNED [ZEROFILL]
|
ENUM
ENUM('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]
An enumeration.
|
FLOAT
FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]
A small (single-precision) floating-point number.
|
FLOAT_UNSIGNED
FLOAT[(M,D)] UNSIGNED [ZEROFILL]
|
GEOMETRY
Top class for Spatial Data Types
Protocol: FIELD_TYPE_GEOMETRY = 255
|
INT
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer.
|
INT_UNSIGNED
INT[(M)] UNSIGNED [ZEROFILL]
|
JSON
The size of JSON documents stored in JSON columns is limited to the value of the max_allowed_packet system variable (max value 1073741824).
|
LONGBLOB
LONGBLOB
A BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1) bytes.
|
LONGTEXT
LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1) characters.
|
MEDIUMBLOB
MEDIUMBLOB
A BLOB column with a maximum length of 16,777,215 (224 - 1) bytes.
|
MEDIUMINT
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-sized integer.
|
MEDIUMINT_UNSIGNED
MEDIUMINT[(M)] UNSIGNED [ZEROFILL]
|
MEDIUMTEXT
MEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 16,777,215 (224 - 1) characters.
|
NULL
FIELD_TYPE_NULL = 6
|
SET
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]
A set.
|
SMALLINT
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer.
|
SMALLINT_UNSIGNED
SMALLINT[(M)] UNSIGNED [ZEROFILL]
|
TEXT
TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 65,535 (216 - 1) characters.
|
TIME
TIME[(fsp)]
A time.
|
TIMESTAMP
TIMESTAMP[(fsp)]
A timestamp.
|
TINYBLOB
TINYBLOB
A BLOB column with a maximum length of 255 (28 - 1) bytes.
|
TINYINT
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer.
|
TINYINT_UNSIGNED
TINYINT[(M)] UNSIGNED [ZEROFILL]
|
TINYTEXT
TINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]
A TEXT column with a maximum length of 255 (28 - 1) characters.
|
UNKNOWN
Fall-back type for those MySQL data types which Connector/J cannot recognize.
|
VARBINARY
VARBINARY(M)
The VARBINARY type is similar to the VARCHAR type, but stores binary byte strings rather than nonbinary
character strings.
|
VARCHAR
[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name]
A variable-length string.
|
VECTOR
VECTOR[(M)]
A VECTOR column with a maximum length of 65,532 (16383 x 4) bytes.
|
YEAR
YEAR[(4)]
A year in four-digit format.
|
Modifier and Type | Method and Description |
---|---|
static MysqlType |
getByJdbcType(int jdbcType) |
static MysqlType |
getByName(String fullMysqlTypeName)
Get MysqlType matching the full MySQL type name, for example "DECIMAL(5,3) UNSIGNED ZEROFILL".
|
String |
getClassName() |
String |
getCreateParams() |
int |
getJdbcType() |
String |
getName() |
Long |
getPrecision()
The PRECISION column represents the maximum column size that the server supports for the given datatype.
|
String |
getVendor() |
Integer |
getVendorTypeNumber() |
boolean |
isAllowed(int flag) |
boolean |
isDecimal()
Checks if the MySQL Type is a Decimal/Number Type
|
static boolean |
isSigned(MysqlType type) |
static boolean |
supportsConvert(int fromType,
int toType)
Is CONVERT between the given SQL types supported?
|
static MysqlType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MysqlType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MysqlType DECIMAL
public static final MysqlType DECIMAL_UNSIGNED
DECIMAL
public static final MysqlType TINYINT
public static final MysqlType TINYINT_UNSIGNED
TINYINT
public static final MysqlType BOOLEAN
public static final MysqlType SMALLINT
public static final MysqlType SMALLINT_UNSIGNED
SMALLINT
public static final MysqlType INT
public static final MysqlType FLOAT
public static final MysqlType FLOAT_UNSIGNED
FLOAT
public static final MysqlType DOUBLE
public static final MysqlType DOUBLE_UNSIGNED
DOUBLE
public static final MysqlType NULL
public static final MysqlType TIMESTAMP
public static final MysqlType BIGINT
public static final MysqlType BIGINT_UNSIGNED
BIGINT
public static final MysqlType MEDIUMINT
public static final MysqlType MEDIUMINT_UNSIGNED
MEDIUMINT
public static final MysqlType DATE
public static final MysqlType TIME
public static final MysqlType DATETIME
public static final MysqlType YEAR
public static final MysqlType VARCHAR
public static final MysqlType VARBINARY
public static final MysqlType BIT
public static final MysqlType JSON
public static final MysqlType ENUM
public static final MysqlType SET
public static final MysqlType TINYBLOB
public static final MysqlType TINYTEXT
public static final MysqlType MEDIUMBLOB
public static final MysqlType MEDIUMTEXT
public static final MysqlType LONGBLOB
public static final MysqlType LONGTEXT
public static final MysqlType BLOB
public static final MysqlType TEXT
public static final MysqlType CHAR
public static final MysqlType BINARY
public static final MysqlType GEOMETRY
public static final MysqlType VECTOR
public static final MysqlType UNKNOWN
private final String name
protected int jdbcType
protected final Class<?> javaClass
private final int flagsMask
private final boolean isDecimal
private final Long precision
private final String createParams
public static final int FIELD_FLAG_NOT_NULL
public static final int FIELD_FLAG_PRIMARY_KEY
public static final int FIELD_FLAG_UNIQUE_KEY
public static final int FIELD_FLAG_MULTIPLE_KEY
public static final int FIELD_FLAG_BLOB
public static final int FIELD_FLAG_UNSIGNED
public static final int FIELD_FLAG_ZEROFILL
public static final int FIELD_FLAG_BINARY
public static final int FIELD_FLAG_AUTO_INCREMENT
private static final boolean IS_DECIMAL
private static final boolean IS_NOT_DECIMAL
public static final int FIELD_TYPE_DECIMAL
public static final int FIELD_TYPE_TINY
public static final int FIELD_TYPE_SHORT
public static final int FIELD_TYPE_LONG
public static final int FIELD_TYPE_FLOAT
public static final int FIELD_TYPE_DOUBLE
public static final int FIELD_TYPE_NULL
public static final int FIELD_TYPE_TIMESTAMP
public static final int FIELD_TYPE_LONGLONG
public static final int FIELD_TYPE_INT24
public static final int FIELD_TYPE_DATE
public static final int FIELD_TYPE_TIME
public static final int FIELD_TYPE_DATETIME
public static final int FIELD_TYPE_YEAR
public static final int FIELD_TYPE_VARCHAR
public static final int FIELD_TYPE_BIT
public static final int FIELD_TYPE_VECTOR
public static final int FIELD_TYPE_JSON
public static final int FIELD_TYPE_NEWDECIMAL
public static final int FIELD_TYPE_ENUM
public static final int FIELD_TYPE_SET
public static final int FIELD_TYPE_TINY_BLOB
public static final int FIELD_TYPE_MEDIUM_BLOB
public static final int FIELD_TYPE_LONG_BLOB
public static final int FIELD_TYPE_BLOB
public static final int FIELD_TYPE_VAR_STRING
public static final int FIELD_TYPE_STRING
public static final int FIELD_TYPE_GEOMETRY
public static MysqlType[] values()
for (MysqlType c : MysqlType.values()) System.out.println(c);
public static MysqlType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static MysqlType getByName(String fullMysqlTypeName)
fullMysqlTypeName
- full MySQL type namepublic static MysqlType getByJdbcType(int jdbcType)
public static boolean supportsConvert(int fromType, int toType)
fromType
- the type to convert fromtoType
- the type to convert toTypes
public static boolean isSigned(MysqlType type)
public int getJdbcType()
public boolean isAllowed(int flag)
public String getClassName()
public boolean isDecimal()
public Long getPrecision()
public String getCreateParams()
public Integer getVendorTypeNumber()
getVendorTypeNumber
in interface SQLType