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 intDATE_BUF_LENBuffer length of MySQL date string: 'YYYY-MM-DD'.static intMAX_SIGNED_LONG_LENMax string length of a signed long = 9223372036854775807 (19+1 for minus sign)static java.util.regex.PatternTIME_PTRNstatic intTIME_STR_LEN_MAX_NO_FRACMax string length of MySQL time string (with microseconds): '-HHH:MM:SS'.static intTIME_STR_LEN_MAX_WITH_MICROSMax string length of MySQL time string (with microseconds): '-HHH:MM:SS.mmmmmm'.static intTIME_STR_LEN_MINMin string length of MySQL time string: 'HH:MM:SS'.static intTIMESTAMP_STR_LEN_NO_FRACString length of MySQL timestamp string (no microseconds): 'YYYY-MM-DD HH:MM:SS'.static intTIMESTAMP_STR_LEN_WITH_MICROSMax string length of MySQL timestamp (with microsecs): 'YYYY-MM-DD HH:MM:SS.mmmmmm'.static intTIMESTAMP_STR_LEN_WITH_NANOSString length of String timestamp with nanos. -
Constructor Summary
Constructors Constructor Description MysqlTextValueDecoder() -
Method Summary
Modifier and Type Method Description <T> TdecodeBit(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeByteArray(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)<T> TdecodeDate(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeDatetime(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)<T> TdecodeDecimal(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeDouble(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeFloat(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeSet(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)<T> TdecodeTime(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)<T> TdecodeTimestamp(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)<T> TdecodeUInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeUInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeUInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)<T> TdecodeYear(byte[] bytes, int offset, int length, ValueFactory<T> vf)static java.math.BigIntegergetBigInteger(byte[] buf, int offset, int length)static InternalDategetDate(byte[] bytes, int offset, int length)static java.lang.DoublegetDouble(byte[] bytes, int offset, int length)static intgetInt(byte[] buf, int offset, int endpos)static longgetLong(byte[] buf, int offset, int endpos)static InternalTimegetTime(byte[] bytes, int offset, int length, int scale)static InternalTimestampgetTimestamp(byte[] bytes, int offset, int length, int scale)static booleanisDate(java.lang.String s)static booleanisTime(java.lang.String s)static booleanisTimestamp(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:
decodeDatein interfaceValueDecoder
-
decodeTime
- Specified by:
decodeTimein interfaceValueDecoder
-
decodeTimestamp
- Specified by:
decodeTimestampin interfaceValueDecoder
-
decodeDatetime
- Specified by:
decodeDatetimein interfaceValueDecoder
-
decodeUInt1
- Specified by:
decodeUInt1in interfaceValueDecoder
-
decodeInt1
- Specified by:
decodeInt1in interfaceValueDecoder
-
decodeUInt2
- Specified by:
decodeUInt2in interfaceValueDecoder
-
decodeInt2
- Specified by:
decodeInt2in interfaceValueDecoder
-
decodeUInt4
- Specified by:
decodeUInt4in interfaceValueDecoder
-
decodeInt4
- Specified by:
decodeInt4in interfaceValueDecoder
-
decodeUInt8
- Specified by:
decodeUInt8in interfaceValueDecoder
-
decodeInt8
- Specified by:
decodeInt8in interfaceValueDecoder
-
decodeFloat
- Specified by:
decodeFloatin interfaceValueDecoder
-
decodeDouble
- Specified by:
decodeDoublein interfaceValueDecoder
-
decodeDecimal
- Specified by:
decodeDecimalin interfaceValueDecoder
-
decodeByteArray
- Specified by:
decodeByteArrayin interfaceValueDecoder
-
decodeBit
- Specified by:
decodeBitin interfaceValueDecoder
-
decodeSet
- Specified by:
decodeSetin interfaceValueDecoder
-
decodeYear
- Specified by:
decodeYearin 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
-