Time is stored as two ints. The first int represents hour, minute, second and the second represents fractional seconds (currently 0 since we don't support time precision) encodedTime = -1 indicates null PERFORMANCE OPTIMIZATION: The java.sql.Time object is only instantiated on demand for performance reasons.
| Modifier and Type | Field and Description |
|---|---|
| private static final String[] | |
| private static final char[] | |
| private static final int | |
| private int | |
| private int | |
| private static final char[] | |
| private static final char | |
| private static final char[] | |
| pack-priv static final char | |
| private static final char[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| private | |
| public | SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder)
Construct a time from a string. |
| public | SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal)
Construct a time from a string. |
| Modifier and Type | Method and Description |
|---|---|
| public DataValueDescriptor | cloneValue(boolean
any streams representing the data value will
be materialized if forceMaterialization)true, the data value will be kept as a
stream if possible if falseImplements org. Clone this DataValueDescriptor. |
| public int | compare(DataValueDescriptor
The Orderable to compare this one to. other)Implements org. Orderable interface |
| public boolean | compare(int
Orderable.ORDER_OP_EQUALS means do an = comparison.
Orderable.ORDER_OP_LESSTHAN means compare this < other.
Orderable.ORDER_OP_LESSOREQUALS means compare this <= other. op, DataValueDescriptor The DataValueDescriptor to compare this one to. other, boolean True means to treat nulls as ordered values,
that is, treat SQL null as equal to null, and less
than all other values.
False means to treat nulls as unknown values,
that is, the result of any comparison with a null
is the UNKNOWN truth value. orderedNulls, boolean The return value to use if the result of the
comparison is the UNKNOWN truth value. In other
words, if orderedNulls is false, and a null is
involved in the comparison, return unknownRV.
This parameter is not used orderedNulls is true. unknownRV)Overrides org. Implements org. Compare this Orderable with a given Orderable for the purpose of qualification and sorting. |
| pack-priv static int | Returns: encoded timecalendar with time set cal)Calculate the encoded time from a Calendar object encoded time is hour << 16 + min << 8 + sec this function is also used by SQLTimestamp |
| pack-priv static int | |
| private int | computeEncodedTime(Date value)
Compute encoded time value Time is represented by hour << 16 + minute << 8 + seconds |
| pack-priv static int | |
| protected static String | Returns: string value.Get the String version from the encodedTime. |
| public int | estimateMemoryUsage()
Implements org. Estimate the memory usage in bytes of the data value and the overhead of the class. |
| public NumberDataValue | getDate(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the day of the month. |
| pack-priv int | |
| protected static int | Returns: hour valueGet the encoded hour value (may be different than hour value for current timezone if value encoded in a different timezone) |
| public NumberDataValue | getHours(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the hour of the day out of a time or timestamp. |
| public int | getLength()
Implements org. Gets the length of the data value. |
| protected static int | Returns: minute valueGet the encoded minute value (may be different than the minute value for current timezone if value encoded in a different timezone) |
| public NumberDataValue | getMinutes(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the minute of the hour out of a time or timestamp. |
| public NumberDataValue | getMonth(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the month number out of a date. |
| public DataValueDescriptor | getNewNull()
Implements org. Get a new null value of the same type as this data value. |
| public Object | getObject()
Overrides org. Implements org. Gets the value in the data value descriptor as a Java Object. |
| protected static int | Returns: second valueGet the encoded second value (may be different than the second value for current timezone if value encoded in a different timezone) |
| public NumberDataValue | getSeconds(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the second of the minute out of a time or timestamp. |
| public String | getString()
Implements org. Gets the value in the data value descriptor as a String. |
| public Time | Returns: The localized time value.calendar for object creation cal)Overrides org. Implements org. Get the time value Since this is a JDBC object we use the JDBC definition we use the JDBC definition, see JDBC API Tutorial and Reference section 47.3.12 Date is set to Jan. |
| pack-priv static Time | |
| public Timestamp | getTimestamp(Calendar
calendar for object creation cal)Overrides org. Implements org. Convert a SQL TIME to a JDBC java.sql.Timestamp. |
| public int | getTypeFormatId()
Implements org. Return my format identifier. |
| public String | getTypeName()
Implements org. Get the SQL name of the datatype |
| public NumberDataValue | getYear(NumberDataValue
The result of the previous call to this method, null
if not called yet. result)Implements org. Get the year number out of a date. |
| public int | |
| public final boolean | Returns: Whether or not value is logically null.Implements org. Check if the value is null. |
| pack-priv NumberDataValue | |
| private void | |
| private void | |
| public void | readExternal(ObjectInput
the stream to read data from in order to restore the object in)Implements java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. |
| public void | restoreToNull()
Implements org. Restore this object to its (SQL)null value. |
| protected void | setFrom(DataValueDescriptor
The DataValueDescriptor that holds the value to
which we want to set this DataValueDescriptor's value. theValue)Overrides org. Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor. |
| public void | setInto(PreparedStatement ps, int position)
Overrides org. Implements org. Adding this method to ensure that super class' setInto method doesn't get called that leads to the violation of JDBC spec( untyped nulls ) when batching is turned on. |
| pack-priv void | setObject(Object theValue)
Overrides org. Set the value from a correctly typed Time object. |
| pack-priv static void | setTimeInCalendar(Calendar cal, int encodedTime)
Set the time portion of a date-time value into the passed in Calendar object from its encodedTime value. |
| public void | setValue(Time
The Time value to set this DataValueDescriptor to value, Calendar The time zone from the calendar is used to construct the database time value cal)Overrides org. Implements org. Set the value of this DataValueDescriptor. |
| public void | setValue(Timestamp
The Timestamp value to set this DataValueDescriptor to value, Calendar The time zone from the calendar is used to construct the database timestamp value cal)Overrides org. Implements org. Set the value of this DataValueDescriptor. |
| public void | setValue(String
The String value to set this DataValueDescriptor to theValue)Overrides org. Implements org. Set the value of this DataValueDescriptor. |
| public void | setValueFromResultSet(ResultSet
The specified ResultSet. resultSet, int The 1-based column # into the resultSet. colNumber, boolean Whether or not the column is nullable
(No need to call wasNull() if not) isNullable)Implements org. Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet. |
| public DateTimeDataValue | Returns: startTime + intervalCount intervals, as a timestampOne of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,
DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL intervalType, NumberDataValue The number of intervals to add intervalCount, Date Used to convert time to timestamp currentDate, DateTimeDataValue If non-null a DateTimeDataValue that can be used to hold the result. If null then
generate a new holder resultHolder)Implements org. Add a number of intervals to a datetime value. |
| public NumberDataValue | Returns: the number of intervals by which this datetime is greater than time1One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,
DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL intervalType, DateTimeDataValue time1, Date Used to convert time to timestamp currentDate, NumberDataValue If non-null a NumberDataValue that can be used to hold the result. If null then
generate a new holder resultHolder)Implements org. Finds the difference between two datetime values as a number of intervals. |
| pack-priv static void | timeToString(int hour, int minute, int second, StringBuffer
The resulting string is appended to this StringBuffer sb)Convert a time to a JDBC escape format string |
| public String | |
| private SQLTimestamp | |
| public int | typePrecedence()
Overrides org. Implements org. Each built-in type in JSQL has a precedence. |
| public void | writeExternal(ObjectOutput
the stream to write the object to out)Implements java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays. |