Home | Previous Page | Next Page   Working With Informix Types > INTERVAL Data Type >

The Interval Class

The com.informix.lang.Interval class is an Informix-specific extension to the JDBC specification from Sun Microsystems. Interval is the base class for the INTERVAL data type. Interval has two subclasses: IntervalYM (for year-month qualifiers) and IntervalDF (for day-time qualifiers). You use these subclasses to create and manipulate INTERVAL data types.

Tip:
Many of the Interval, IntervalYM, and IntervalDF constructors take a Connection object as a parameter. This passes the value of the CLIENT_LOCALE environment variable to the Interval, IntervalYM, or IntervalDF object, which allows the display of localized error messages if an exception is thrown. For more information, see Support for Localized Error Messages.

For information about the string INTERVAL formats in this section, refer to the IBM Informix: Guide to SQL Syntax.

This section discusses many of the methods you can use with the INTERVAL data types. For complete reference information, see the online reference documentation in the directory doc/javadoc/* after you install your software. (The doc directory is a subdirectory of the directory where you installed IBM Informix JDBC Driver.)

Using Variables for Binary Qualifiers

You can use string qualifiers to manipulate INTERVAL data types, but using binary qualifiers results in faster performance. The following variables are defined in the Interval base class and represent the time unit (start and end code) of a field in the binary qualifier. To use these variables, instantiate objects of the IntervalYM and IntervalDF classes, which inherit these variables from the Interval base class.

Variable
Description
TU_YEAR
Time unit for the YEAR qualifier field
TU_MONTH
Time unit for the MONTH qualifier field
TU_DAY
Time unit for the DAY qualifier field
TU_HOUR
Time unit for the HOUR qualifier field
TU_MINUTE
Time unit for the MINUTE qualifier field
TU_SECOND
Time unit for the SECOND qualifier field
TU_FRAC
Time unit for the leading FRACTION qualifier field
TU_F1
Time unit for the ending field of the first position of FRACTION
TU_F2
Time unit for the ending field of the second position of FRACTION
TU_F3
Time unit for the ending field of the third position of FRACTION
TU_F4
Time unit for the ending field of the fourth position of FRACTION
TU_F5
Time unit for the ending field of the fifth position of FRACTION

Using Interval Methods

You can use the Interval methods to extract information about binary qualifiers. To use these methods, instantiate objects of the IntervalYM and IntervalDF classes, which inherit these variables from the Interval base class.

Some of the tasks you can perform and the methods you can use follow:

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]