Skip to content

Commit

Permalink
Fix setDate null bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasHafner committed Aug 11, 2024
1 parent a012e2f commit 6e940df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/polypheny/jdbc/types/TypedValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ public static TypedValue fromDate( Date dateValue ) {


public static TypedValue fromDate( Date dateValue, Calendar calendar ) {
if (dateValue == null) {
return fromNull();
}
return fromDate( TypedValueUtils.getDateInCalendar( dateValue, calendar ) );
}

Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/polypheny/jdbc/utils/TypedValueUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static Date getDateFromTimestamp( Timestamp timestamp ) {


public static Date getDateInCalendar( Date date, Calendar calendar ) {
return new Date( getTimeLongInCalendar( date.getTime(), calendar ) );
return new Date( getTimeLongInCalendar(date.getTime() , calendar ) );
}


Expand Down Expand Up @@ -373,19 +373,15 @@ public static TypedValue buildTypedValueFromObject( Object value, int targetSqlT
return buildTypedValueFromCalendar( (Calendar) value, targetSqlType );
}
if ( value instanceof java.util.Date ) {
// requires conversion
return buildTypedValueFromDate( (java.util.Date) value, targetSqlType );
}
if ( value instanceof LocalDate ) {
// requires conversion
return buildTypedValueFromLocalDate( (LocalDate) value, targetSqlType );
}
if ( value instanceof LocalTime ) {
// requires conversion
return buildTypedValueFromLocalTime( (LocalTime) value, targetSqlType );
}
if ( value instanceof LocalDateTime ) {
//requires conversion
return buildTypedValueFromLocalDateTime( (LocalDateTime) value, targetSqlType );
}
if ( value instanceof OffsetTime ) {
Expand Down

0 comments on commit 6e940df

Please sign in to comment.