mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
refactoring
(cherry picked from commit 43e28c4f5c747cdda2e3547a8db593eab490ceec)
This commit is contained in:
1 parent
c8be59fd95
commit
9c354919e5
4 files changed
+8
-9
No files matched your search
@@ -13,11 +13,10 @@ public interface DataTimeZone {
|
||||
Calendar getTimeZone();
|
||||
|
||||
/**
|
||||
* Return the Calendar to use for Timezone information when reading/writing date.
|
||||
* A 'date' only value has normally no timezone information, but some platforms (like MySQL)
|
||||
* reqire this.
|
||||
* Return the Calendar to use for Timezone information when reading/writing a time component (date only/time only).
|
||||
* A time component has normally no timezone information, but some platforms (like MySQL) reqire this.
|
||||
*/
|
||||
default Calendar getDateTimeZone() {
|
||||
default Calendar getTimeComponentTimeZone() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class MySqlDataTimeZone implements DataTimeZone {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Calendar getDateTimeZone() {
|
||||
public Calendar getTimeComponentTimeZone() {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class DataBind implements DataBinder {
|
||||
|
||||
@Override
|
||||
public final void setDate(java.sql.Date v) throws SQLException {
|
||||
Calendar timeZone = dataTimeZone.getDateTimeZone();
|
||||
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (timeZone != null) {
|
||||
pstmt.setDate(++pos, v, timeZone);
|
||||
} else {
|
||||
@@ -178,7 +178,7 @@ public class DataBind implements DataBinder {
|
||||
|
||||
@Override
|
||||
public final void setTime(Time v) throws SQLException {
|
||||
Calendar timeZone = dataTimeZone.getDateTimeZone();
|
||||
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (timeZone != null) {
|
||||
pstmt.setTime(++pos, v, timeZone);
|
||||
} else {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RsetDataReader implements DataReader {
|
||||
|
||||
@Override
|
||||
public final Date getDate() throws SQLException {
|
||||
Calendar cal = dataTimeZone.getDateTimeZone();
|
||||
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (cal != null) {
|
||||
return rset.getDate(pos(), cal);
|
||||
} else {
|
||||
@@ -156,7 +156,7 @@ public class RsetDataReader implements DataReader {
|
||||
|
||||
@Override
|
||||
public final Time getTime() throws SQLException {
|
||||
Calendar cal = dataTimeZone.getDateTimeZone();
|
||||
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (cal != null) {
|
||||
return rset.getTime(pos(), cal);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user