use of org.hsqldb_voltpatches.types.TimeData in project voltdb by VoltDB.
the class JDBCCallableStatement method getTime.
/**
* <!-- start generic documentation -->
*
* Retrieves the value of the designated JDBC <code>TIME</code> parameter as a
* <code>java.sql.Time</code> object, using
* the given <code>Calendar</code> object
* to construct the time.
* With a <code>Calendar</code> object, the driver
* can calculate the time taking into account a custom timezone and locale.
* If no <code>Calendar</code> object is specified, the driver uses the
* default timezone and locale.
*
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB supports this feature. <p>
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2,
* and so on
* @param cal the <code>Calendar</code> object the driver will use
* to construct the time
* @return the parameter value; if the value is SQL <code>NULL</code>, the result
* is <code>null</code>.
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see #setTime
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized Time getTime(int parameterIndex, Calendar cal) throws SQLException {
TimeData t = (TimeData) getColumnInType(parameterIndex, Type.SQL_TIME);
if (t == null) {
return null;
}
long millis = t.getSeconds() * 1000;
if (parameterTypes[--parameterIndex].isDateTimeTypeWithZone()) {
} else {
// UTC - calZO == (UTC - sessZO) + (sessionZO - calZO)
if (cal != null) {
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
millis += session.getZoneSeconds() * 1000 - zoneOffset;
}
}
return new Time(millis);
}
Aggregations