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();
|
Calendar getTimeZone();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Calendar to use for Timezone information when reading/writing date.
|
* Return the Calendar to use for Timezone information when reading/writing a time component (date only/time only).
|
||||||
* A 'date' only value has normally no timezone information, but some platforms (like MySQL)
|
* A time component has normally no timezone information, but some platforms (like MySQL) reqire this.
|
||||||
* reqire this.
|
|
||||||
*/
|
*/
|
||||||
default Calendar getDateTimeZone() {
|
default Calendar getTimeComponentTimeZone() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -19,7 +19,7 @@ public class MySqlDataTimeZone implements DataTimeZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Calendar getDateTimeZone() {
|
public Calendar getTimeComponentTimeZone() {
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ public class DataBind implements DataBinder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setDate(java.sql.Date v) throws SQLException {
|
public final void setDate(java.sql.Date v) throws SQLException {
|
||||||
Calendar timeZone = dataTimeZone.getDateTimeZone();
|
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||||
if (timeZone != null) {
|
if (timeZone != null) {
|
||||||
pstmt.setDate(++pos, v, timeZone);
|
pstmt.setDate(++pos, v, timeZone);
|
||||||
} else {
|
} else {
|
||||||
@@ -178,7 +178,7 @@ public class DataBind implements DataBinder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setTime(Time v) throws SQLException {
|
public final void setTime(Time v) throws SQLException {
|
||||||
Calendar timeZone = dataTimeZone.getDateTimeZone();
|
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||||
if (timeZone != null) {
|
if (timeZone != null) {
|
||||||
pstmt.setTime(++pos, v, timeZone);
|
pstmt.setTime(++pos, v, timeZone);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class RsetDataReader implements DataReader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Date getDate() throws SQLException {
|
public final Date getDate() throws SQLException {
|
||||||
Calendar cal = dataTimeZone.getDateTimeZone();
|
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||||
if (cal != null) {
|
if (cal != null) {
|
||||||
return rset.getDate(pos(), cal);
|
return rset.getDate(pos(), cal);
|
||||||
} else {
|
} else {
|
||||||
@@ -156,7 +156,7 @@ public class RsetDataReader implements DataReader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Time getTime() throws SQLException {
|
public final Time getTime() throws SQLException {
|
||||||
Calendar cal = dataTimeZone.getDateTimeZone();
|
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||||
if (cal != null) {
|
if (cal != null) {
|
||||||
return rset.getTime(pos(), cal);
|
return rset.getTime(pos(), cal);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user