Package com.mysql.cj.protocol.a
Class MysqlTextValueDecoder
java.lang.Object
com.mysql.cj.protocol.a.MysqlTextValueDecoder
- All Implemented Interfaces:
ValueDecoder
public class MysqlTextValueDecoder extends java.lang.Object implements ValueDecoder
Implementation of
ValueDecoder
for the MySQL text protocol. All values will be received as LengthEncodedString values.
Refer to MySQL documentation for format of values as strings.
Numeric values are returned as ASCII (encoding=63/binary).
-
Field Summary
Fields Modifier and Type Field Description static int
DATE_BUF_LEN
Buffer length of MySQL date string: 'YYYY-MM-DD'.static int
MAX_SIGNED_LONG_LEN
Max string length of a signed long = 9223372036854775807 (19+1 for minus sign)static java.util.regex.Pattern
TIME_PTRN
static int
TIME_STR_LEN_MAX_NO_FRAC
Max string length of MySQL time string (with microseconds): '-HHH:MM:SS'.static int
TIME_STR_LEN_MAX_WITH_MICROS
Max string length of MySQL time string (with microseconds): '-HHH:MM:SS.mmmmmm'.static int
TIME_STR_LEN_MIN
Min string length of MySQL time string: 'HH:MM:SS'.static int
TIMESTAMP_STR_LEN_NO_FRAC
String length of MySQL timestamp string (no microseconds): 'YYYY-MM-DD HH:MM:SS'.static int
TIMESTAMP_STR_LEN_WITH_MICROS
Max string length of MySQL timestamp (with microsecs): 'YYYY-MM-DD HH:MM:SS.mmmmmm'.static int
TIMESTAMP_STR_LEN_WITH_NANOS
String length of String timestamp with nanos. -
Constructor Summary
Constructors Constructor Description MysqlTextValueDecoder()
-
Method Summary
Modifier and Type Method Description <T> T
decodeBit(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeByteArray(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)
<T> T
decodeDate(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeDatetime(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)
<T> T
decodeDecimal(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeDouble(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeFloat(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeSet(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)
<T> T
decodeTime(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)
<T> T
decodeTimestamp(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)
<T> T
decodeUInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeUInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeUInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)
<T> T
decodeYear(byte[] bytes, int offset, int length, ValueFactory<T> vf)
static java.math.BigInteger
getBigInteger(byte[] buf, int offset, int length)
static InternalDate
getDate(byte[] bytes, int offset, int length)
static java.lang.Double
getDouble(byte[] bytes, int offset, int length)
static int
getInt(byte[] buf, int offset, int endpos)
static long
getLong(byte[] buf, int offset, int endpos)
static InternalTime
getTime(byte[] bytes, int offset, int length, int scale)
static InternalTimestamp
getTimestamp(byte[] bytes, int offset, int length, int scale)
static boolean
isDate(java.lang.String s)
static boolean
isTime(java.lang.String s)
static boolean
isTimestamp(java.lang.String s)
-
Field Details
-
DATE_BUF_LEN
public static final int DATE_BUF_LENBuffer length of MySQL date string: 'YYYY-MM-DD'.- See Also:
- Constant Field Values
-
TIME_STR_LEN_MIN
public static final int TIME_STR_LEN_MINMin string length of MySQL time string: 'HH:MM:SS'.- See Also:
- Constant Field Values
-
TIME_STR_LEN_MAX_NO_FRAC
public static final int TIME_STR_LEN_MAX_NO_FRACMax string length of MySQL time string (with microseconds): '-HHH:MM:SS'.- See Also:
- Constant Field Values
-
TIME_STR_LEN_MAX_WITH_MICROS
public static final int TIME_STR_LEN_MAX_WITH_MICROSMax string length of MySQL time string (with microseconds): '-HHH:MM:SS.mmmmmm'.- See Also:
- Constant Field Values
-
TIMESTAMP_STR_LEN_NO_FRAC
public static final int TIMESTAMP_STR_LEN_NO_FRACString length of MySQL timestamp string (no microseconds): 'YYYY-MM-DD HH:MM:SS'.- See Also:
- Constant Field Values
-
TIMESTAMP_STR_LEN_WITH_MICROS
public static final int TIMESTAMP_STR_LEN_WITH_MICROSMax string length of MySQL timestamp (with microsecs): 'YYYY-MM-DD HH:MM:SS.mmmmmm'.- See Also:
- Constant Field Values
-
TIMESTAMP_STR_LEN_WITH_NANOS
public static final int TIMESTAMP_STR_LEN_WITH_NANOSString length of String timestamp with nanos. This does not come from MySQL server but we support it via string conversion.- See Also:
- Constant Field Values
-
TIME_PTRN
public static final java.util.regex.Pattern TIME_PTRN -
MAX_SIGNED_LONG_LEN
public static final int MAX_SIGNED_LONG_LENMax string length of a signed long = 9223372036854775807 (19+1 for minus sign)- See Also:
- Constant Field Values
-
-
Constructor Details
-
MysqlTextValueDecoder
public MysqlTextValueDecoder()
-
-
Method Details
-
decodeDate
- Specified by:
decodeDate
in interfaceValueDecoder
-
decodeTime
- Specified by:
decodeTime
in interfaceValueDecoder
-
decodeTimestamp
- Specified by:
decodeTimestamp
in interfaceValueDecoder
-
decodeDatetime
- Specified by:
decodeDatetime
in interfaceValueDecoder
-
decodeUInt1
- Specified by:
decodeUInt1
in interfaceValueDecoder
-
decodeInt1
- Specified by:
decodeInt1
in interfaceValueDecoder
-
decodeUInt2
- Specified by:
decodeUInt2
in interfaceValueDecoder
-
decodeInt2
- Specified by:
decodeInt2
in interfaceValueDecoder
-
decodeUInt4
- Specified by:
decodeUInt4
in interfaceValueDecoder
-
decodeInt4
- Specified by:
decodeInt4
in interfaceValueDecoder
-
decodeUInt8
- Specified by:
decodeUInt8
in interfaceValueDecoder
-
decodeInt8
- Specified by:
decodeInt8
in interfaceValueDecoder
-
decodeFloat
- Specified by:
decodeFloat
in interfaceValueDecoder
-
decodeDouble
- Specified by:
decodeDouble
in interfaceValueDecoder
-
decodeDecimal
- Specified by:
decodeDecimal
in interfaceValueDecoder
-
decodeByteArray
- Specified by:
decodeByteArray
in interfaceValueDecoder
-
decodeBit
- Specified by:
decodeBit
in interfaceValueDecoder
-
decodeSet
- Specified by:
decodeSet
in interfaceValueDecoder
-
decodeYear
- Specified by:
decodeYear
in interfaceValueDecoder
-
getInt
public static int getInt(byte[] buf, int offset, int endpos) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
getLong
public static long getLong(byte[] buf, int offset, int endpos) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
getBigInteger
public static java.math.BigInteger getBigInteger(byte[] buf, int offset, int length) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
getDouble
public static java.lang.Double getDouble(byte[] bytes, int offset, int length) -
isDate
public static boolean isDate(java.lang.String s) -
isTime
public static boolean isTime(java.lang.String s) -
isTimestamp
public static boolean isTimestamp(java.lang.String s) -
getDate
-
getTime
-
getTimestamp
-