DateTimeType.java (hsqldb-2.6.0) | : | DateTimeType.java (hsqldb-2.6.1) | ||
---|---|---|---|---|
skipping to change at line 64 | skipping to change at line 64 | |||
import org.hsqldb.SessionInterface; | import org.hsqldb.SessionInterface; | |||
import org.hsqldb.Tokens; | import org.hsqldb.Tokens; | |||
import org.hsqldb.error.Error; | import org.hsqldb.error.Error; | |||
import org.hsqldb.error.ErrorCode; | import org.hsqldb.error.ErrorCode; | |||
import org.hsqldb.lib.StringConverter; | import org.hsqldb.lib.StringConverter; | |||
/** | /** | |||
* Type subclass for DATE, TIME and TIMESTAMP.<p> | * Type subclass for DATE, TIME and TIMESTAMP.<p> | |||
* | * | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.6.0 | * @version 2.6.1 | |||
* @since 1.9.0 | * @since 1.9.0 | |||
*/ | */ | |||
public final class DateTimeType extends DTIType { | public final class DateTimeType extends DTIType { | |||
public final boolean withTimeZone; | public final boolean withTimeZone; | |||
private String nameString; | private String nameString; | |||
public static final long epochSeconds = | public static final long epochSeconds = | |||
HsqlDateTime.getDateSeconds("1-01-01"); | HsqlDateTime.getDateSeconds("1-01-01"); | |||
public static final TimestampData epochTimestamp = | public static final TimestampData epochTimestamp = | |||
new TimestampData(epochSeconds); | new TimestampData(epochSeconds); | |||
skipping to change at line 772 | skipping to change at line 772 | |||
- session.getZoneSeconds(); | - session.getZoneSeconds(); | |||
return new TimestampData(seconds, | return new TimestampData(seconds, | |||
scaleNanos(ti.getNanos()), | scaleNanos(ti.getNanos()), | |||
session.getZoneSeconds()); | session.getZoneSeconds()); | |||
} | } | |||
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : | case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : | |||
return convertToTypeLimits(session, a); | return convertToTypeLimits(session, a); | |||
case Types.SQL_TIMESTAMP : { | case Types.SQL_TIMESTAMP : { | |||
if (!(a instanceof TimestampData)) { | ||||
throw Error.error(ErrorCode.X_42561); | ||||
} | ||||
TimestampData ts = (TimestampData) a; | TimestampData ts = (TimestampData) a; | |||
long seconds = ts.getSeconds() | long seconds = ts.getSeconds() | |||
- session.getZoneSeconds(); | - session.getZoneSeconds(); | |||
return new TimestampData(seconds, | return new TimestampData(seconds, | |||
scaleNanos(ts.getNanos()), | scaleNanos(ts.getNanos()), | |||
session.getZoneSeconds()); | session.getZoneSeconds()); | |||
} | } | |||
case Types.SQL_DATE : { | case Types.SQL_DATE : { | |||
if (!(a instanceof TimestampData)) { | ||||
throw Error.error(ErrorCode.X_42561); | ||||
} | ||||
TimestampData ts = (TimestampData) a; | TimestampData ts = (TimestampData) a; | |||
return new TimestampData(ts.getSeconds(), 0, | return new TimestampData(ts.getSeconds(), 0, | |||
session.getZoneSeconds()); | session.getZoneSeconds()); | |||
} | } | |||
default : | default : | |||
throw Error.error(ErrorCode.X_42561); | throw Error.error(ErrorCode.X_42561); | |||
} | } | |||
case Types.SQL_TIMESTAMP : | case Types.SQL_TIMESTAMP : | |||
switch (otherType.typeCode) { | switch (otherType.typeCode) { | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added |