Skip to content

Commit

Permalink
[CONJ-1065] Resultset.wasNull() wrong return (false) after reading ze…
Browse files Browse the repository at this point in the history
…ro-date
  • Loading branch information
rusher committed Apr 25, 2023
1 parent 2ebdd43 commit 7d24ade
Show file tree
Hide file tree
Showing 66 changed files with 1,566 additions and 1,238 deletions.
57 changes: 33 additions & 24 deletions src/main/java/org/mariadb/jdbc/client/ColumnDecoder.java
Expand Up @@ -9,6 +9,7 @@
import org.mariadb.jdbc.Configuration;
import org.mariadb.jdbc.client.column.UuidColumn;
import org.mariadb.jdbc.client.impl.StandardReadableByteBuf;
import org.mariadb.jdbc.client.util.MutableInt;
import org.mariadb.jdbc.util.constants.ColumnFlags;

public interface ColumnDecoder extends Column {
Expand Down Expand Up @@ -55,7 +56,8 @@ default int getPrecision() {
* @return default Object
* @throws SQLDataException if any decoding error occurs
*/
Object getDefaultText(final Configuration conf, final ReadableByteBuf buf, final int length)
Object getDefaultText(
final Configuration conf, final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
Expand All @@ -67,7 +69,8 @@ Object getDefaultText(final Configuration conf, final ReadableByteBuf buf, final
* @return default Object
* @throws SQLDataException if any decoding error occurs
*/
Object getDefaultBinary(final Configuration conf, final ReadableByteBuf buf, final int length)
Object getDefaultBinary(
final Configuration conf, final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
Expand All @@ -79,7 +82,7 @@ Object getDefaultBinary(final Configuration conf, final ReadableByteBuf buf, fin
* @return String value
* @throws SQLDataException if any decoding error occurs
*/
String decodeStringText(final ReadableByteBuf buf, final int length, final Calendar cal)
String decodeStringText(final ReadableByteBuf buf, final MutableInt length, final Calendar cal)
throws SQLDataException;

/**
Expand All @@ -91,7 +94,7 @@ String decodeStringText(final ReadableByteBuf buf, final int length, final Calen
* @return String value
* @throws SQLDataException if any decoding error occurs
*/
String decodeStringBinary(final ReadableByteBuf buf, final int length, final Calendar cal)
String decodeStringBinary(final ReadableByteBuf buf, final MutableInt length, final Calendar cal)
throws SQLDataException;

/**
Expand All @@ -102,7 +105,7 @@ String decodeStringBinary(final ReadableByteBuf buf, final int length, final Cal
* @return byte value
* @throws SQLDataException if any decoding error occurs
*/
byte decodeByteText(final ReadableByteBuf buf, final int length) throws SQLDataException;
byte decodeByteText(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Return byte binary encoded value
Expand All @@ -112,7 +115,7 @@ String decodeStringBinary(final ReadableByteBuf buf, final int length, final Cal
* @return byte value
* @throws SQLDataException if any decoding error occurs
*/
byte decodeByteBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
byte decodeByteBinary(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Return date text encoded value
Expand All @@ -123,7 +126,7 @@ String decodeStringBinary(final ReadableByteBuf buf, final int length, final Cal
* @return date value
* @throws SQLDataException if any decoding error occurs
*/
Date decodeDateText(final ReadableByteBuf buf, final int length, Calendar cal)
Date decodeDateText(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;

/**
Expand All @@ -135,7 +138,7 @@ Date decodeDateText(final ReadableByteBuf buf, final int length, Calendar cal)
* @return date value
* @throws SQLDataException if any decoding error occurs
*/
Date decodeDateBinary(final ReadableByteBuf buf, final int length, Calendar cal)
Date decodeDateBinary(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;

/**
Expand All @@ -147,7 +150,7 @@ Date decodeDateBinary(final ReadableByteBuf buf, final int length, Calendar cal)
* @return time value
* @throws SQLDataException if any decoding error occurs
*/
Time decodeTimeText(final ReadableByteBuf buf, final int length, Calendar cal)
Time decodeTimeText(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;

/**
Expand All @@ -159,7 +162,7 @@ Time decodeTimeText(final ReadableByteBuf buf, final int length, Calendar cal)
* @return time value
* @throws SQLDataException if any decoding error occurs
*/
Time decodeTimeBinary(final ReadableByteBuf buf, final int length, Calendar cal)
Time decodeTimeBinary(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;

/**
Expand All @@ -171,7 +174,7 @@ Time decodeTimeBinary(final ReadableByteBuf buf, final int length, Calendar cal)
* @return timestamp value
* @throws SQLDataException if any decoding error occurs
*/
Timestamp decodeTimestampText(final ReadableByteBuf buf, final int length, Calendar cal)
Timestamp decodeTimestampText(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;

/**
Expand All @@ -183,7 +186,7 @@ Timestamp decodeTimestampText(final ReadableByteBuf buf, final int length, Calen
* @return timestamp value
* @throws SQLDataException if any decoding error occurs
*/
Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Calendar cal)
Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final MutableInt length, Calendar cal)
throws SQLDataException;
/**
* Return boolean text encoded value
Expand All @@ -193,7 +196,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return boolean value
* @throws SQLDataException if any decoding error occurs
*/
boolean decodeBooleanText(final ReadableByteBuf buf, final int length) throws SQLDataException;
boolean decodeBooleanText(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
* Parse boolean binary encoded value
Expand All @@ -203,7 +207,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return boolean value
* @throws SQLDataException if any decoding error occurs
*/
boolean decodeBooleanBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
boolean decodeBooleanBinary(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;
/**
* Parse short text encoded value
*
Expand All @@ -212,7 +217,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return short value
* @throws SQLDataException if any decoding error occurs
*/
short decodeShortText(final ReadableByteBuf buf, final int length) throws SQLDataException;
short decodeShortText(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;
/**
* Parse short binary encoded value
*
Expand All @@ -221,7 +226,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return short value
* @throws SQLDataException if any decoding error occurs
*/
short decodeShortBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
short decodeShortBinary(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;
/**
* Parse int text encoded value
*
Expand All @@ -230,7 +236,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return int value
* @throws SQLDataException if any decoding error occurs
*/
int decodeIntText(final ReadableByteBuf buf, final int length) throws SQLDataException;
int decodeIntText(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Parse int binary encoded value
Expand All @@ -240,7 +246,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return int value
* @throws SQLDataException if any decoding error occurs
*/
int decodeIntBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
int decodeIntBinary(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Parse long text encoded value
Expand All @@ -250,7 +256,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return long value
* @throws SQLDataException if any decoding error occurs
*/
long decodeLongText(final ReadableByteBuf buf, final int length) throws SQLDataException;
long decodeLongText(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;
/**
* Parse long binary encoded value
*
Expand All @@ -259,7 +265,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return long value
* @throws SQLDataException if any decoding error occurs
*/
long decodeLongBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
long decodeLongBinary(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Parse float text encoded value
Expand All @@ -269,7 +275,7 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return float value
* @throws SQLDataException if any decoding error occurs
*/
float decodeFloatText(final ReadableByteBuf buf, final int length) throws SQLDataException;
float decodeFloatText(final ReadableByteBuf buf, final MutableInt length) throws SQLDataException;

/**
* Parse float binary encoded value
Expand All @@ -279,7 +285,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return float value
* @throws SQLDataException if any decoding error occurs
*/
float decodeFloatBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
float decodeFloatBinary(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
* Parse double text encoded value
Expand All @@ -289,7 +296,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return double value
* @throws SQLDataException if any decoding error occurs
*/
double decodeDoubleText(final ReadableByteBuf buf, final int length) throws SQLDataException;
double decodeDoubleText(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
* Parse double binary encoded value
Expand All @@ -299,7 +307,8 @@ Timestamp decodeTimestampBinary(final ReadableByteBuf buf, final int length, Cal
* @return double value
* @throws SQLDataException if any decoding error occurs
*/
double decodeDoubleBinary(final ReadableByteBuf buf, final int length) throws SQLDataException;
double decodeDoubleBinary(final ReadableByteBuf buf, final MutableInt length)
throws SQLDataException;

/**
* Decode Column from mysql packet
Expand Down

0 comments on commit 7d24ade

Please sign in to comment.