DEFINING OBJECT CLASSES TO MATCH CORRESPONDING SPECIALIZED DATA TYPES IN A RELATIONAL DATABASE

A method, apparatus, and article of manufacture for defining object classes to match corresponding specialized data types stored in a relational database. An object-oriented application program may create an instance of a class for the purpose of representing data in a relational table that comprise a specialized data type. The attributes and behavior of the specialized data type in the database are preserved, where appropriate, in the corresponding class, and are available to the application program.

Skip to: Description  ·  Claims  · Patent History  ·  Patent History
Description
BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates generally to computerized methods for accessing databases, and in particular, to a method for defining object classes to match corresponding specialized data types stored in a relational database.

[0003] 2. Description of Related Art

[0004] It is well known in the art to use database management systems, such as IBM's DB2™ relational database management system (RDBMS), to manage computerized databases. Currently, there is a need to access such databases using object-oriented application programs.

[0005] Object-oriented programming has become increasingly popular among software developers, because it offers the benefits of increased application program portability, interoperability, and interchangeability. Object-oriented programming techniques also reduce development risk and software development costs, and can extend the life cycle of the final product to prevent premature obsolescence.

[0006] An industry-consensus standard interface definition for interoperable object-oriented software, known as the Common Object Request Broker Architecture (CORBA), has been defined. CORBA simplifies the development and deployment of distributed systems software in several ways. First, CORBA defines a distributed environment using an object-oriented paradigm that hides differences between programming languages, operating systems, and object locations. Second, CORBA's object-oriented approach allows diverse types of implementations to inter-operate at the same level, hiding idiosyncrasies, and supporting reuse.

[0007] A central component of CORBA is an Object Request Broker (ORB), which functions as a communications infrastructure, transparently transceiving object requests across distributed heterogeneous computing environments. This is accomplished through a well-defined interface called the Interface Definition Language (IDL). Further details regarding CORBA and IDL are set forth in “The Essential CORBA, Systems Integration Using Distributed Objects,” by Thomas W. Mobray and Ron Zahavi, 1995, which publication is incorporated by reference herein.

[0008] Class libraries are available to support object-oriented programming environments such as CORBA. These class libraries allow users to generate application programs using previously-defined classes.

[0009] Some existing class libraries include classes for manipulating specialized data types such as date, decimal, duration, time, and timestamp data types. However, these class libraries do not specifically match the semantics of specialized data types retrieved from relational databases. The semantics of these specialized data types are available only through calls to a relational database management system. Thus, object-oriented application programs cannot access and manipulate specialized type data values from relational databases according to the object-oriented programming paradigm.

[0010] Therefore, there is a need in the art for technologies that access existing relational databases using object-oriented techniques. Moreover, such technologies should minimize the need for developing new application programs.

SUMMARY OF THE INVENTION

[0011] To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, apparatus, and article of manufacture for defining object classes to match corresponding specialized data types stored in a relational database. An object-oriented application program may create an instance of a class for the purpose of representing data in a relational table that comprise a specialized data type. The attributes and behavior of the specialized data type in the database are preserved, where appropriate, in the corresponding class, and are available to the application program.

[0012] Various advantages and features of novelty, which characterize the invention, are pointed out with particularity in the claims annexed hereto and form a part hereof. However, for a better understanding of the invention, its advantages, and the objects obtained by its use, reference should be made to the drawings which form a further part hereof, and to accompanying descriptive matter, in which there is illustrated and described specific examples of an apparatus in accordance with the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Referring now to the drawings in which like reference numbers represent corresponding parts throughout:

[0014] FIG. 1 is a block diagram illustrating an exemplary hardware environment used to implement the preferred embodiment of the present invention;

[0015] FIG. 2 is a block diagram that further illustrates the structure of a Component Broker according to the present invention; and

[0016] FIG. 3 is a flowchart illustrating the logic performed by an Application Program, Component Broker, and Relational Database Management System according to the preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

[0017] In the following description of the preferred embodiment, reference is made to the accompanying drawings, which form a part hereof, and in which is shown by way of illustration a specific embodiment in which the invention may be practiced. It is to be understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the present invention.

[0018] Overview

[0019] The present invention provides a method for accessing a relational database using object-oriented techniques by modeling specialized data types within the database using specific object classes. The present invention allows an object-oriented application program to create an instance of a class for the purpose of representing data in a relational table that comprise a specialized data type. The attributes and behavior of the specialized data type in the database are preserved, where appropriate, in the corresponding class, and are available to the application program.

[0020] Hardware Environment

[0021] FIG. 1 is a block diagram illustrating an exemplary hardware environment used to implement the preferred embodiment of the invention. A client computer 100 communicates with a server computer 102. Both the client computer 100 and the server computer 102 are typically comprised of one or more processors, random access memory (RAM), read-only memory (ROM), and other components such data storage devices and data communications devices.

[0022] The client computer 100 executes one or more computer programs 104 operating under the control of an operating system. These computer programs 104 transmit requests to the server computer 102 for performing various functions and receive data from the server computer 102 in response to the requests.

[0023] The server computer 102 also operates under the control of an operating system, and executes one or more computer programs 106, 108, and 110. These computer programs 106, 108, and 110 receive requests from the client computer 100 for performing various functions and transmit data to the client computers 100 in response to the requests.

[0024] The server computer 102 manages one or more databases 112 stored on one or more data storage devices (such as a fixed or hard disk drive, a floppy disk drive, a CD-ROM drive, a tape drive, or other device). In a preferred embodiment, the database 112 is managed by the DB2™ relational database management system (RDBMS) offered by IBM Corporation. Those skilled in the art will recognize, however, that the present invention may be applied to any database and associated database management system.

[0025] The preferred embodiment of the present invention is generally implemented using five major components executed by client computers 100 and server computers 102, including a Client Program 104, Application Program 106, Component Broker 108 (which comprises a variant of an Object Request Broker), relational database management system (RDBMS) 110, and database 112, wherein each of these components comprise instructions and/or data. In the preferred embodiment, the Client Program 104 provides a user interface, the Application Program 106 performs application functions, the Component Broker 108 materializes data retrieved from the database 112 as objects, and the database management system 110 controls access to the database 112.

[0026] Generally, these instructions and/or data 104-112 are all tangibly embodied in or retrievable from a computer-readable device, medium, or carrier, e.g., a memory, a data storage device, a remote device coupled to the computer via a data communications device, etc. Moreover, these instructions and/or data, when read, executed, and/or interpreted by the client computer 100 and/or server computer 102, causes the client computer 100 and/or server computer 102 to perform the steps necessary to implement and/or use the present invention.

[0027] Thus, the present invention may be implemented as a method, apparatus, or article of manufacture using standard programming and/or engineering techniques to produce software, firmware, hardware, or any combination thereof The term “article of manufacture” (or alternatively, “computer program product”) as used herein is intended to encompass logic and/or data embodied in any device, medium, or carrier.

[0028] Of course, those skilled in the art will recognize many modifications may be made to this configuration without departing from the scope of the present invention. Those skilled in the art will also recognize that any combination of the above components, or any number of different components, including computer programs, peripherals, and other devices, may be used to implement the present invention, so long as similar functions are performed thereby.

[0029] Component Broker

[0030] FIG. 2 is a block diagram that further illustrates the structure of the Component Broker 112 according to the present invention. The Component Broker 112 provides a suite of tools that allows the user to write computer programs in an object-oriented programming context. In the preferred embodiment, the Component Broker 112 interacts with the Application Program 106. In alternative embodiments, the Component Broker 112 could interact with the Client Program 104 as well.

[0031] The Component Broker 112 is used to create and work with components 200, wherein a component 200 is a distributed set of objects that an Application Program 106 can access as a single entity and which work together to represent the logic and data relationships that perform a desired function for the Application Program 106.

[0032] In the present invention, the component 200 generally comprises a business object 202 and a data object 204, although other elements may be present as well. Business objects 202 include one or more methods and one or more attributes that are used directly by the Application Program 106. Data objects 204 also include one or more methods and one or more attributes that are used directly by the business objects 202 (and this indirectly by the Application Program 106).

[0033] Business objects 202 and data objects 204 are independent of any individual Application Program 106 and can be used in any combination to perform a desired task. A business object 202 may also have relationships with other business objects 202 and can cooperate with these other business objects 202 to perform a desired task.

[0034] Data objects 204 have direct access to data stored in the relational database 112 and are responsible for managing the persistence of state data for the component 200. By providing an interface between business objects 202 and the RDBMS 110, the data object 204 isolates the business object 202 from the details of the RDBMS 110 and relieves it from having to keep track of how to access and manage the data while maintaining persistency.

[0035] An Application Program 106 may access the data stored in the relational database 112 by interacting with business objects 202, which in turn interact with data objects 204, which in turn transmit requests to the RDBMS 110 using SQL functionality. For example, the data object 204 will generally have member functions that generate the appropriate SQL statements, package the statements, and forward them to the RDBMS 110 for execution, receive and process the results, and then return the results to the business objects 202, which ultimately provides access to the results to the Application Program 106.

[0036] As is well known, each column of a relational table 112 has a respective data type. Traditional data types include integer, floating point, logical, fixed length character, and variable length character data types. Some specialized data types include date, decimal, duration, time, and timestamp. Generally, SQL statements include expressions or functions, that permit manipulation of the specialized data types. A description of specialized data types and their associated expressions or functions can be found in the publication by IBM Corporation entitled DB2 Universal Database SQL Reference V.5, S1OJ-8165-00, pp. 143-156, Copyright 1993, 1997.

[0037] The direct use of such SQL expressions or functions is disadvantageous in that the specialized data type must be retrieved from the table in the relational database 112, the function must be performed by the RDBMS 110, and the result must then be provided back to the data object 204. There would be advantages, then, to performing these functions for specialized data types in an object, rather than the RDBMS 110. However, prior art class libraries do not support specialized data types.

[0038] In the present invention, the Component Broker 108 provides helper classes 206, 208, 210, 212, and 214 that emulate the semantics of the corresponding specialized data types for use in various operations, such as comparison operations, arithmetic operations, etc. In the preferred embodiment, these classes 206, 208, 210, 212, and 214 include:

[0039] ICBCDate Class 206 (representing the Date type).

[0040] ICBCDecimal Class 208 (representing the Decimal type).

[0041] ICBCDuration Class 210 (representing the Date Duration, Time Duration,

[0042] Timestamp duration, and Labeled Duration types). The Duration data type is complementary to the Date, Time, and Timestamp classes, but is not, itself, stored in tables in the relational database 112.

[0043] ICBCTime Class 212 (representing the Time type).

[0044] ICBCTimestamp Class 214 (representing the Timestamp type).

[0045] The abbreviation ICBC stands for IBM Component Broker Class.)

[0046] Each helper class 206, 208, 210, 212, and 214 provides a public interface (i.e., IDL) for accessing the attributes and for invoking the methods or member functions of the class. In each case, the public interface of the class is designed to match the characteristics and usage of the particular specialized data type in the RDBMS 110. As a result, methods or member functions performed by these classes 206, 208, 210, 212, and 214 produce the same results as equivalent SQL expressions evaluated by the RDBMS 110. Thus, the Application Program 106 uses the helper class objects 206, 208, 210, 212, and 214 to manipulate Dates, Decimals, Durations, Times, or Timestamps whenever it is desirable that the results should be consistent with those that would be produced by the RDBMS 110 itself.

[0047] In the preferred embodiment, the helper classes 206, 208, 210, 212, and 214 are implemented in accordance with specialized data types and associated expressions or functions found in the DB2™ RDBMS 110 sold by IBM Corporation. However, those skilled in the art will recognize that the classes 206, 208, 210, 212, and 214 can be implemented to accommodate specialized data types from any RDBMS 110, such as those offered by ORACLE™, SYBASE™, MICROSOFT™, etc.

[0048] Descriptions of the helper classes 206, 208, 210, 212, and 214, and a list of at least some of their methods or member functions are provided below. In addition, the Programming Language Appendix included below provides additional descriptions of the various attributes and methods associated with the helper classes 206, 208, 210, 212, and 214.

[0049] ICBC Date Class

[0050] The ICBCDate Class 206 stores the value of a calendar date between Jan. 01, 0001 and Dec. 31, 9999. All access and manipulation of this date is through a public functional interface. The actual date value and its format are stored in private attributes.

[0051] Note that ICBCDate Class 206 assumes the proleptic Gregorian calendar. The Gregorian calendar in use today is assumed to extend back to year 0001 and it is the responsibility of the application to apply any corrections that may be required for dates prior to the Gregorian calendar reform.

[0052] The ICBCDate Class 206 includes a number of different methods such as object initialization, comparisons, query functions, and manipulation functions. The object initialization methods include initializeFromString, initializeFromNumber, initializeFromTimestamp, and initializeFromValues methods. The comparison methods include equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, and greaterThanOrEqualTo. The query functions methods include OutputFormat, formattedString, day, dayOfWeek, dayOfYear, julianDay, modifiedJulianDay, dayName, dayFromString, dayOfWeekFromString, dayOfYearFromString, julianDayFromString, modifiedJulianDayFromString, dayNameFromString, dayNameFromNumber, month, monthName, monthFromString, monthNameFromString, monthNameFromNumber, quarter, quarterFromstring, year, yearFromString, isLeapYear, daysInObject, daysInString, daysInMonth, daysInYear, isValidMonthDayYear, isValidYearDay, and isObjectChanged. The manipulation methods include assignFromDate, increment, decrement, dateOverflow, intervalFromDate, intervalFromString, and intervalFromLong.

[0053] ICBCDecimal Class

[0054] The ICBCDecimal Class 208 stores the value of a Decimal data type (from a DB2™ RDBMS 110) or number type (from an ORACLE™ RDBMS 110) in which scale is less than or equal to precision, and positive with a specified maximum precision (e.g., 38). All access and manipulation of this value is through a public functional interface. The actual decimal value and its precision and scale are stored in private attributes.

[0055] The ICBCDecimal Class 208 includes a number of different methods such as object initialization, comparisons, query functions, and manipulation functions. The object initialization methods include initializeFromString1, initializeFromString2, initializeFromDouble, initializeFromFloat, initializeFromLong, initializeFromShort, initializeFromDecimal1, initializeFromDecimal2, and initializeFromPackedDecimal. The comparison methods include equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, and greaterThanOrEqualTo. The query functions methods include getAsFormattedString1, getAsFormattedString2, getAsFormattedString3, getAsDouble, getAsFloat, getAsLong, getAsShort, getAsDigits, getAsPackedDecimal, getPrecision, getScale, isNegative, and isChanged. The manipulation methods include assignFromDecimal, assignFromDouble, assignFromFloat, assignFromLong, assignFromShort, increment, decrement, multiplyThisObjectBy, divideThisObjectBy, remainderInThisObject, addWithNewObject, subtractWithNewObject, multiplyWithNewObject, divideWithNewObject, remainderWithNewObject, getPrecedingRemainder, swapSign, and decimalOverflow.

[0056] ICBCDuration Class

[0057] The ICBCDuration Class 210 represents the “Labeled Duration”, “Date Duration”, “Time Duration”, and “Timestamp Duration” constructs of Duration. Duration is complementary data type to Date, Time, and Timestamp, and participates in expressions in SQL statements. However, it is not, itself, stored in tables in the relation database 112.

[0058] The Class 210 holds the value of a duration, and a record of whether this duration value is in units of years, months, days, hours, minutes seconds, or microseconds. The value can also be of a composite type defining a “Date Duration” of the form yyyymmdd, a “Time Duration” of the form hhmmss, or a “Timestamp Duration” of the form yyyymmddhhmmsszzzzzz.

[0059] In the preferred embodiment, arithmetic between two ICBCDuration Class 210 objects is not supported (which is consistent with DB2™ support of Durations). However, they can be compared, and a unary minus operator (which swaps the sign) is provided.

[0060] The ICBCDuration Class 210 includes a number of different methods such as object initialization, comparisons, query functions, and manipulation functions, The object initialization methods include initializeLabeledDuration, initializeDateTimeDuration, and initializeTimestampDuration. The comparison methods include equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, and greaterThanOrEqualTo. The query functions methods include isNegative, microsecond, second, minute, hour, day, month, year, size, and formattedString. The manipulation function methods include assignFromDuration, and swapSign.

[0061] ICBCTime Class

[0062] The ICBCTime Class 212 stores the value of a time-of-day. All access and manipulation of this time is through a public functional interface. The actual time value and its format are stored in private attributes.

[0063] The ICBCTime Class 212 includes a number of different methods such as object initialization, comparisons, query functions, and manipulation functions. The object initialization methods include initializeFromString, intializeFromTimestamp, and initializeFromValues. The comparison methods include equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, and greaterThanOrEqualTo. The query functions methods include second, minute, hour, and isObjectChanged. The manipulation functions methods include assignFromTime, increment, decrement, timeOverflow, intervalFromTime, and intervalFromString.

[0064] ICBCTimestamp Class

[0065] The ICBCTimestamp Class 214 stores the value of a Timestamp type (from a DB2™ RDBMS 110) or a DATE type (from an ORACLE™ RDBMS 110). All access and manipulation of this timestamp is through a public functional interface; the actual timestamp value is stored in private attributes.

[0066] In the preferred embodiment, a Timestamp attribute in a business object 204 that originates from the database 112 is represented by Component Broker 108 as a 26 character string of form yyyy-mm-dd-hh.mm.ss.mmmmmm. This string can be used to initialize an instance of the ICBCTimestamp Class 214 through the initializeFromString function. A DATE attribute that originates from an ORACLE™ database 112 is represented by Component Broker 108 in the same 26 character form yyyy-mm-dd-hh.mm.ss.mmmmmm but with the final six characters (the microseconds field) always set to zeros. This string can be used to initialize an instance of the ICBCTimestamp Class 214 via initializeFromString function. However, ORACLE™ dates earlier than Jan. 01, 0001 are rejected. Whether the ICBCTimestamp object is initialized from data originating in a DB2™ or in ORACLE™ database 112, ICBCTimestamp applies DB2™ semantics in its processing of the data.

[0067] The ICBCTimestamp Class 214 includes a number of different methods such as object initialization, comparisons, query functions, and manipulation functions. The object initialization methods include initializeFromString, initializeFromDateTime, initializeFromDate, initializeFromTime, and initializeFromDatastoreFormat. The comparison methods include equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, and greaterThanOrEqualTo. The query functions methods include formattedString, getAsDateFormattedString, getAsTimeFormattedString, getAsDatstoreFormat, microsecond, second, minute, hour, day, month, year, dayOfWeek, dayOfYear, julianDay, modifiedJulianDay, dayName, dayFromString, dayOfWeekFromString, dayOfYearFromString, julianDayFromString, modifiedJulianDayFromString, dayNameFromString, dayNameFromNumber, monthName, monthFromString, monthNameFromString, monthNameFromNumber, quarter, quarterFromString, yearFromString, isLeapYear, daysInObject, daysInString, daysInMonth, daysInYear, and isObjectChanged. The manipulation functions methods include assignFromTimestamp, increment, decrement, timestampOverflow, intervalFromTimestamp, and intervalFromString.

[0068] Logic of the Invention

[0069] FIG. 3 is a flowchart illustrating the logic performed by the Application Program 106, Component Broker 108, and RDBMS 110 according to the preferred embodiment of the present invention.

[0070] Block 300 represents the Component Broker 108 instantiating one or more of the helper classes 206, 208, 210, 212, and 214 as objects. Generally, this step is performed in response to a request from the Application Program 106, although other events may trigger this step as well.

[0071] Block 302 represents the Component Broker 108 retrieving one or more tuples comprised of at least a Date, Decimal, Duration, Time, or Timestamp column or attribute from a table in the relational database 112. This retrieval step is performed via the data object 204 within the Component Broker 108, wherein the data object 204 has member functions that generate appropriate SQL statements, package the statements, and forward them to the RDBMS 110 for execution.

[0072] Block 304 represents the Component Broker 108 storing the requested data retrieved from the table in the relational database 112 as a string attribute in a business object 202. This storage step is also performed via the data object 204 within the Component Broker 108, wherein the data object 204 has member functions that receive and process the results from the execution of the SQL statements by the RDBMS 110, and then return the results to the business objects 202.

[0073] Block 306 represents the Application Program 106 retrieving the string attribute from the business object 202 in the Component Broker 108.

[0074] Block 308 represents the Application Program 106 using the retrieved string attribute to initialize one or more of the helper class objects 206, 208, 210, 212, or 214 in the Component Broker 108.

[0075] Block 310 represents the Application Program 106 performing one or more various operations, such as object initialization, comparisons, query functions, manipulation functions, arithmetic operations, etc., on the helper class objects 206, 208, 210, 212, or 214.

[0076] Block 312 represents the Application Program 106 extracting the string attribute from the helper class objects 206, 208, 210, 212, or 214 in the Component Broker 108.

[0077] Block 314 represents the Application Program 106 updating the attribute in the business object 202 using the extracted string attribute.

[0078] Block 316 represents the Component Broker 108 storing the updated string attribute from the business object 202 into the relational database 112. This storing step is performed via the data object 204 within the Component Broker 108, wherein the data object 204 has member functions that generate appropriate SQL statements, package the statements, and forward them to the RDBMS 110 for execution.

[0079] Conclusion

[0080] This concludes the description of the preferred embodiment of the invention. The following paragraphs describe some alternative methods of accomplishing the same objects.

[0081] In alternative embodiments of the present invention, other types and configurations of computers could be used. For example, the invention need not be restricted to client-server configurations. In addition, mainframes, minicomputers, or personal computers, could be used with the present invention.

[0082] In alternative embodiments of the present invention, other types and configurations of computer programs could be used. For example, the invention need not be restricted to COBRA environments, but could be used with COM, DCOM, or other object-oriented environments.

[0083] In alternative embodiments of the present invention, other database management systems could be used. For example, the invention need not be restricted to DB2™ relational database management systems. Instead, the present invention could be used to model other types of databases and datastores.

[0084] In summary, the present invention discloses a method, apparatus, and article of manufacture for defining object classes to match corresponding specialized data types stored in a relational database. An object-oriented application program may create an instance of a class for the purpose of representing data in a relational table that comprise a specialized data type. The attributes and behavior of the specialized data type in the database are preserved, where appropriate, in the corresponding class, and are available to the application program.

[0085] The foregoing description of the preferred embodiment of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the invention be limited not by this detailed description, but rather by the claims appended hereto.

[0086] Programming Reference Appendix

[0087] The following Programming Reference Appendix provides descriptions of the various attributes and methods associated with the helper classes 206, 208, 210, 212, and 214. These descriptions describe the implementation of the preferred embodiment of the present invention, and are not intended to be limiting in any way. Specifically, those skilled in the art will recognize that different methods, attributes, functionality or implementations may be made without departing from the scope of the present invention.

[0088] ICBCDate Class

[0089] The class stores the value of a calendar date between Jan. 01, 0001 and Dec. 31, 9999. All access and manipulation of this date is through a public functional interface. The actual date value and its format are stored in private attributes.

[0090] Note that ICBCDate assumes the proleptic Gregorian calendar. The Gregorian calendar in use today is assumed to extend back to year 0001 and it is the responsibility of the application to apply any corrections that may be required for dates prior to the Gregorian calendar reform.

[0091] IDL Interface Description

[0092] interface ICBCDate: IManagedLocal::ILocalOnly 1 { // Object initialization boolean initializeFromString(in string aDate); boolean initializeFromNumber(in long aDate); boolean initializeFromTimestamp(in ICBCTimestamp aTimestamp); boolean initializeFromValues(in long aYear, in long aMonth,    in long aDay); // Comparisons boolean equalTo(in ICBCDate aDate); boolean notEqualTo(in ICBCDate aDate); boolean lessThan(in ICBCDate aDate); boolean lessThanOrEqualTo(in ICBCDate aDate); boolean greaterThan(in ICBCDate aDate); boolean greaterThanOrEqualTo(in ICBCDate aDate); // Query functions enum OutputFormat {ISO, USA, EUR, JIS, LOC}; string formattedString(inout string aTarget,    in ICBCDate::OutputFormat aFormat); long day(); long dayOfWeek(); long dayOfYear(); long julianDay(); long modifiedJulianDay(); string dayName(); long dayFromString(in string aString); long dayOfWeekFromString(in string aDate); long dayOfYearFromString(in string aDate); long julianDayFromString(in string aDate); long modifiedJulianDayFromString(in string aDate); string dayNameFromString(in string aDate); string dayNameFromNumber(in long aDayIndex); long month(); string monthName(); long monthFromString(in string aDate); string monthNameFromString(in string aDate) string monthNameFromNumber(in long aMonthIndex); long quarter(); long quarterFromstring(in string aDate); long year(); long yearFromString(in string aString); boolean isLeapYear(in long aYear); long daysInObject(); long daysInString(in string aDate); long daysInMonth(in long aYear, in long aMonth); long daysInYear(in long aYear); boolean is ValidMonthDayYear(in long aMonth, in long aDay,    in long aYear); boolean isValidYearDay(in long aYear, in long aDay); boolean isObjectChanged(); // Manipulation functions void assignFromDate(in ICBCDate aDate); void increment(in ICBCDuration aDuration); void decrement(in ICBCDuration aDuration); long dateOverflow(); ICBCDuration intervalFronDate(in ICBCDate aDate); ICBCDuration intervalFromString(in string aDate); ICBCDurarion intervalFromLong(in long aDate); };

[0093] Supported Methods

[0094] ICBCDate::_create

[0095] ICBCDate::assignFromDate

[0096] ICBCDate::dateOverflow

[0097] ICBCDate::day

[0098] ICBCDate::dayFromString

[0099] ICBCDate::dayName

[0100] ICBCDate::dayNameFromNumber

[0101] ICBCDate::dayNameFromString

[0102] ICBCDate::dayOfWeek

[0103] ICBCDate::dayOfWeekFromString

[0104] ICBCDate::dayOfyear

[0105] ICBCDate::dayOfYearFromString

[0106] ICBCDate::daysInMonth

[0107] ICBCDate::daysInObject

[0108] ICBCDate::daysInString

[0109] ICBCDate::daysInYear

[0110] ICBCDate::decrement

[0111] ICBCDate::equalTo

[0112] ICBCDate::formattedString

[0113] ICBCDate::greaterThan

[0114] ICBCDate::greaterThanOrEqualTo

[0115] ICBCDate::increment

[0116] ICBCDate::initializeFromNumber

[0117] ICBCDate::initializeFromString

[0118] ICBCDate::intializeFromTimestamp

[0119] ICBCDate::initializeFromValues

[0120] ICBCDate::interval

[0121] ICBCDate::isObjectChanged

[0122] ICBCDate::isLeapYear

[0123] ICBCDate::isValidMonthDayYear

[0124] ICBCDate::isValidYearDay

[0125] ICBCDate::julianDay

[0126] ICBCDate::julianDayFromString

[0127] ICBCDate::lessThan

[0128] ICBCDate::lessThanOrEqualTo

[0129] ICBCDate::modifiedJulianDay

[0130] ICBCDate::modifiedJulianDayFromString

[0131] ICBCDate::month

[0132] ICBCDate::monthFromString

[0133] ICBCDate::monthName

[0134] ICBCDate::monthNameFromNumber

[0135] ICBCDate::monthNameFromString

[0136] ICBCDate::notEqualTo

[0137] ICBCDate::quarter

[0138] ICBCDate::quarterFromString

[0139] ICBCDate::year

[0140] ICBCDate::yearFromString

[0141] ICBCDate::_create

[0142] Returns a pointer to a new IDBCDate object. The object is intialized to the current system date.

[0143] ICBCDate::assignFromDate

[0144] Sets all state data in this ICBCData object equal to the second ICBCData object. The change flag of this object is set to TRUE.

[0145] IDL Syntax

[0146] ICBCDate assignFromDate (in ICBCDate aDate);

[0147] ICBCDate::dateOverflow

[0148] Returns the number of overflow or underflow years of a preceding increment or decrement operation. For an increment, returns the years in excess of year 9999; for decrement, the number of years less than year 0001.

[0149] IDL Syntax

[0150] long dateOverflow( );

[0151] ICBCDate::day

[0152] Returns the day part of this object, as a number between 1 and 31.

[0153] IDL Syntax

[0154] long day( );

[0155] ICBCDate::dayFromString

[0156] Returns the day part Returns the day part of the date encoded in the input string parameter.

[0157] The input string parameter must conform to a format recognizable as a date. Refer to IBCDate::initializeFromString( ) for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[0158] IDL Syntax

[0159] long dayFromString(in string aString);

[0160] ICBCDate::dayName

[0161] Returns a string containing the name of the day of the week for this date object.

[0162] IDL Syntax

[0163] string dayName();

[0164] ICBCDate::dayNameFromNumber

[0165] Returns a string containing the name of the day of the week for the day number within a week provided in the input parameter. The input parameter must be a number between 1 and 7. Sunday is day number 1.

[0166] If the input parameter is not recognizable, an empty string is returned.

[0167] IDL Syntax

[0168] string dayNameFromNumber(in long aDayIndex);

[0169] ICBCDate::dayNameFromString

[0170] Returns a string containing the name of the day of the week for the date encoded in the input string parameter. The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats.

[0171] If the input parameter is not recognizable, an empty string is returned.

[0172] IDL Syntax

[0173] long dayNameFromString(m string aDate);

[0174] ICBCDate::dayOfWeek

[0175] Returns a number between 1 and 7 representing the day of the week for this date object. Sunday is day number 1.

[0176] IDL Syntax

[0177] long dayOfWeek( );

[0178] ICBCDate::dayOfWeekFromString

[0179] Returns a number between 1 and 7 representing the day of the week for the date encoded in the input string parameter. Sunday is day number 1.

[0180] The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[0181] IDL Syntax

[0182] long dayOfWeekFromString(in string aString);

[0183] ICBCDate::dayOfYear

[0184] Returns a number between 1 and 366 representing the day of the year for this date object. January 1 is day number 1.

[0185] IDL Syntax

[0186] long dayOfYear( );

[0187] ICBCDate::dayOfYearFromString

[0188] Returns a number between 1 and 366 representing the day of the year for the date encoded in the input string parameter. January 1 is day number 1.

[0189] The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[0190] IDL Syntax

[0191] long dayOfYearFromString(in string aString);

[0192] ICBCDate::daysInMonth

[0193] Returns the number of days in the month of the year provided in the input parameters. Month number must be between 1 and 12.

[0194] If the input parameters are not valid, a value of −1 is returned.

[0195] IDL Syntax

[0196] long daysInMonth(in long aYear, in long aMonth);

[0197] ICBCDate::daysInObject

[0198] Returns the number of days from Jan. 1, 0001 to the date represented by this object, plus one day. For example, an object holding the date Jan. 2, 0001 returns the value 2.

[0199] IDL Syntax

[0200] long daysInObject( );

[0201] ICBCDate::daysInString

[0202] Returns the number of days from Jan. 1, 0001 to the date represented by the string parameter, plus one day. For example, an object holding the date 00010102 returns the value 2. If the string is invalid, the value −1 is returned.

[0203] IDL Syntax

[0204] long daysInString(in string aDate);

[0205] Parameters

[0206] The string must be one of the following:

[0207] A string of length 7 of the form yyyynnn.

[0208] aDate

[0209] A string of length 6 of the form yyyymmdd.

[0210] A punctuated string representation of a date.

[0211] For additional details on the string parameter, see ICBCDate::initializeFromString.

[0212] ICBCDate::daysInYear

[0213] Returns the number of days in the year provided in the input parameter. If the input parameter is not valid, a value of −1 is returned.

[0214] IDL Syntax

[0215] long daysInYear in long aYear);

[0216] ICBCDate::decrement

[0217] Subtracts a ICBCDuration from the value of this ICBCDate object.

[0218] IDL Syntax

[0219] void decrement(in ICBCDuration aDuration);

[0220] Remarks

[0221] This operation is performed essentially as the inverse of ICBCDate::increment. When the duration of type DATE is subtracted from a date, the date is decremented by the specified number of days, months, and years (in this order). If the years value of the result of an decrement operation is less than 0001 years, the years value of the result is set to 0001 and the number of underflow years can be retrieved as a negative number using ICBCDate::dateOverflow. The number of overflow years is cleared by the next assignFromDate or arithmetic operation on the object.

[0222] The change flag of this object is set to TRUE.

[0223] ICBCDate::equalTo

[0224] Returns TRUE if the date in this ICBCDate object is equal to the other ICBCDate object.

[0225] IDL Syntax

[0226] boolean equalTo(in ICBCDate aDate);

[0227] ICBCDate::formattedString

[0228] Returns the date value of this object as a string in a specified format. The parameter OutputType must take one of the values: ISO, USA, EUR, JIS. Formats are as described for lCBCDate::initializeFromString. The LOC site-defined operation described in the DB2 manual is not supported by ICBCDate.

[0229] The application must supply a non-const pointer to a target storage area long enough to receive the formatted date. The function returns a reference to this area

[0230] IDL Syntax

[0231] string formattedString(inout string aOutput,

[0232] in ICBCDate::OutputFormat aFormat)

[0233] ICBCDate::greaterThan

[0234] Returns TRUE if the date stored in this ICBCDate object is greater than the other ICBCDate object.

[0235] IDL Syntax

[0236] boolean greaterThan(in ICBCDate aDate);

[0237] ICBCDate::greaterThanOrEqualTo

[0238] Returns TRUE if the date stored in this ICBCDate object is greater than or equal to the other ICBCDate object.

[0239] IDL Syntax

[0240] boolean greaterThanOrEqualTo(in ICBCDate aDate);

[0241] ICBCDate::increment

[0242] Adds a ICBCDuration to the value of this ICBCDate object. If the duration is negative, the operation is performed as a decrement. If a duration of type YEARS is added to the date, only the year portion of the date is affected. The month is unchanged, as is the day, unless the result would be February 29 of a non-leap-year. In this case, the day is changed to 28.

[0243] Similarly, if a duration of type MONTHS is added, only months and, if necessary, years are affected. Note that adding months to a Date is like turning the pages of a calendar, starting with the page on which the date appears. The day portion of the date is unchanged unless the result would be invalid (September 31, for example). In this case, the day is set to the last day of the month. If one or more months is added to a given date, and then the same number of months is subtracted from the result, the final date is not necessarily the same as the original date.

[0244] Adding a duration of type DAYS will, of course, affect the day portion of the date, and potentially the month and year.

[0245] When a duration of type DATE is added to a date, the date is incremented by the specified number of year, months, and days, in this order.

[0246] If the years value of the result of an increment operation is greater than 9999 years, then the years value of the result is set to 9999, and the number of overflow years can be retrieved using the dateOverflow( ) function. The number of overflow years is cleared by the next assignFromDate of arithmetic operation on the object.

[0247] The change flag of this object is set to TRUE.

[0248] IDL Syntax

[0249] void increment(in ICBCDuration aDuration);

[0250] ICBCDate::initializeFromNumber

[0251] Accepts a numerical value for the date. Any existing value in the object is replaced. The parameter aDate must be positive, non-zero, and less than 3652059. Creates a date that is (aDate-1) days beyond Jan. 1, 0001, i.e., Jan. 2, 0001 is day number 2. Returns TRUE if the number is a valid date representation, FALSE otherwise. If FALSE is returned the state of the object is unchanged.

[0252] IDL Syntax

[0253] boolean initializeFromNumber(in long aDate);

[0254] ICBCDate::initializeFromString

[0255] Accepts a value for the date in the form of a string. Returns TRUE if the string is a valid date representation and the object is successfully initialized. Any existing value in the object is replaced. Returns FALSE if the parameter is invalid. If FALSE is returned the state of the object is unchanged.

[0256] IDL Syntax

[0257] boolean initializeFromString(in string aDate);

[0258] Parameters

[0259] The string must be:

[0260] A string of length 7 of the form yyyynnn.

[0261] The yyyyddd string must consist of entirely numeric characters with padding zeros where necessary—embedded signs or blanks are not allowed. However leading and trailing blanks are acceptable provided the string length is less than 20 characters. Only SBCS characters may be present in the string.

[0262] A string of length 8 of the form yyyymmdd.

[0263] The yyyymmdd string must consist of entirely numeric characters with padding zeros where necessary—embedded signs or blanks are not allowed. However leading and trailing blanks around the string are acceptable provided the string length is less than 20 characters. Only SBCS characters may be present in the string.

[0264] A valid punctuated string representation of a date, in one of the following valid forms:

[0265] aDate

[0266] International Standards Organization (ISO) y-mm-dd).

[0267] IBM USA standard (USA) (mm/dd/yyyy).

[0268] IBM European standard (EUR) (dd.mm.yyyy)

[0269] Japanese Industrial Standard Christian Era (JIS) (yyyy-mm-dd).

[0270] Leading and trailing blanks are acceptable provided the string length is less than 20 characters. Leading zeros may be omitted from the month and day portions. Only SBCS characters may be present in the string.

[0271] A string representation of a timestamp.

[0272] Any of the string forms acceptable by the ICBCTimestamp::initializeFromString function are acceptable. For details refer to that function. Briefly, the forms include:

[0273] A punctuated string: yyyy-mm-dd-hh.mm.ss.nnnnnn.

[0274] A 14 byte string without puctuation, of the form: yyyymmddhhmmss.

[0275] ICBCDate::initializeFromTimestamp

[0276] Initializes this object from the date portion of a Timestamp object.

[0277] IDL Syntax

[0278] boolean initializeFromTimestamp(in ICBCTimestamp aTimestamp);

[0279] ICBCDate::initializeFromValues

[0280] Accepts the date in the form of three separate value parameters for year, month, and day. The values must make a valid date. Returns TRUE if the values are a valid date representation, FALSE otherwise. If FALSE is returned the state of the object is unchanged.

[0281] IDL Syntax

[0282] boolean initializeFromValues(in long aYear,in long aMonth, in long aDay);

[0283] ICBCDate::interval

[0284] Calculates the Duration between two ICBCDate objects. The result is a pointer to a new ICBCDuration object of type DATE.

[0285] If the interval between DATE1 and DATE2 is required, and DATE1 is greater than or equal to DATE2, the operation is performed by subtracting DATE2 from DATE1. If, however, DATE1 is less than DATE2, DATE1 is subtracted from DATE2, and the sign of the result is made negative.

[0286] The following procedural description clarifies the steps involved in the operation result=DATE1-DATE2.

[0287] If DAY(DATE2)<=DAY(DATE1)

[0288] then DAY(RESULT)=DAY(DATE1)-DAY(DATE2).

[0289] If DAY(DATE2)>DAY(DATE1)

[0290] then DAY(RESULT)=N+(DAY(DATE1)−DAY(DATE2)

[0291] where N=the last day of MONTH(DATE2).

[0292] MONTH(DATE2) is then incremented by 1.

[0293] If MONTH(DATE2)<=MONTH(DATE1)

[0294] then MONTH(RESULT)=MONTH(DATE1)−MONTH(DATE2).

[0295] If MONTH(DATE2)>MONTH(DATE1)

[0296] then MONTH(RESULT)=12+MONTH(DATE1)−MONTH(DATE2).

[0297] YEAR(DATE2) is incremented by 1.

[0298] YEAR(RESULT)=YEAR(DATE1)−YEAR(DATE2).

[0299] IDL Syntax

[0300] ICBCDuration_ptr intervalFromDate(in ICBCDate aDate);

[0301] ICBCDuration_ptr intervalFromString(in string aDate);

[0302] ICBCDuration_ptr intervalFromLong(in long aDate);

[0303] In the cases with a string parameter, the parameter must be recognizable as a date. For details refer to the description of ICBCDate::initializeFromString. If the string is invalid, a pointer value of −1 is returned.

[0304] ICBCDate::isObjectChanged

[0305] Returns a boolean indicating whether the value of this object has been changed since it was initialized.

[0306] IDL Syntax

[0307] boolean isObjectChanged( );

[0308] ICBCDate::isLeapYear

[0309] Returns TRUE if the year number in the input parameter is a leap year, FALSE otherwise. Year number must be between 1 and 9999.

[0310] If the input parameter is not in this range, FALSE is returned.

[0311] IDL Syntax

[0312] boolean isLeapYear(in long aYear);

[0313] ICBCDate: :isValidMonthDayYear

[0314] Returns TRUE if the provided values for month, day, and year make a valid date, and FALSE otherwise.

[0315] IDL Syntax

[0316] boolean isValidMonthDayYear(in long aMonth, in longMonth, in longYear);

[0317] ICBCDate: :isValidYearDay

[0318] Returns TRUE if the provided values for year, and day within year make a valid date, and FALSE otherwise.

[0319] IDL Syntax

[0320] boolean isValidYearDay(in long aYear,in long aDay); ICBCDate::julianDay

[0321] Returns the Julian day number corresponding to noon GMT on the date represented by this object. Julian Day count started at noon, GMT, on Jan. 1, 4712 BC

[0322] IDL Syntax long julianDay( );

[0323] ICBCDate::julianDayFromString

[0324] Returns the Julian day number corresponding to noon GMT on the date encoded in the input string parameter. (Julian Day count started at noon, GMT, on Jan. 1, 4712 BC). The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[0325] IDL Syntax long julianDayFromString(in string aString);

[0326] ICBCDate::lessThan

[0327] Returns TRUE if the date stored in this ICBCDate object is less than the other ICBCDate object.

[0328] IDL Syntax

[0329] boolean lessThan(in ICBCDate aDate);

[0330] ICBCDate::lessThanOrEqualTo

[0331] Returns TRUE if the date stored in this ICBCDate object is less than or equal to the other ICBCDate object.

[0332] IDL Syntax

[0333] boolean lessThanOrEqualTo(in ICBCDate aDate);

[0334] ICBCDate::modifiedJulianDay

[0335] Returns the Modified Julian day number (MJD) corresponding to time 00:00:00 GMT on the date represented by this object. MJD is defined as Julian Day—2,400,000.5 days. It thus starts at time 00:00:00 (i.e. midnight), in line with normal civil practice, and unlike Julian Day which extends from noon to noon.

[0336] IDL Syntax

[0337] long modified JulianDay( );

[0338] ICBCDate::modifiedJulianDayFromString

[0339] Returns the Modified Julian day number (MJD) corresponding to time 00:00:00 GMT on the date encoded in the input string parameter. MJD is defined as Julian Day—2,400,000.5 days. It thus starts at time 00:00:00 (i.e., midnight), in line with normal civil practice, and unlike Julian Day which extends from noon to noon.

[0340] The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[0341] IDL Syntax

[0342] long modifiedJulianDayFromString(in string aString);

[0343] ICBCDate::month

[0344] Returns the month part of this object, as a number between 1 and 12.

[0345] IDL Syntax

[0346] long month( );

[0347] ICBCDate::monthFromString

[0348] Returns the month part of the date encoded in the input string parameter. The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats.

[0349] If the input parameter is not recognizable, a value of −1 is returned.

[0350] IDL Syntax

[0351] long monthFromString(in string aString);

[0352] ICBCDate::monthName

[0353] Returns a string containing the name of the month of this object.

[0354] IDL Syntax

[0355] long monthName( );

[0356] ICBCDate::monthNameFromNumber

[0357] Returns a string containing the name of the month for the month number within a year provided in the input parameter. The input parameter must be a number between 1 and 12.

[0358] If the input parameter is not recognizable, an empty string is returned.

[0359] IDL Syntax

[0360] string monthNameFromNumber(in long aDayIndex);

[0361] ICBCDate::monthNameFromString

[0362] Returns a string containing the name of the month for the date encoded in the input string parameter. The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats.

[0363] If the input parameter is not recognizable, an empty string is returned.

[0364] IDL Syntax

[0365] string monthNameFromString(in string aDate);

[0366] ICBCDate::notEqualTo

[0367] The opposite of the operator==member.

[0368] IDL Syntax

[0369] boolean notEqualTo(in ICBCDate aDate);

[0370] ICBCDate::quarter

[0371] Returns a number for the quarter within the year for this object. Dates between January 1 and March 31 are in the first quarter, and so on.

[0372] IDL Syntax

[0373] long quarter( );

[0374] ICBCDate::quarterFromString

[0375] Returns a number for the quarter within the year for the date encoded in the input string parameter. The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats. Dates between January 1 and March 31 are in the first quarter, and so on.

[0376] If the input parameter is not recognizable, a value of −1 is returned.

[0377] IDL Syntax

[0378] long quarterFromString(in string aDate);

[0379] ICBCDate::year

[0380] Returns the year part of the date.

[0381] IDL Syntax

[0382] long year( );

[0383] ICBCDate::yearFromString

[0384] Returns the year part of the date encoded in the input string parameter. The input string parameter must conform to a format recognizable as a date. Refer to ICBCDate::initializeFromString for a description of supported formats.

[0385] If the input parameter is not recognizable, a value of −1 is returned.

[0386] IDL Syntax

[0387] long yearFromString(in string aString);

[0388] ICBCDecimal Class

[0389] The class stores the value of a DB2 Decimal data type, or Oracle number type in which scale is less than or equal to precision, and positive with a maximum precision of 38. All access and manipulation of this value is through a public functional interface. The actual decimal value and its precision and scale are stored in private attributes. 2 Important Throughout the description of ICBCDecimal, precision is the total number of digits in the decimal number; scale is the number of digits in the fractional part of the number - - - the number of digits that lie to the right of the decimal point.

[0390] IDL Interface Description

[0391] interface ICBCDecimal :IManagedLocal::ILocalOnly 3 { // Object initialization (DB2 semantics) boolean initializeFromString1(in string aString, in short aPrecision,    in short aScale, in char aDecimalChar); boolean initializeFromString2(in string aString, in char aDecimalChar); boolean initializeFromDouble(in double aDouble,in short aPrecision,    in short aScale); boolean initializeFromFloat(in float aFloat, in short aPrecision,    in short aScale); boolean initializeFromLong(in long aLong, in short aPrecision,    in short aScale); boolean initializeFromShort(in short aShort, in short aPrecision,    in short aScale); boolean initializeFromDecimal1(in ICBCDecimal aDecimal, in short aPrecision,    in short aScale); boolean initializeFromDecimal2(in ICBCDecimal aDecimal); boolean initializeFromPackedDecimal(in string aString,in short aPrecision,    in short aScale); //Comparisons boolean equalTo(in ICBCDecimal aDecimal); boolean notEqualTo(in ICBCDecimal aDecimal); boolean lessThan(in ICBCDecimal aDecimal); boolean lessThanOrEqualTo(in ICBCDecimal aDecimal); boolean greaterThan(in ICBCDecimal aDecimal); boolean greaterThanOrEqualTo(in ICBCDecimal aDecimal); //Query functions string getAsFormattedString1(inout string aOutput,    in char aDecimalCharacter); string getAsFormattedString2(inout string aOutput,    in char aDecimalCharacter); string getAsFormattedString3(inout string aOutput,    in char aDecimalCharacter); double getAsDouble(); float getAsFloat(); long getAsLong(); short getAsShort(); string getAsDigits(inout string aOutput); string getAsPackedDecimal(inout string aOutput, inout short aPrecision,    inout short aScale); short getPrecision(); short getScale(); boolean isNegative(); boolean isChanged(); // Manipulation functions ICBCDecimal assignFromDecimal(in ICBCDecimal aDecimal); ICBCDecimal assignFromDouble(in double aDouble); ICBCDecimal assignFromFloat(in float aFloat); ICBCDecimal assignFromLong(in long aLong); ICBCDecimal assignFromShort(in short aShort); ICBCDecimal increment(in ICBCDecimal aDecimal); ICBCDecimal decrement(in ICBCDecimal aDecimal); ICBCDecimal multiplyThisObjectBy(in ICBCDecimal aDecimal); ICBCDecimal divideThisObjectBy(in ICBCDecimal aDecimal); ICBCDecimal remainderInThisObject(in ICBCDecimal aDecimal); ICBCDecimal addWithNewObject(in ICBCDecimal aDecimal); ICBCDecimal subtractWithNewObject(in ICBCDecimal aDecimal); ICBCDecimal multiplyWithNewObject(in ICBCDecimal aDecimal); ICBCDecimal divideWithNewObject(in ICBCDecimal aDecimal); ICBCDecimal remainderWithNewObject(in ICBCDecimal aDecimal); ICBCDecimal getPrecedingRemainder(); void swapSign(); boolean decimalOverflow(); };

[0392] Supported Methods

[0393] ICBCDecimal::addWithNewObject

[0394] ICBCDecimal::assignFromDecimal

[0395] ICBCDecimal::assignFromDouble

[0396] ICBCDecimal::assignFromFloat

[0397] ICBCDecimal::assignFromLong

[0398] ICBCDecimal::assignFromShort

[0399] ICBCDecimal:: create

[0400] ICBCDecimal::decimalOverflow

[0401] ICBCDecimal::decrement

[0402] ICBCDecimal::divideThisObjectBy

[0403] ICBCDecimal::divideWithNewObject

[0404] ICBCDecimal::equalTo

[0405] ICBCDecimal::getAsDouble

[0406] ICBCDecimal::getAsFloat

[0407] ICBCDecimal::getAsFormattedString1

[0408] ICBCDecimal::getAsFormattedString2

[0409] ICBCDecimal::getAsFormattedString3

[0410] ICBCDecimal::getAsDigits

[0411] ICBCDecimal::getAsLong

[0412] ICBCDecimal::getAsPackedDecimal

[0413] ICBCDecimal::getAsShort

[0414] ICBCDecimal::getPreceedingRemainder

[0415] ICBCDecimal::getPrecision

[0416] ICBCDecimal::getScale

[0417] ICBCDecimal::greaterThan

[0418] ICBCDecimal::greaterThanOrEgualTo

[0419] ICBCDecimal::increment

[0420] ICBCDecimal::initializeFromDecimal1

[0421] ICBCDecimal::initializeFromDecimal2

[0422] ICBCDecimal::initializeFromDouble

[0423] ICBCDecimal::initializeFromFloat

[0424] ICBCDecimal::initializeFromLong

[0425] ICBCDecimal::initializeFromPackedDecimal

[0426] ICBCDecimal::initializeFromShort

[0427] ICBCDecimal::initializeFromString1

[0428] ICBCDecimal::initializeFromString2

[0429] ICBCDecimal::isChanged

[0430] ICBCDecimal::isNegative

[0431] ICBCDecimal::lessThan

[0432] ICBCDecimal::lessThanOrEqualTo

[0433] ICBCDecimal::multiplyWithNewObject

[0434] ICBCDecimal::multiplyThisObjectBy

[0435] ICBCDecimal::notEqualTo

[0436] ICBCDecimal::remainderInThisObject

[0437] ICBCDecimal::remainderWithNewObject

[0438] ICBCDecimal::subtractWithNewObject

[0439] ICBCDecimal::swapSign

[0440] ICBCDecimal::addWithNewObject

[0441] Adds the receiving object and the argument ICBCDecimal object and returns a new ICBCDecimal object containing the result. The original operand objects are unchanged. The precision of the result object is:

[0442] min(38, max(p1−s1, p2−s2)+max(s1, s2)+1)

[0443] The scale is: max(s1, s2)

[0444] IDL Syntax

[0445] ICBCDecimal addWithNewObject(in ICBCDecimal aDecimal);

[0446] Remarks

[0447] After a addWithNewObject operation, the change flag of the new object is set to TRUE. The change flag of the original object is unchanged.

[0448] It is the application's responsibility to delete the new object, freeing its memory, when no longer needed.

[0449] If the non-zero digits to the left of the decimal point in the result object would exceed (p−s)of the result, or if other errors occur that prevent the creation of the new object, an ICBCDecimal pointer with value −1 is returned.

[0450] ICBCDecimal::assignFromDecimal

[0451] Sets the value of the receiving ICBCDecimal object equal to that of the second ICBCDecimal object. The precision and scale of the receiving object are not changed.

[0452] IDL Syntax

[0453] ICBCDecimal assignFromDecimal(in ICBCDecimal aDecimal);

[0454] Remarks

[0455] If the non-zero digits to the left of the decimal point in the source object exceed (p1−s1) of the receiving object (i.e.,the whole number of the source object will not fit in the receiving object), the receiving object is unchanged, and a following invocation of decimalOverflow( ) on the receiving object function will return the value TRUE.

[0456] The scale of the source object is reduced to fit the scale of the receiving object, if necessary, by truncating digits from the right.

[0457] Any remainder value in the source object resulting from a preceding division operation is not transferred to the receiving object.

[0458] The change flag of the receiving object is set to TRUE.

[0459] Note that this operation preserves the precision and scale of the receiving object, as in a DB2 regular assignment between two decimal types. In contrast, the ICBCDecimal::initializeFromDecimal( ) function sets the precision and scale of the receiving object, as in the DB2 DECIMAL built-in function.

[0460] ICBCDecimal::assignFromDouble

[0461] Sets the value of a receiving ICBCDecimal object equal to a double variable. The precision and scale of the object is not changed.

[0462] IDL Syntax

[0463] ICBCDecimal assignFromDouble(in double aDouble);

[0464] Remarks

[0465] The operand is converted to a temporary decimal object of precision 38. Numbers less than 0.5E-38 will be rounded to zero. The temporary decimal number is then converted to the precision and scale of the receiving ICBCDecimal object.

[0466] If the non-zero digits to the left of the decimal point in the source object exceed (p1−s1) of the receiving object (i.e., the whole number portion of the source object will not fit in the receiving object), the receiving object is unchanged, and a following invocation of decimalOverflow( ) function on the receiving object will return the value TRUE.

[0467] ICBCDecimal::assignFromFloat

[0468] Sets the value of a receiving ICBCDecimal object equal to a float variable. The precision and scale of the object is not changed.

[0469] IDL Syntax

[0470] ICBCDecimal assignFromFloat(in float aFloat);

[0471] Remarks

[0472] The operand is converted to a temporary decimal object of precision 38. Numbers less than 0.5E-38 will be rounded to zero. The temporary decimal number is then converted to the precision and scale of the receiving ICBCDecimal object.

[0473] If the non-zero digits to the left of the decimal point in the source object exceed p1−s1) of the receiving object (i.e., the whole number portion of the source object will not fit in the receiving object), the receiving object is unchanged, and a following invocation of decimalOverflow( ) function on the receiving object will return the value TRUE.

[0474] ICBCDecimal::assignFromLong

[0475] Sets the value of a receiving ICBCDecimal object equal to a long variable. The precision and scale of the object is not changed.

[0476] IDL Syntax

[0477] ICBCDecimal assignFromLong(in long aLong);

[0478] Remarks

[0479] The operand is converted to a temporary decimal number, of precision 11 which is then converted to the precision and scale of the receiving object.

[0480] If the non-zero digits to the left of the decimal point in the source object exceed (p1−s1) of the receiving object (i.e., the whole number portion of the source object will not fit in the receiving object), the receiving object is unchanged, and a following invocation of decimalOverflow( ) function will return the value TRUE on the receiving object.

[0481] ICBCDecimal::assignFromShort

[0482] Sets the value of a receiving ICBCDecimal object equal to a short variable. The precision and scale of the object is not changed.

[0483] IDL Syntax

[0484] ICBCDecimal assignFromShort(in short aShort);

[0485] Remarks

[0486] The operand is converted to a temporary decimal number, of precision 5 which is then converted to the precision and scale of the receiving object.

[0487] If the non-zero digits to the left of the decimal point in the source object exceed (p1−s1) of the receiving object (i.e., the whole number portion of the source object will not fit in the receiving object), the receiving object is unchanged, and a following invocation of decimalOverflow( ) function on the receiving object will return the value TRUE.

[0488] ICBCDecimal::_create

[0489] Returns a pointer to a new ICBCDecimal object. The object is initialized to zero, with precision=1 and scale=0.

[0490] ICBCDecimal::decimalOverflow

[0491] Following certain functions that potentially cause a precision overflow in a ICBCDecimal object, this function indicates whether an overflow did, in fact, take place. If the most recent initialization, assignment, or arithmetic operation caused an overflow, this function will return TRUE. Otherwise it returns FALSE. Intervening query or comparison operations will not affect the returned value.

[0492] IDL Syntax

[0493] boolean decimalOverflow( );

[0494] ICBCDecimal::decrement

[0495] Subtracts the argument ICBCDecimal object from the receiving ICBCDecimal object and sets the value of the receiving object to the result. The precision and scale of the receiving object are reset.

[0496] The precision is given by:

[0497] min(38, max(p1−s1, p2−s2)+max(s1, s2)+1)

[0498] The scale is given by:

[0499] max(s1, s2)

[0500] If the non-zero digits to the left of the decimal point in the result exceed p−s) of the result, the receiving object is not changed, and a following invocation of the function decimalOverflow( ) will return TRUE.

[0501] The change flag of the receiving object is set to TRUE.

[0502] IDL Syntax

[0503] ICBCDecimal decrement(in ICBCDecimal aDecimal);

[0504] ICBCDecimal::divideThisObjectBy

[0505] Divides the receiving object by the argument ICBCDecimal object, and sets the receiving object to the quotient. The precision and scale of the receiving object are reset.

[0506] The precision is 38.

[0507] The scale is given by:

[0508] 38−p1+s1−s2

[0509] Scale may not be negative.

[0510] The division proceeds as far as possible within these limits for the quotient and then stops. Any remainder can be retrieved using the getPrecedingRemainder( ) function (see ICBCDecimal::getPreceedingRemainder).

[0511] This function does not cause any overflow conditions. However, the decimalOverflow( ) function is used to warn of zeroDivide situations, returning TRUE if a zeroDivide occured in the preceding divideThisObjectBy( ) function, and FALSE if it did not.

[0512] After a divideThisObjectBy operation, the change flag of the receiving object is set to TRUE. For example, 200.00 (precision 5, scale 2) divided by 3.00 (precision 3, scale 2) returns a quotient of precision 38 and scale 33:

[0513] 00066.666666666666666666666666666666666

[0514] A subsequent call to getPrecedingRemainder( ) on the same object returns a remainder with precision 38 and scale 35:

[0515] 000.00000000000000000000000000000000200

[0516] IDL Syntax

[0517] ICBCDecimal divideThisObjectBy(in ICBCDecimal aDecimal);

[0518] ICBCDecimal::divideWithNewObject

[0519] Divides the receiving object and the argument ICBCDecimal object, and returns a new ICBCDecimal object containing the quotient. The original operand objects are unchanged.

[0520] The precision of the result object is 38.

[0521] The scale is: 38−p1+s1−s2

[0522] IDL Syntax

[0523] ICBCDecimal divideWithNewObject(in ICBCDecimal aDecimal);

[0524] Remarks

[0525] The division proceeds as far as possible within these limits and then stops. Any remainder can be retrieved using the getPrecedingRemainder( ) function (see ICBCDecimal::getPreceedingRemainder).For an example of a divide operation, see ICBCDecimal::divideThisObjectBy.

[0526] After a divideWithNewObject operation, the change flag of the new object is set to TRUE. The change flag of the original object is unchanged.

[0527] It is the application's responsibility to delete the new remainder object, freeing its memory, when no longer needed.

[0528] This function does not cause any overflow conditions, but may encounter a zeroDivide situation. If so, or if other errors occured that prevented the creation of the new object, an ICBCDecimal pointer with value −1 is returned.

[0529] ICBCDecimal::equalTo

[0530] Returns TRUE if the value of the receiving ICBCDecimal object is equal to the other ICBCDecimal object.

[0531] IDL Syntax

[0532] boolean equalTo(in ICBDecimal aDecimal);

[0533] ICBCDecimal::getAsDouble

[0534] Returns the value of the receiving object as a double. Since the double representation has maximum precision less than that of a decimal data type in DB2, accuracy of the object value may be lost.

[0535] IDL Syntax

[0536] double getAsDouble( );

[0537] ICBCDecimal::getAsFloat

[0538] Returns the value of the receiving object as a float. Since the float representation has maximum precision less than that of a decimal data type in DB2, accuracy of the object value may be lost.

[0539] IDL Syntax

[0540] double getAsFloat( );

[0541] ICBCDecimal::getAsFormattedString1

[0542] Returns the value of the receiving object as a formatted string. This function is equivalent to the CHAR( ) built-in function of DB2.

[0543] The application must supply a non-const pointer to a target storage area long enough to receive the formatted decimal number. The function returns a reference to this area.

[0544] IDL Syntax

[0545] string getAsFormattedString1(inout string aOutput, in char aDecimalCharacter);

[0546] Parameters

[0547] AdecimalCharacter

[0548] aDecimalCharacter must be a single character to be used as the “decimal point” character in the output.The characters plus (+) and minus (−) are not permitted, and blanks are not permitted.

[0549] The length of the output string is always precision +2, where precision is the current precision of the object. One of the additional character positions is always used for the decimal point. If required, the the additional character position is used for a leading sign. If a sign is not required, the output string will have a trailing blank. Leading and trailing padding zeros are provided if necessary to fill the current precision and scale of the object.

[0550] For example, assuming an aDecimalCharacter of ‘.’: 4 Value Precision Scale Prints as 45 2 0 “45.” 123.33 9 4 “00123.3300” −123.33 9 4 “−00123.3300”

[0551] ICBCDecimal::getAsFormattedString2

[0552] Returns the value of the receiving object as a string formatted without leading zero padding. The application must supply a non-const pointer to a target storage area long enough to receive the formatted decimal number. The function returns a reference to this area.

[0553] IDL Syntax

[0554] string getAsFormattedString2(inout string aOutput, in char aDecimalCharacter);

[0555] Parameters

[0556] ADecimalCharacter

[0557] ADecimalCharacter must be a single character to be used as the “decimal point” character in the output. The characters plus (+) and minus (−) are not permitted, and blanks are not permitted. The length of the output string is always precision +2, where precision is the current precision of the object. The leftmost character position is reserved for the sign, if necessary. The following positions contain the the number, with an embedded decimal point, which is always present, even if the scale of the number is zero. The digits in the number are padded with leading blanks and trailing zeros to fill the full current precision and scale of the object. Finally, if leading blanks are present, the sign moves to a position immediately adjacent to the first digit (or decimal point).

[0558] For example, assuming an aDecimalCharacter of ‘.’, and showing blank as the character ‘b’: 5 Value Precision Scale Prints as 45 2 0 “b45.” 123.33 9 4 “bbb123.3300” −123.33 9 4 “bb−123.3300”

[0559] ICBCDecimal::getAsFormattedString3

[0560] Returns the value of the receiving object formatted as a left justified string with a leading sign if required, and a decimal point only if there are digits that lie to the right of the decimal point. There are no leading or trailing zeros or blanks.

[0561] The application must supply a non-const pointer to a target storage area long enough to receive the formatted decimal number. The function returns a reference to this area.

[0562] IDL Syntax

[0563] string getAsFormattedString3(inout string aOutput, in char aDecimalCharacter);

[0564] Parameters

[0565] aDecimalCharacter

[0566] aDecimalCharacter must be a single character to be used as the “decimal point” character in the output. The characters plus (+) and minus (−) are not permitted, and blanks are not permitted.

[0567] The length of the output string is variable, containing only enough characters to hold the significant digits plus a sign and a decimal point if required. The precision and scale of the object are not reflected in the length output string.

[0568] This format is suitable for providing to the Oracle TO_NUMBER function without the need for an associated “NUMBER format element” parameter.

[0569] For example, assuming an aDecimalCharacter of ‘.’: 6 Value Precision Scale Prints as 45 2 0 “45.” 123.33 9 4 “123.33” −123.33 9 4 “−123.33”

[0570] ICBCDecimal::getAsDigits

[0571] Returns a null terminated string of length equal to the precision of the object, containing the digits in the value of the object, left justified, and without either decimal point or sign. Leading zeros are provided if necessary.For example, an object of precision and scale of 6 and 2 respectively, containing a value of −6.28 would return a string containing ‘000628’.

[0572] IDL Syntax

[0573] string getAsDigits(inout string aOutput);

[0574] Remarks

[0575] The application must supply a non-const pointer to a target storage area long enough to receive the digits and null terminator. The function returns a reference to this area.

[0576] ICBCDecimal::getAsLong

[0577] Returns the value of the receiving object as a long. All digits in the object value that lie to the right of the decimal point will be truncated. It is a user responsibility to ensure that the value of the object does not exceed the range for a long data type.

[0578] IDL Syntax

[0579] double getAsLong( );

[0580] ICBCDecimal::getAsPackedDecimal

[0581] Returns the value of the object as a packed decimal string.

[0582] The format of the returned packed string will one of the following:

[0583] [dd]..[ds] if the number of digits is odd

[0584] [Od]..[ds] if the number of digits is even

[0585] where [ ] denotes a single byte containing two 4-bit nibbles, d is a four-bit binary digit, 0 is a 4-bit binary zero, and s is a 4-bit sign representation. A hexadecimal value “C” denotes the positive sign, and “D” the negative sign. A sign is always present in the lower order four bits of the rightmost byte.

[0586] Parameters

[0587] There is no decimal point embedded in the string. Output parameters are updated to describe the precision (aPrecision), and scale (aScale), of the packed string aScale.

[0588] IDL Syntax

[0589] string getAsPackedDecimal(inout string aOutput, inout short aPrecision, inout short aScale);

[0590] Remarks

[0591] Because of the presence of the sign, and the packing of two digits per byte, strings with an even number of bytes will have a leading zero padding character.

[0592] It is the responsibility of the application to provide a string of sufficient length to receive the packed string, with its sign and leading zero (if present). On return, a null terminator is appended to the end of the string.

[0593] ICBCDecimal::getAsShort

[0594] Returns the value of the receiving object as a short. All digits in the object value that lie to the right of the decimal point will be truncated. It is a user responsibility to ensure that the value of the object does not exceed the range for a long data type.

[0595] IDL Syntax

[0596] double getAsShort( );

[0597] ICBCDecimal::getPreceedingRemainder

[0598] Returns a new object containing the remainder value of an immediately preceding division operation. This function may be invoked on an object that has been the subject of a divideThisObjectBy( ) operation, or on the new object produced by a divideWithNewObject( ) operation. This function will only return a meaningful result if used immediately after a divide operation. If used following any other manipulation function it will return an object with a zero value.

[0599] The precision of the result object is 38.

[0600] The scale is: 38−p1+s1

[0601] IDL Syntax

[0602] ICBCDecimal getPreceedingRemainder( );

[0603] Remarks

[0604] If errors occur that prevent creation of the new object, a ICBCDecimal pointer with value−1 is returned.

[0605] If a division operation has already been performed, this function is a more efficient way of obtaining the remainder than issuing a remainderInThisObject( ) or remainderWithNewObject( ). This function retrieves the remainder that was cached in the object as a by-product of the preceding divide operation, whereas the latter two functions perform an implicit divide to calculate the remainder.

[0606] It is the application's responsibility to delete the new remainder object, freeing its memory, when no longer needed.

[0607] ICBCDecimal::getPrecision

[0608] Returns the precision of the object—the maximum number of digits that make up the value of the object. Precision is conceptually similar to the precision of a DB2 column. For example, an object with precision and scale of 5 and 2 respectively can store numbers up to value 999.99, but could not store numbers 1000.00, nor 999.991, nor 99.991. Precision is set by an ICBCDecimal::initialize..( ) function, and is generally retained by the object through its lifetime unless changed by arithmetic functions.

[0609] IDL Syntax

[0610] short getPrecision( );

[0611] ICBCDecimal::getScale

[0612] Returns the scale of the object. Scale, like precision (see ICBCDecimal::getPrecision), is set by the ICBCDecimal::initialize..( ) functions, and is generally retained by the object through its lifetime unless changed by arithmetic operations.

[0613] IDL Syntax

[0614] short getScale( );

[0615] ICBCDecimal::greaterThan

[0616] Returns TRUE if the value of the receiving ICBCDecimal object is greater than the other ICBCDecimal object.

[0617] IDL Syntax

[0618] boolean greaterThan(in ICBCDecimal aDecimal);

[0619] ICBCDecimal::greaterThanOrEqualTo

[0620] Returns TRUE if the value of the receiving ICBCDecimal object is greater than or equal to the other ICBCDecimal object.

[0621] IDL Syntax

[0622] boolean greaterThanOrEqualTo(in ICBCDecimal aDecimal);

[0623] ICBCDecimal::increment

[0624] Adds the argument ICBCDecimal object to the receiving ICBCDecimal object and sets the value of the receiving object to the result. The precision and scale of the receiving object are reset. The precision is given by:

[0625] min(38, max(1−s1, p2−s2)+max(s1, s2)+1)

[0626] The scale is given by:

[0627] max(s1, s2)

[0628] If the non-zero digits to the left of the decimal point in the result exceed (p−s) of the result, the receiving object is not changed, and a following invocation of the function decimalOverflow( ) will return TRUE.

[0629] After an increment operation, the change flag of the receiving object is set to TRUE.

[0630] IDL Syntax

[0631] ICBCDecimal increment(in ICBCDecimal aDecimal);

[0632] ICBCDecimal::initializeFromDecimal1

[0633] Initializes the receiving object with the value of the argument ICBCDecimal object, and sets its precision and scale to the values of the parameters.

[0634] IDL Syntax

[0635] boolean initializeFromDecimal1(in ICBCDecimal aDecimal in short precision, in short scale);

[0636] Remarks

[0637] This function requires parameters to be explicitly specified for the precision and scale of the receiving object, precision must be a number between zero and 38. If zero, a default value of 15 is assumed, scale must be a number between C and the value of precision. If precision is zero, the value of scale is ignored and the scale of the object is taken to be zero. The value of precision—scale must be sufficient to contain the digits to the left of the decimal point in the source ICBCDecimal object. If scale is insufficient to contain the digits to the right of the decimal point, those digits will be truncated from the right.

[0638] The difference between this function and ICBCDecimal::assignFromDecimal( ) is that this function sets the precision and scale of the receiving object, whereas ICBCDecimal::assignFromDecimal( ) leaves the existing precision and scale of the receiving object unchanged.

[0639] If the the object can be successfully initialized from the other Decimal object, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0640] ICBCDecimal::initializeFromDecimal2

[0641] Initializes the receiving object with the value of the argument ICBCDecimal object, and sets its precision and scale to the values of the parameters.

[0642] IDL Syntax

[0643] boolean initializeFromDecimal2(in ICBCDecimal aDecimal);

[0644] Remarks

[0645] This function has no explicit parameters for precision and scale. The precision and scale of the receiving object are set to the same values as the source Decimal object.

[0646] The difference between this function and ICBCDecimal::assignFromDecimal( ) is that this function sets the precision and scale of the receiving object, whereas ICBCDecimal::assignFromDecimal( ) leaves the existing precision and scale of the receiving object unchanged.

[0647] If the the object can be successfully initialized from the other Decimal object, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0648] ICBCDecimal::initializeFromDouble

[0649] Initializes the receiving object with the value of an argument of type double, and sets its precision and scale.

[0650] IDL Syntax

[0651] boolean initializeFromDouble(in double aDouble in short precision, in short scale);

[0652] Parameters Precision

[0653] scale

[0654] Precision must be a number between zero and 38. A zero value implies that the application is not supplying values for precision or scale. In this case, a default value of 15 is assumed.

[0655] Scale must be a number between 0 and the value of precision. If precision is zero, the value of scale is ignored and a value of zero is assumed.

[0656] Remarks

[0657] If the the object can be successfully initialized with the numeric operand, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0658] Precision and scale must be such that (precision—scale) is sufficient to contain the digits to the left of the decimal point in the numeric operand. If scale is insufficient to contain the digits to the right of the decimal point, those digits will be truncated from the right.

[0659] ICBCDecimal::initializeFromFloat

[0660] Initializes the receiving object with the value of an argument of type float, and sets its precision and scale.

[0661] IDL Syntax

[0662] boolean initializeFromFloat(in float aFloat in short precision, in short scale);

[0663] Parameters Precision

[0664] scale

[0665] Precision must be a number between zero and 38. A zero value implies that the Precision application is not supplying values for precision or scale. In this case, a default value of 15 is assumed.

[0666] Scale must be a number between 0 and the value of precision. If precision is zero, the value of scale is ignored and a value of zero is assumed.

[0667] Remarks

[0668] If the the object can be successfully initialized with the numeric operand, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0669] Precision and scale must be such that (precision—scale) is sufficient to contain the digits to the left of the decimal point in the numeric operand. If scale is insufficient to contain the digits to the right of the decimal point, those digits will be truncated from the right.

[0670] ICBCDecimal::initializeFromLong

[0671] Initializes the receiving object with the value of an argument of type long, and sets its precision and scale.

[0672] IDL Syntax

[0673] boolean initializeFromLong(in long along in short precision, in short scale);

[0674] Parameters Precision

[0675] scale

[0676] Precision must be a number between zero and 38. A zero value implies that the Precision application is not supplying values for precision or scale. In this case, a default value of 11 is assumed.

[0677] Scale must be a number between 0 and the value of precision. If precision is zero, the value of scale is ignored and a value of zero is assumed.

[0678] Remarks

[0679] If the the object can be successfully initialized with the numeric operand, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0680] Precision and scale must be such that (precision—scale) is sufficient to contain the digits in the numeric operand.

[0681] ICBCDecimal::initializeFromPackedDecimal

[0682] Accepts a value in the form of a packed decimal string.

[0683] IDL Syntax

[0684] boolean initializeFromPackedDecimal(in string aString, in short aPrecision, in short aScale);

[0685] Parameters

[0686] aString

[0687] Precision

[0688] scale

[0689] must have one of the following forms:

[0690] [dd][dd]...[ds] if number of digits is odd

[0691] [0d][dd]...[ds] if number of digits is even

[0692] Where [ ] denotes a byte containing two 4-bit “nibbles”, d is a four-bit binary digit, 0 is a 4-bit binary zero, and s is a 4-bit sign representation. The hexadecimal value “C” is interpreted as the positive sign, and “D” as the negative sign. There is no embedded decimal point. The scale of the object is defined by the scale input argument aScale. The number of digits unpacked from aString is defined by the aPrecision argument. The sign is always present in the lower order four bits of the rightmost byte. Because of the presence of the sign, and the packing of two digits per byte, strings with an even number of bytes will have a leading zero padding character.

[0693] This format is consistent with that used by DB2 for packed decimal variables passed to an application program.

[0694] This must be a number between zero and 38, and must always be present. There is no default.

[0695] This parameter must be a number between 0 and the value of precision. It indicates the number of digits that lie to the right of the decimal point. It must always be present.

[0696] There is no default. A null terminator character on the packed string is not required, but is tolerated if present.

[0697] Remarks

[0698] If the string is a valid packed decimal representation and the object is successfully initialized, TRUE is returned and any existing value in the object is replaced. Returns FALSE if the parameter is invalid. If FALSE is returned the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0699] ICBCDecimal::initializeFromShort

[0700] Initializes the receiving object with the value of an argument of type short, and sets its precision and scale.

[0701] IDL Syntax

[0702] boolean initializeFromShort(in short aShort in short precision, in short scale);

[0703] Parameters precision

[0704] scale

[0705] Precision must be a number between zero and 38. A zero value implies that the application is not supplying values for precision or scale. In this case, a default value of 5 is assumed.

[0706] Scale must be a number between 0 and the value of precision. If precision is zero, the value of scale is ignored and a value of zero is assumed.

[0707] Remarks

[0708] If the the object can be successfully initialized with the numeric operand, TRUE is returned and any existing value in the object is replaced. If the initialization cannot be performed, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0709] Precision and scale must be such that (precision—scale) is sufficient to contain the digits in the numeric operand.

[0710] ICBCDecimal::initializeFromString1

[0711] Accepts a value for this decimal object in the form of a string, specified values for precision and scale of the object, and the character that is used in the string as the decimal point (if any).

[0712] IDL Syntax

[0713] boolean initializeFromString1(in string aString, in short precision, in short scale, in char decimalChar);

[0714] Parameters

[0715] A String

[0716] decimalChar

[0717] precision

[0718] scale

[0719] The parameter aString must be of the form:

[0720] A String [spaces][sign][zeros][digits][decimal point][digits][zeros]&lbrk.spaces]

[0721] A negative sign is ignored if the value represented by the string is zero. decimalChar must be a single character that is used in aString to represent the decimal point. The characters plus (+) and minus (−) are not permitted, and blanks are not permitted.

[0722] Precision must be a number between zero and 38. If the value is zero, a default precision of 15 and a default scale of zero are used (the parameter for scale is ignored in this case). Otherwise the parameter values for precision and scale are used.

[0723] Scale must be a number between 0 and the value of precision. It indicates the number of digits that lie to the right of the decimal point. Note that if the parameter precision is zero, the value of scale is ignored and a default scale of zero is used.

[0724] Remarks

[0725] If the parameters are valid, TRUE is returned and any existing value in the object is replaced. If the parameter is invalid, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0726] Precision and scale must be such that (precision—scale) is sufficient to contain the non-zero characters to the left of the decimal point in aString. If scale is insufficient to contain the characters to the right of the decimal point, those characters will be truncated from the right.

[0727] ICBCDecimal::initializeFromString2

[0728] Accepts a value for this decimal object in the form of a string, and the character used in the string as a decimal point.

[0729] IDL Syntax

[0730] boolean initializeFromString2(in string aString, in char aDecimalChar);

[0731] Remarks

[0732] The precision and scale of the object are set to the actual precision and scale of the string parameter. The precision is the total number of digits, including leading and trailing zeros. The scale is the number of digits to the right of the decimal point, including trailing zeros. In other respects, this function behaves the same as ICBCDecimal::initializeFromString1( ).

[0733] If the input parameters are valid, TRUE is returned and any existing value in the object is replaced. If the parameter is invalid, FALSE is returned and the state of the object is unchanged, except that, if the FALSE return resulted from a numeric overflow, a following invocation of the decimalOverflow( ) function against the object will return the value TRUE.

[0734] ICBCDecimal::isChanged

[0735] Returns a boolean indicating whether the the value of the receiving object has been changed since its initialization. All initialization functions set a changed flag in the object to FALSE. All arithmetic and assignment functions set the flag TRUE. Query functions do not affect the changed flag.

[0736] IDL Syntax

[0737] boolean isChanged( );

[0738] ICBCDecimal::isNegative

[0739] Returns a boolean indicating whether the the value of the receiving object is less than zero.

[0740] IDL Syntax

[0741] boolean isNegative( );

[0742] ICBCDecimal::lessThan

[0743] Returns TRUE if the value of the receiving ICBCDecimal object is less than the other ICBCDecimal object.

[0744] IDL Syntax

[0745] boolean lessThan(in ICBCDecimal aDecimal);

[0746] ICBCDecimal::lessThanOrEqualTo

[0747] Returns TRUE if the value of the receiving ICBCDecimal object is less than or equal to the other ICBCDecimal object.

[0748] IDL Syntax

[0749] boolean lessThanOrEqualTo(in ICBCDecimal aDecimal);

[0750] ICBCDecimal::multiplyWithNewObject

[0751] Multiplies the receiving object by the argument ICBCDecimal object and returns a new ICBCDecimal object containing the result. The original operand objects are unchanged. The precision of the result object is:

[0752] min(38,p1+p2)

[0753] The scale is: min(38, s1+s2)

[0754] IDL Syntax

[0755] ICBCDecimal multiplyWithNewObject(in ICBCDecimal aDecimal);

[0756] Remarks

[0757] After a multiplyWithNewObject operation, the change flag of the new object is set to TRUE. The change flag of the original object is unchanged.

[0758] It is the application's responsibility to delete the new object, freeing its memory, when no longer needed.

[0759] If the non-zero digits to the left of the decimal point in the result object would exceed (p−s)of the result, or if other errors occur that prevent the creation of the new object, an ICBCDecimal pointer with value −1 is returned.

[0760] ICBCDecimal::notEqualTo

[0761] The opposite of the operator==member.

[0762] IDL Syntax

[0763] boolean notEqualTo(in ICBCDecimal aDecimal);

[0764] ICBCDecimal::multiplyThisObjectBy

[0765] Multiplies the receiving object by the argument ICBCDecimal object, and sets the receiving object to the result. The precision and scale of the receiving object are reset. The precision is given by:

[0766] min(38, p1+p2)

[0767] The scale is given by:

[0768] min(38, s1+s2)

[0769] If the non-zero digits to the left of the decimal point in the results exceed (p−s) of the result, the object is not changed, and a following invocation of the function decimalOverflow( ) will return TRUE.

[0770] The change flag of the receiving object is set to TRUE.

[0771] IDL Syntax

[0772] ICBCDecimal multiplyThisObjectBy(in ICBCDecimal aDecimal);

[0773] ICBCDecimal::remainderInThisObject

[0774] Divides the receiving object by the argument ICBCDecimal object, and sets the receiving object to the remainder of the division operation. The precision and scale of the receiving object are reset.

[0775] The change flag of the receiving object is set to TRUE.

[0776] The precision is: 38.

[0777] The scale is: 38−p1+s1

[0778] IDL Syntax

[0779] ICBCDecimal remainderInThisObject(in ICBCDecimal aDecimal);

[0780] ICBCDecimal::remainderWithNewObject

[0781] Divides the receiving object by the argument ICBCDecimal object and returns a new ICBCDecimal object containing the remainder. The original operand objects are unchanged.

[0782] The precision of the result object is 38.

[0783] The scale is: 38−p1+s1

[0784] IDL Syntax

[0785] ICBCDecimal remainderWithNewObject(in ICBCDecimal aDecimal);

[0786] Remarks

[0787] This function does not cause any overflow conditions, but may encounter a zeroDivide situation. If so, or if errors occur that prevent the recreation of the new object, a ICBCDecimal pointer with value −1 is returned.

[0788] After a remainderWithNewObject operation, the change flag of the new object is set to TRUE. The change flag of the original object is unchanged.

[0789] It is the application's responsibility to delete the new object, freeing its memory, when no longer needed.

[0790] ICBCDecimal::subtractWithNewObject

[0791] Subtracts the argument ICBCDecimal object from the receiving object and returns a new ICBCDecimal object containing the result. The original operand objects are unchanged. The precision of the result object is:

[0792] min(38, max(p1−s1, p2−s2)+max(s1, s2)+1)

[0793] The scale is: max(s1, s2)

[0794] IDL Syntax

[0795] ICBCDecimal subtractWithNewObject(in ICBCDecimal aDecimal);

[0796] Remarks

[0797] After a subtractWithNewObject operation, the change flag of the new object is set to TRUE. The change flag of the original object is unchanged.

[0798] It is the application's responsibility to delete the new object, freeing its memory, when no longer needed.

[0799] If the non-zero digits to the left of the decimal point in the result object would exceed p−s) of the result, or if other errors occur that prevent the creation of the new object, an ICBCDecimal pointer with value −1 is returned.

[0800] ICBCDecimal::swapSign

[0801] This function is effectively a unary minus operator which reverses the sign of this ICBCDecimal object.

[0802] IDL Syntax

[0803] void swapSign( );

[0804] ICBCDuration Class

[0805] The class ICBCDuration represents the “Labeled Duration”, “Date Duration”, “Time Duration”, and “Timestamp Duration” constructs of DB2. Duration is a complementary data type to Date, Time, and Timestamp, and participates in SQL expressions. However, it is not, itself, stored in DB2 tables.

[0806] The class holds the value of a duration, and a record of whether this duration value is in units of years, months, days, hours, minutes seconds, or microseconds. The value can also be of a composite type defining a “Date Duration” of the form yyyymmdd, a “Time Duration” of the form hhmmss, or a “Timestamp Duration” of the form yyyymmddhhmmsszzzzzz.

[0807] Arithmetic between two ICBCDuration classes is not supported (This is consistent with DB2 support of Durations). However, they can be compared, and a unary minus operator (which swaps the sign) is provided.

[0808] IDL Interface Description

[0809] interface ICBCDuration :IManagedLocal::ILocalOnly 7 { enum durationType {YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS,   MICROSECONDS, DATE, TIME, TIMESTAMP}; // Object initialization // 1. Initializer for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND // and MICROSECOND durations boolean initializeLabeledDuration(in long aDuration,   in ICBCDuration::durationType aType); //Initializer for DATE and TIME durations boolean initializeDateTimeDuration(in long aValue1, in long aValue2,   in long aValue3,   in boolean aNegativeFlag,   in ICBCDuration::durationType aType); //Initializer for TIMESTAMP durations boolean initializeTimestampDuration(in long aValue1, in long aValue2,   in long aValue3, in long aValue4,   in long aValue5, in long aValue6,   in long aValue7,   in boolean aNegativeFlag); /* Comparisons */ boolean equalTo(in ICBCDuration aDuration); boolean notEqualTo(in ICBCDuration aDuration); boolean lessThan(in ICBCDuration aDuration); boolean lessThanOrEqualTo(in ICBCDuration aDuration); boolean greaterThan(in ICBCDuration aDuration); boolean greaterThanOrEqualTo(in ICBCDuration aDuration); /* Query functions */ ICBCDuration::durationType getType(); boolean isNegative(); long microsecond(); long second(); long minute(); long hour(); long day(); long month(); long year(); long size(in long aIntervalType); string formattedString(inout string aString); /* Manipulation functions */ void assignFromDuration(in ICBCDuration aDuration); void swapSign();  // unary minus };

[0810] Supported Methods

[0811] ICBCDuration::_create

[0812] ICBCDuration::initializeLabeledDuration

[0813] ICBCDuration::initializeDateTimeDuration

[0814] ICBCDuration::initializeTimestampDuration

[0815] ICBCDuration::equalTo

[0816] ICBCDuration::notEqualTo

[0817] ICBCDuration::lessThan

[0818] ICBCDuration::lessThanOrEqualTo

[0819] ICBCDuration::greaterThan

[0820] ICBCDuration::greaterThanOrEqualTo

[0821] ICBCDuration::formattedString

[0822] ICBCDuration::getType

[0823] ICBCDuration::isNegative

[0824] ICBCDuration::microSecond

[0825] ICBCDuration::second

[0826] ICBCDuration::minute

[0827] ICBCDuration::hour

[0828] ICBCDuration::day

[0829] ICBCDuration::month

[0830] ICBCDuration::year

[0831] ICBCDuration::assignFromDuration

[0832] ICBCDuration::size

[0833] swapSign

[0834] ICBCDuration::assignFromDuration

[0835] Sets all state data of this ICBCDuration object equal to the the other ICBCDuration object.

[0836] IDL Syntax

[0837] void assignFromDuration(in ICBCDuration aDuration);

[0838] ICBCDuration::_create

[0839] Returns a pointer to a new ICBCDuration object. The object is initialized to a type of “YEARS” and a value of zero.

[0840] ICBCDuration::day

[0841] Returns the day part of the ICBCDuration.

[0842] IDL Syntax

[0843] long day( );

[0844] ICBCDuration::equalTo

[0845] Returns TRUE if all state data of this ICBCDuration object is equal to the other ICBCDuration object.

[0846] IDL Syntax

[0847] boolean equalTo(in ICBCDuration aDuration);

[0848] ICBCDuration::formattedString

[0849] Returns the value of a DATE type duration as a string of the form yyyymmdd, a TIME type duration in the form hhmmss, or a TIMESTAMP duration in the form yyyymmddhhmmssmmmmmm. For other duration types this function returns a null string.

[0850] IDL Syntax

[0851] string formattedString(inout string aString);

[0852] The application must supply a non-const pointer to a target storage area long enough to receive the formatted date. The function returns a reference to this area, enabling the function to be nested in stream operations.

[0853] ICBCDuration::greaterThan

[0854] Returns TRUE if the value of this ICBCDuration object is greater than the other ICBCDuration object.

[0855] IDL Syntax

[0856] boolean greaterThan(in ICBCDuration aDuration);

[0857] ICBCDuration::greaterThanOrEqualTo

[0858] Returns TRUE if the value of this ICBCDuration object is greater than or equal to the other ICBCDuration object.

[0859] IDL Syntax

[0860] boolean greaterThanOrEqualTo(in ICBCDuration aDuration);

[0861] ICBCDuration::getType

[0862] Returns the type of this ICBCDuration. Returned values can be DATE, TIME, YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, MICROSECONDS.

[0863] IDL Syntax

[0864] ICBCDuration::durationType getType( );

[0865] ICBCDuration::hour

[0866] Returns the hour part of the ICBCDuration.

[0867] IDL Syntax

[0868] long hour( );

[0869] ICBCDuration::initializeDateTimeDuration

[0870] Accepts three numeric values, an indicator of the sign of the duration (positive or negative) and an indicator of the duration type.

[0871] IDL Syntax

[0872] boolean initializeDateTimeDuration(in long aValue1,

[0873] in long aValue2,

[0874] in long aValue3,

[0875] in boolean aNegativeFlag,

[0876] in ICBCDuration::durationType aType);

[0877] If the type indicator is DATE, then aValue1, aValue2, aValue3 must supply valid values for years, months, and days, respectively. Each value must be a positive number, or zero. If the supplied parameters are valid, returns TRUE, else returns FALSE.

[0878] If type indicator is TIME, then aValue1, aValue2, aValue3 must supply valid values for hours, minutes, and seconds, respectively.

[0879] Each value must be a positive number, or zero. If the supplied parameters are valid, returns TRUE, else returns FALSE.

[0880] ICBCDuration::initializeLabeledDuration

[0881] Accepts a single numeric value, and an indicator of the type of duration.

[0882] IDL Syntax

[0883] boolean initializeLabeledDuration(in long aDuration, in ICBCDuration::durationType aType);

[0884] The type indicator can be: YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, MICROSECONDS. The supplied values must be a positive number or zero.If the numeric value is valid, returns TRUE, otherwise returns FALSE. If the values are valid, any existing value in the object is replaced.

[0885] ICBCDuration::initializeTimestampDuration

[0886] Accepts seven numeric values, and an indicator of the sign of the duration (positive or negative).

[0887] IDL Syntax

[0888] boolean initializeTimestampDuration(in long aValue1,

[0889] in long aValue2,

[0890] in long aValue3,

[0891] in long aValue4,

[0892] in long aValue5,

[0893] in long aValue6,

[0894] in long aValue7,

[0895] in boolean aNegativeFlag);

[0896] The numeric values represent the years, months, days, hours, minutes, seconds, and microseconds portions of the timestamp duration. They must be positive numbers or zeros. If the supplied parameters are valid, returns TRUE, else returns FALSE.

[0897] ICBCDuration::isNegative

[0898] Returns a Boolean TRUE is this object's value is negative. Otherwise returns FALSE;

[0899] IDL Syntax

[0900] boolean isNegative( );

[0901] ICBCDuration::lessThan

[0902] Returns TRUE if the value of this ICBCDuration object is less than the other ICBCDuration object.

[0903] IDL Syntax

[0904] boolean lessThan(in ICBCDuration aDuration);

[0905] ICBCDuration::lessThanOrEqualTo

[0906] Returns TRUE if the value of this ICBCDuration object is less than or equal to the other ICBCDuration object.

[0907] IDL Syntax

[0908] boolean lessThanOrEqualTo(in ICBCDuration aDuration);

[0909] ICBCDuration::microSecond

[0910] Returns the microseconds part of the ICBCDuration.

[0911] IDL Syntax

[0912] long microSecond( );

[0913] ICBCDuration::minute

[0914] Returns the minute part of the ICBCDuration.

[0915] IDL Syntax

[0916] long minute( );

[0917] ICBCDuration::month

[0918] Returns the month part of the ICBCDuration.

[0919] IDL Syntax

[0920] long month( );

[0921] ICBCDuration::notEqualTo

[0922] The opposite of the equalTo operation.

[0923] IDL Syntax

[0924] boolean notEqualTo(in ICBCDuration aDuration);

[0925] ICBCDuration::second

[0926] Returns the seconds part of the ICBCDuration.

[0927] IDL Syntax

[0928] long second( );

[0929] ICBCDuration::size

[0930] Equivalent to the DB2 TIMESTAMPDIFF built-in function.

[0931] IDL Syntax

[0932] long size(in long aIntervalType);

[0933] Remarks

[0934] Returns the value of the timestamp duration converted to the interval type specified in the input parameter. If the parameter is not valid, a value of −1 is returned. Valid parameter values, and associated interval types are:

[0935] 1 Fractions of a second.

[0936] 2 Seconds.

[0937] 4 Minutes.

[0938] 8 Hours.

[0939] 16 Days.

[0940] 32 Weeks.

[0941] 64 Months.

[0942] 128 Quarters.

[0943] 256 Years.

[0944] The conversion is not precise. A standard length year and month are assumed, taking no account of leap years. Conversion factors used are as follows:

[0945] 365 days per year.

[0946] 30 days per month.

[0947] 24 hours per day.

[0948] 60 minutes per hour.

[0949] 60 seconds per minute.

[0950] ICBCDuration::year

[0951] Returns the year part of the ICBCDuration.

[0952] IDL Syntax

[0953] long year( );

[0954] swapSign

[0955] This function is effectively a unary minus operator which reverses the sign of this ICBCDuration object.

[0956] IDL Syntax

[0957] void swapSign( );

[0958] ICBCTime Class

[0959] The class stores the value of a time-of-day. All access and manipulation of this time is through a public functional interface. The actual time value and its format are stored in private attributes.

[0960] IDL Interface Description

[0961] interface ICBCTime :IManagedLocal::ILocalOnly 8 { /* Object initialization (DB2 semantics)*/ boolean initializeFromString(in string aTime); boolean initializeFromTimestamp(in ICBCTimestamp aTimestamp); boolean initializeFromValues(in long aHour,   in long aMinute,   in long aSecond); // Comparisons boolean equalTo(in ICBCTime aTime); boolean notEqualTo(in ICBCTime aTime); boolean lessThan(in ICBCTime aTime); boolean lessThanOrEqualTo(in ICBCTime aTime); boolean greaterThan(in ICBCTime aTime); boolean greaterThanOrEqualTo(in ICBCTime aTime); // Query functions (DB2 semantics) enum OutputFormat {ISO, USA, EUR, JIS, LOC}; string formattedString(inout string aOutput, in ICBCTime::OutputFormat aFormat); long second(); long minute(); long hour(); boolean isObjectChanged(); // Manipulation functions (DB2 semantics) void assignFromTime(in ICBCTime aTime); void increment(in ICBCDuration aDuration); void decrement(in ICBCDuration aDuration); long timeOverflow(); ICBCDuration intervalFromTime(in ICBCTime aTime); ICBCDuration intervalFromString(in string aTime); };

[0962] Supported Methods

[0963] ICBCTime::_create

[0964] ICBCTime::initializeFromString

[0965] ICBCTime::initializeFromTimestamp

[0966] ICBCTime::initializeFromValues

[0967] ICBCTime::equalTo

[0968] ICBCTime::notEqualTo

[0969] ICBCTime::lessThan

[0970] ICBCTime::lessThanOrEqualTo

[0971] ICBCTime::greaterThan

[0972] ICBCTime::greaterThanOrEqualTo

[0973] ICBCTime::formattedString

[0974] ICBCTime::second

[0975] ICBCTime::minute

[0976] ICBCTime::hour

[0977] ICBCTime::isObjectChanged

[0978] ICBCTime::assignFromTime

[0979] ICBCTime::increment

[0980] ICBCTime::decrement

[0981] ICBCTime::timeOverflow

[0982] ICBCTime::interval

[0983] ICBCTime::assignFromTime

[0984] Sets all state data in this ICBCTime object equal to the second ICBCTime object. The change flag of this object is set to TRUE.

[0985] IDL Syntax

[0986] void assignFromTime(in ICBCTime aTime);

[0987] ICBCTime::_create

[0988] Returns a pointer to a new ICBCTime object. The object is initialized to the current local time.

[0989] ICBCTime::decrement

[0990] Subtracts a ICBCDuration from the value of this ICBCTime object.

[0991] IDL Syntax

[0992] void decrement(in ICBCDuration aDuration);

[0993] Remarks

[0994] This operation is performed essentially as the inverse of the increment operation.

[0995] When a duration of type TIME is subtracted from a time, the time is decremented by the specified number of hours, minutes, and seconds, in that order.

[0996] If the hours value of the result of a decrement operation is negative, then enough whole periods of 24 hours are added to the value to make it positive. The number of 24 hour periods (i.e., days) thus added can be retrieved as a negative number using the timeOverflow( ) function.

[0997] Although a ICBCTime object with a value (expressed in ISO format) of 24.00.00 can be input to an increment or decrement operation, a time of 24.00.00 will never be returned as the result of the operation. Thus 24.00.00 plus or minus a zero duration will return the time 00.00.00.

[0998] The change flag of this object is set to TRUE.

[0999] ICBCTime::equalTo

[1000] Returns TRUE if the time in this ICBCTime object is equal to the other ICBCTime object. Note: Although 24.00.00 and 00.00.00 both represent midnight, ICBCTime considers that 24.00.00>00.00.00.

[1001] IDL Syntax

[1002] boolean equalTo(in ICBCTime aTime);

[1003] ICBCTime::formattedString

[1004] Returns the time value of this object as a string in a specified format. The parameter OutputType must take one the values: ISO, USA, EUR, JIS. Formats are as described for the function ICBCTime::initializeFromString( ). The LOC site-defined option described in the DB2 manual is not supported by ICBCTime.

[1005] IDL Syntax

[1006] string formattedString(inout string aOutput, in ICBCTime::OutputFormat aFormat);

[1007] The application must supply a non-const pointer to a target storage area long enough to receive the formatted time. The function returns a reference to this area.

[1008] ICBCTime::greaterThan

[1009] Returns TRUE if the time stored in this ICBCTime object is greater than the other ICBCTime object.

[1010] IDL Syntax

[1011] boolean greaterThan(in ICBCTime aTime);

[1012] ICBCTime::greaterThanOrEqualTo

[1013] Returns TRUE if the time stored in this ICBCTime object is greater than or equal to the other ICBCTime object.

[1014] IDL Syntax

[1015] boolean greaterThanOrEqualTo(in ICBCTime aTime);

[1016] ICBCTime::hour

[1017] Returns the hour part of the time.

[1018] IDL Syntax

[1019] long hour( );

[1020] ICBCTime::increment

[1021] Adds a ICBCDuration to the value of this ICBCTime object.

[1022] IDL Syntax

[1023] void increment (in ICBCDuration aDuration);

[1024] Remarks

[1025] If a duration of type HOURS is added to a time, only the hours portion of the time is affected. The minutes and seconds are unchanged.

[1026] Similarly, if a duration of type MINUTES is added to the time, only minutes and, if necessary, hours are affected.

[1027] Adding a duration of type SECONDS will, of course, affect the seconds portion of the time, and potentially the minutes and hours.

[1028] When a duration of type TIME is added to a time, the time is incremented by the specified number of hours, minutes, and seconds, in that order.

[1029] If the hours value of the result of an increment operation is greater than 24 hours, then the hours value is divided by 24 and the remainder stored in the hours value. The quotient of the division (the number of whole 24 hour periods or days in the original hours value) can be retrieved using the timeOverflow( ) function.

[1030] Although a ICBCTime object with a value (expressed in ISO format) of 24.00.00 can be input to an increment or decrement operation, a time of 24.00.00 will never be returned as the result of the operation. Thus 24.00.00 plus or minus a zero duration will return the time 00.00.00. The change flag of this object is set to TRUE.

[1031] ICBCTime::initializeFromString

[1032] Accepts a value for the time in the form of a string. Any existing value in the object is replaced. Returns TRUE if the string is a valid time representation and the object is successfully initialized. Returns FALSE if the parameter is invalid. If FALSE is returned the state of the object is unchanged.

[1033] IDL Syntax

[1034] boolean initializeFromString(in string aTime);

[1035] Parameters

[1036] The string must be either:

[1037] A valid string representation of a time, in one of the following valid forms.

[1038] International Standards Organization (ISO) (hh.mm.ss).

[1039] IBM USA standard (USA) (hh:mm AM or PM).

[1040] IBM European standard (EUR) (hh.mm.ss).

[1041] Japanese Industrial Standard Christian Era (JIS) (hh:mm:ss).

[1042] Atime

[1043] Leading and trailing blanks are acceptable provided the string length is less than 20 characters. Leading zeros can be omitted from the hours portion, and in ISO, EUR and JIS the seconds portion can be omitted completely. In the USA format, the minutes can be omitted. Zeros are assumed for omitted portions. In the USA time format, the hour cannot be greater than 12 and cannot be 0 except for the special case of 00:00 AM. Only SBCS characters may be present in the string.

[1044] A string representation of a timestamp. Any of the string forms acceptable by the ICBCTimestamp::initializeFromString( ) function are acceptable. For details refer to that function. Briefly, the forms include:

[1045] A punctuated string: yyyy-mm-dd-hh.mm.ss.nnnnnn.

[1046] A 14 byte string without punctuation, of the form: yyyymmddhhmmss.

[1047] ICBCTime::initializeFromTimestamp

[1048] Initializes this object from the time portion of a Timestamp object.

[1049] IDL Syntax

[1050] boolean initializeFromTimestamp(in ICBCTimestamp aTimestamp);

[1051] ICBCTime::initializeFromValues

[1052] Accepts the time in the form of three separate value parameters for hour, minute, and second.

[1053] The values must make a valid time.

[1054] Returns TRUE if the values are a valid time representation, FALSE otherwise. If FALSE is returned, the state of the object is unchanged.

[1055] IDL Syntax

[1056] boolean initializeFromValues(in long aHour, in long aMinute, in long aSecond);

[1057] ICBCTime::interval

[1058] Calculates the Duration between two ICBCTime objects. The result is a pointer to a new ICBCDuration object of type TIME.

[1059] If the interval between TIME1 and TIME2 is required, and TIME1 is greater than or equal to TIME2, the operation is performed by subtracting TIME2 from TIME1. If, however, TIME1 is less than TIME2, TIME1 is subtracted from TIME2, and the sign of the result is made negative. The following procedural description clarifies the steps involved in the operation result=TIME1−TIME2.

[1060] If SECOND (TIME2)<=SECOND (TIME1)

[1061] then SECOND(RESULT)=SECOND(TIME1)−SECOND(TIME2).

[1062] If SECOND(TIME2)>SECOND(TIME1)

[1063] then SECOND(RESULT)=60+SECOND(TIME1)−SECOND(TIME2). MINUTE(TIME2) is then incremented by 1.

[1064] If MINUTE(TIME2)<=MINUTE(TIME1)

[1065] then MINUTE(RESULT)=MINUTE(TIME1)−MINUTE(TIME2).

[1066] If MINUTE(TIME2)>MINUTE(TIME1)

[1067] then MINUTE(RESULT)=60+MINUTE(TIME1)−MINUTE(TIME2).

[1068] HOUR(TIME2) is then incremented by 1.

[1069] HOUR(RESULT)=HOUR(TIME1)−HOUR(TIME2).

[1070] IDL Syntax

[1071] ICBCDuration_ptr intervalFromTime(in ICBCTime aTime);

[1072] ICBCDuration_ptr intervalFromString(in string aTime);

[1073] In the case with a string parameter, the parameter must be a valid string representation of a time. For details see ICBCTime::initializeFromString.

[1074] If parameters to this function cannot be recognized as a valid time, then a pointer value of −1 is returned.

[1075] ICBCTime::isObjectChanged

[1076] Returns a boolean indicating whether the value of this object has been changed since it was initialized.

[1077] IDL Syntax

[1078] boolean isObjectChanged( );

[1079] ICBCTime::lessThan

[1080] Returns TRUE if the time stored in this ICBCTime object is less than the other ICBCTime object.

[1081] IDL Syntax

[1082] boolean lessThan(in ICBCTime aTime);

[1083] ICBCTime::lessThanOrEqualTo

[1084] Returns TRUE if the time stored in this ICBCTime object is less than or equal to the other ICBCTime object.

[1085] IDL Syntax

[1086] boolean lessThanOrEqualTo(in ICBCTime aTime);

[1087] ICBCTime::minute

[1088] Returns the minute part of the time.

[1089] IDL Syntax

[1090] long minute( );

[1091] ICBCTime::notEqualTo

[1092] The opposite of the operator==member.

[1093] IDL Syntax

[1094] boolean notEqualTo(in ICBCTime aTime);

[1095] ICBCTime::second

[1096] Returns the second part of the time.

[1097] IDL Syntax

[1098] long second( );

[1099] ICBCTime::timeOverflow

[1100] Returns the number of overflow or underflow days of a preceding increment or decrement operation. For an increment, returns the number of whole 24 hour periods (days) in the hours value of the result. For a decrement, returns the number of 24 hour periods necessary to restore the hours value of the result to a positive value.

[1101] IDL Syntax

[1102] long timeOverflow( );

[1103] ICBCTimestamp Class

[1104] The class stores the value of a DB2 Timestamp or an Oracle DATE type. All access and manipulation of this timestamp is through a public functional interface. The actual timestamp value is stored in a private attributes.

[1105] A Timestamp attribute in a Component Broker business object that originates from a DB2 database is represented by Component Broker as a 26 character string of form yyyy-mm-dd-hh.mm.ss.mmmmmm. This string can be used to initialize an ICBCTimestamp instance through the ICBCTimestamp::initializeFromString function. A DATE attribute that originates from an Oracle database is represented by Component Broker in the same 26 character form yyyy-mm-dd-hh.mm.ss.mmmmmm, but with the final six characters (the microseconds field) always set to zeros. This string can be used to initialize an ICBCTimestamp via ICBCTimestamp::initializeFromString. However, Oracle dates earlier than 0001-01-01 are rejected. Whether the ICBCTimestamp object is initialized from data originating in DB2 or in Oracle, ICBCTimestamp applies DB2 semantics in its processing of the data.

[1106] IDL Interface Description

[1107] interface ICBCTimestamp:IManagedLocal::ILocalOnly 9 { // Object initialization boolean initializeFromString(in string aTimestamp); boolean initializeFromDateTime(in ICBCDate aDate,    in ICBCTime aTime,    in long aMicroseconds); void initializeFromDate(in ICBCDate aDate); // Equivalent to TIMESTAMP_ISO void initiailizeFromTime(in ICBCTime aTime); // Equivalent to TIMESTAMP_ISO enum DatastoreType {ORCL}; boolean initializeFromDatastoreFormat(in string aTimestamp,    in ICBCTimestamp::DatastoreType    aDatastore); // Comparisons boolean equalTo(in ICBCTimestamp aTimestamp); boolean notEqualTo(in ICBCTimestamp aTimestamp); boolean lessThan(in ICBCTimestamp aTimestamp); boolean lessThanOrEqualTo(in ICBCTimestamp aTimestamp); boolean greaterThan(in ICBCTimestamp aTimestamp); boolean greaterThanOrEqualTo(in ICBCTimestamp aTimestamp); // Query functions enum OutputFormat {ISO, USA, EUR, JIS, LOC}; // gets whole timestamp as a string: string formattedString(inout string aOutput); string getAsDateFormattedString(inout string aTarget,    in ICBCTimestamp::OutputFormat aFormat); string getAsTimeFormattedString(inout string aTarget,    in ICBCTimestamp::OutputFormat aFormat); string getAsDatstoreFormat(inout string aTarget,    in ICBCTimestamp::DatastoreType aDatastore); long microsecond(); long second(); long minute(); long hour(); long day(); long month(); long year(); long dayOfWeek(); long dayOfYear(); long julianDay(); long modifiedJulianDay(); string dayName(); long dayFromString(in string aTimestamp); long dayOfWeekFromString(in string aTimestamp); long dayOfYearFromString(in string aTimestamp); long julianDayFromString(in string aTimestamp); long modifiedJulianDayFromString(in string aTimestamp); string dayNameFromString(in string aTimestamp); string dayNameFromNumber(in long aDayIndex); string monthName(); long monthFromString(in string aTimestamp); string monthNameFromString(in string aTimestamp); string monthNameFromNumber(in long aMonthIndex); long quarter(); long quarterFromString(in string aTimestamp); long yearFromString(in string aTimestamp); boolean isLeapYear(in long aYear); long daysInObject(); long daysInString(in string aTimestamp); long daysInMonth(in long aYear, in long aMonth); long daysInYear(in long aYear); boolean isObjectChanged(); // Manipulation functions void assignFromTimestamp(in ICBCTimestamp aTimestamp); void increment(in ICBCDuration aDuration); void decrement(in ICBCDuration aDuration); long timestampOverflow(); ICBCDuration intervalFromTimestamp(in ICBCTimestamp aTimestamp); ICBCDuration intervalFromString(in string aTimestamp); };

[1108] Supported Methods

[1109] ICBCTimestamp::_create

[1110] ICBCTimestamp::initializeFromString

[1111] ICBCTimestamp::initializeFromDateTime

[1112] ICBCTimestamp::initializeFromDate

[1113] ICBCTimestamp::initializeFromTime

[1114] ICBCTimestamp::equalTo

[1115] ICBCTimestamp::notEqualTo

[1116] ICBCTimestamp::lessThan

[1117] ICBCTimestamp::lessThanOrEqualTo

[1118] ICBCTimestamp::greaterThan

[1119] ICBCTimestamp::greaterThanOrEqualTo

[1120] ICBCTimestamp::formattedString

[1121] ICBCTimestamp::microsecond

[1122] ICBCTimestamp::second

[1123] ICBCTimestamp::minute

[1124] ICBCTimestamp::hour

[1125] ICBCTimestamp::day

[1126] ICBCTimestamp::month

[1127] ICBCTimestamp::year

[1128] ICBCTimestamp::dayOfWeek

[1129] ICBCTimestamp::dayOfYear

[1130] ICBCTimestamp::julianDay

[1131] ICBCTimestamp::modifiedJulianDay

[1132] ICBCTimestamp::dayName

[1133] ICBCTimestamp::dayFromString

[1134] ICBCTimestamp::dayOfWeekFromString

[1135] ICBCTimestamp::dayOfYearFromString

[1136] ICBCTimestamp::)julianDayFromString

[1137] ICBCTimestamp::modifiedJulianDayFromString

[1138] ICBCTimestamp::dayNameFromString

[1139] ICBCTimestamp::dayNameFromNumber

[1140] ICBCTimestamp::monthName

[1141] ICBCTimestamp::monthFromString

[1142] ICBCTimestamp::monthNameFromString

[1143] ICBCTimestamp::monthNameFromNumber

[1144] ICBCTimestamp::quarter

[1145] ICBCTimestamp::quarterFromString

[1146] ICBCTimestamp:.yearFromSting

[1147] ICBCTimestamp::isLeapYear

[1148] ICBCTimestamp::daysInObject

[1149] ICBCTimestamp::daysInString

[1150] ICBCTimestamp::daysInMonth

[1151] ICBCTimestamp::daysInYear

[1152] ICBCTimestamp::isObjectChanged

[1153] ICBCTimestamp::assignFromTimestamp

[1154] ICBCTimestamp::increment

[1155] ICBCTimestamp::decrement

[1156] ICBCTimestamp::timestampOverflow

[1157] ICBCTimestamp::interval

[1158] ICBCTimestamp::assignFromTimestamp

[1159] Sets all state data in this ICBCTimestamp object equal to the the second ICBCTimestamp object. The change flag of this object is set to TRUE.

[1160] IDL Syntax

[1161] ICBCTimestamp assignFromTimestamp(in ICBCTimestamp aTimestamp);

[1162] ICBCTimestamp::_create

[1163] Returns a pointer to a new ICBCTimestamp object. The object is initialized to today's date and the current local time with a miicroseconds value of zero.

[1164] ICBCTimestamp::day

[1165] Returns the day part of the timestamp.

[1166] IDL Syntax

[1167] long day( );

[1168] ICBCTimestamp::dayFromString

[1169] Returns the day part of the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1170] If the input parameter is not recognizable, a value of −1 is returned.

[1171] IDL Syntax

[1172] long dayFromString(in string aString);

[1173] ICBCTimestamp::dayName

[1174] Returns a string containing the name of the day of the week for this timestamp object.

[1175] IDL Syntax

[1176] long dayName( );

[1177] ICBCTimestamp::dayNameFromNumber

[1178] Returns a string containing the name of the day of the week for the day number within a week provided in the input parameter. The input parameter must be a number between 1 and 7. Sunday is day number 1.

[1179] If the in put parameter is not recognizable, an empty string is returned.

[1180] IDL Syntax

[1181] long dayNameFromNumber(in long aDayIndex);

[1182] ICBCTimestamp::dayNameFromString

[1183] Returns a string containing the name of the day of the week for for the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1184] If the input parameter is not recognizable, an empty string is returned.

[1185] IDL Syntax

[1186] long dayNameFromString(in string aTimestamp);

[1187] ICBCTimestamp::dayOfWeek

[1188] Returns a number between 1 and 7 representing the day of the week for this timestamp object. Sunday is day number 1.

[1189] IDL Syntax

[1190] long dayOfWeek( );

[1191] ICBCTimestamp::dayOfWeekFromString

[1192] Returns a number between 1 and 7 representing the day of the week for the timestamp encoded in the input string parameter. Sunday is day number 1.

[1193] The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCtimestamp::initializeFromString( ) for a description of supported formats.

[1194] If the input parameter is not recognizable, a value of −1 is returned.

[1195] IDL Syntax

[1196] long dayOfWeekFromString(in string aString);

[1197] ICBCTimestamp::dayOfYear

[1198] Returns a number between 1 and 366 representing the day of the year for this timestamp object. January 1 is day number 1.

[1199] IDL Syntax

[1200] long dayOfYear( );

[1201] ICBCTimestamp::dayOfYearFromString

[1202] Returns a number between 1 and 366 representing the day of the year for the timestamp encoded in the input string parameter. January 1 is day number 1.

[1203] The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1204] If the input parameter is not recognizable, a value of −1 is returned.

[1205] IDL Syntax

[1206] long dayOfYearFromString(in string aString);

[1207] ICBCTimestamp::daysInObject

[1208] The result is the number of days from Jan. 1, 0001 to the timestamp represented by this object, plus one day. i.e., an object holding a timestamp for date Jan. 2, 0001 returns the value 2.

[1209] IDL Syntax

[1210] long daysInObject( );

[1211] ICBCTimestamp::daysInMonth

[1212] Returns the number of days in the month of the year provided in the input parameters. Month number must be between 1 and 12. If the input parameters are not valid, a value of −1 is returned.

[1213] IDL Syntax

[1214] long daysInMonth(in long aYear, in long aMonth);

[1215] ICBCTimestamp::daysInString

[1216] The result is the number of days from Jan. 1, 0001 to the timestamp represented by the string parameter, plus one day. i.e., an object holding a timestamp for date 00010102 returns the value 2.

[1217] If the string is invalid, returns a value of −1.

[1218] IDL Syntax

[1219] long daysInString(in string aTimestamp);

[1220] The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCtimestamp::initializeFromString( ) for a description of supported formats. If the input parameter is not recognizable, a value of −1 is returned.

[1221] ICBCTimestamp::daysInYear

[1222] Returns the number of days in the year provided in the input parameter. If the input parameter is not valid, a value of −1 is returned. Returns the number of days in the year provided in the input parameter.

[1223] If the input parameter is not valid, a value of −1 is returned.

[1224] IDL Syntax

[1225] long daysInYear(in long aYear);

[1226] ICBCTimestamp::decrement

[1227] Subtracts a ICBCDuration from the value of this ICBCTimestamp object. No value is returned (i.e., this is effectively a −=operator).

[1228] Decrementing of a timestamp with a duration (of any type) is carried out on the date and time portions of the timestamp as described for ICBCDate and ICBCTime, except that any underflow of microseconds is satisfied from the seconds portion of the result timestamp, and any underflow of hours is satisfied from the days portion.

[1229] If the years value of the result of an decrement operation is less than 0001 years, then the years value of the result is set to 0001, and the number of “underflow” years can be retrieved as a negative number with the dateOverflow( ) function.

[1230] The change flag of this object is set to TRUE.

[1231] Although an ICBCTimestamp object with an time portion equal to 24.00.00 can be initialized, or returned from an ICBCTimestamp::interval operation, and can be input to an increment or decrement operation, such a timestamp is never be returned as a result of the increment or decrement operation. For the purposes of the calculation, the time portion of the timestamp is considered to be 00.00.00, with the days part incremented by 1. For example, a timestamp value of 1998-11-2-24.00.00.000000 plus or minus a zero duration will return the timestamp result 1998-11-3-00.00.00.000000.

[1232] IDL Syntax

[1233] void decrement(in ICBCDuration aDuration);

[1234] ICBCTimestamp::equalTo

[1235] Returns TRUE if the date and time this ICBCTimestamp object is equal to the other ICBCTimestamp object.

[1236] Note that because of the alternative representations of midnight it is possible to have two different timestamps that actually represent the same point in time, for example: 1997-11-02-24.00.00.000000 and 1997-11-03-00.00.00.000000. ICBCTimestamp compares timestamps by date portion, followed by time portion, and will consider that for timestamp pairs of this type, the timestamp with the higher day part is greater. e.g.: 1997-11-03-00.00.00.000000>1997-11-02-24.00.00.000000.

[1237] IDL Syntax

[1238] boolean equalTo(in ICBCTimestamp aTimestamp);

[1239] ICBCTimestamp::formattedString

[1240] Returns the value of this timestamp object as a string in the form yyyy-mm-dd-hh.mm.ss.mmmmmm.

[1241] The application must supply a non-const pointer to a target storage area long enough to receive the formatted timestamp. The function returns a reference to this area, enabling the function to be nested in stream operations.

[1242] IDL Syntax

[1243] string formattedString(inout string aOutput);

[1244] ICBCTimestamp::greaterThan

[1245] Returns TRUE if the date and time stored in this ICBCTimestamp object is greater than the other ICBCTimestamp object.

[1246] IDL Syntax

[1247] boolean greaterThan(m ICBCTimestamp aTimestamp);

[1248] ICBCTimestamp::greaterThanOrEqualTo

[1249] Returns TRUE if the date and time stored in this ICBCTimestamp object is greater than or equal to the other ICBCTimestamp object.

[1250] IDL Syntax

[1251] boolean greaterThanOrEqualTo(in ICBCTimestamp aTimestamp);

[1252] ICBCTimestamp::hour

[1253] Returns the hour part of the timestamp.

[1254] IDL Syntax

[1255] long hour( );

[1256] ICBCTimestamp::increment

[1257] Adds a ICBCDuration to the value of this ICBCTimestamp object.

[1258] Incrementing of a timestamp with a duration (of any type) is carried out on the date and time portions of the timestamp as described for ICBCDate and ICBCTime, except that any overflow of microseconds is carried into the seconds portion of the result timestamp, and any overflow of hours is carried into the days portion.

[1259] If the years value of the result of an increment operation is greater than 9999 years, then the years value of the result timestamp is set to 9999, and the number of overflow years can be retrieved using the dateOverflow( ) function.

[1260] The change flag of this object is set to TRUE.

[1261] Although an ICBCTimestamp object with an time portion equal to 24.00.00 can be initialized, or returned from an ICBCTimestamp::interval operation, and can be input to an increment or decrement operation, such a timestamp is never be returned as a result of the increment or decrement operation. For the purposes of the calculation, the time portion of the timestamp is considered to be 00.00.00, with the days part incremented by 1. For example, a timestamp value of 1998-11-2-24.00.00.000000 plus or minus a zero duration will return the timestamp result 1998-11-3-00.00.00.000000.

[1262] IDL Syntax

[1263] void increment(in ICBCDuration aDuration);

[1264] ICBCTimestamp::initializeFromString

[1265] Accepts a value for the time in the form of a string. Any existing value in the object is replaced. Returns TRUE if the string is a valid timestamp representation and the object is successfully initialized. Returns FALSE if the parameter is invalid. If FALSE is returned the state of the object is unchanged.

[1266] IDL Syntax

[1267] boolean initializeFromString(in string aTimestamp);

[1268] The string must be in one of two formats:

[1269] A character string of length 14 numeric characters, yyyyxxddhhmmss. Leading and trailing blanks are acceptable provided the string length is less than 30 characters. The string must represent a valid date and time. The microseconds portion of the timestamp is set to zero. Only SBCS characters may be present in the string.

[1270] A punctuated string of the form: yyyy-mm-dd-hh.mm.ss.mmmmmm. Leading and trailing blanks are acceptable provided the string length is less than 30 characters. The string must represent a valid date and time. Leading zeros can be omitted from month, day, and hour. Microseconds can be truncated, or omitted entirely. If omitted, microseconds are set to zero. Only SBCS characters may be present in the string.

[1271] ICBCTimestamp::initializeFromDateTime

[1272] Initializes this timestamp object from one ICBCDate and one ICBCTime object. The time portion the timestamp takes its value from the ICBCDate and the time portion from the ICBCTime object. The microseconds portion of the timestamp is set to zero.

[1273] IDL Syntax

[1274] boolean initializeFromDateTime(in ICBCDate_ptr aICBCDate, in ICBCTime_ptr aICBCTime);

[1275] ICBCTimestamp::initializeFromDate

[1276] Initializes the date part of this timestamp object from the provided ICBCDate parameter. The time portion and the microseconds portion of the timestamp are set to zero.

[1277] IDL Syntax

[1278] void initializeFromDate(inICBCDate aDate);

[1279] ICBCTimestamp::initializeFromTime

[1280] Initializes the date portion of this timestamp object to the current date, and the time portion from the provided ICBCTime parameter. The microseconds portion of the timestamp is set to zero.

[1281] IDL Syntax

[1282] void initializeFromTime(in ICBCTime aTime);

[1283] ICBCTimestamp::interval

[1284] Calculates the Duration between two ICBCTimestamp objects. The result is a pointer to a new ICBCDuration object of type TIMESTAMP.

[1285] If the interval between TIMESTAMP1 and TIMESTAMP2 is required, and TIMESTAMP1 is greater than or equal to TIMESTAMP2, the operation is performed by subtracting TIMESTAMP2 from TIMESTAMP1. If, however, TIMESTAMP1 is less than TIMESTAMP2, TIMESTAMP1 is is subtracted from TIMESTAMP2, and the sign of the result is made negative. The following procedural description clarifies the steps involved in the operation result=TIMESTAMP1−TIMESTAMP2.

[1286] If MICROSECOND(TS2)<=MICROSECOND(TS1)

[1287] then MICROSECOND(RESULT=MICROSECOND(TS1)−MICROSECOND(TS2).

[1288] If MICROSECOND(TS2)>MICROSECOND(TS1)

[1289] then MICROSECOND(RESULT=1000000+MICROSECOND(TS1)−MICROSECOND(TS2). and SECOND(TS2) is incremented by 1.

[1290] The seconds and minutes part of the timestamps are subtracted as specified in rules for subtracting ICBCTime.

[1291] If HOUR(TS2)<=HOUR(TS1)

[1292] then HOUR(RESULT)=HOUR(TS1)−HOUR(TS2).

[1293] IF HOUR(TS2)>HOUR(TS1)

[1294] then HOUR(RESULT)=24+HOUR(TS1)−HOUR(TS2) and DAY(TS2) is incremented by 1

[1295] The date part of the timestamps is substracted as specified in the rules for subtracting ICBCDate.

[1296] IDL Syntax

[1297] ICBCDuration_ptr intervalFromTimestamp (in ICBCTimestamp aTimestamp);

[1298] ICBCDuration_ptr intervalFromString(m string aTimestamp);

[1299] In the case with a string parameter, the parameter must be a valid string representation of a timestamp, in the form yyyy-mm-dd-hh.mm.ss.mmmmmm For details refer to the description of ICBCTimestamp::initializeFromString( ).

[1300] If the string parameter to this function cannot be recognised as a valid timestamp, then a pointer value of −1 is returned.

[1301] ICBCTimestamp::isLeapYear

[1302] Returns TRUE if the year number in the input parameter is a leap year, FALSE otherwise. Year number must be between 1 and 9999.

[1303] If the input parameter is not in this range, FALSE is returned.

[1304] IDL Syntax

[1305] boolean isLeapYear(in long aYear);

[1306] ICBCTimestamp::isObjectChanged

[1307] Returns a boolean indicating whether the the value of this object has been changed since it was initialized.

[1308] IDL Syntax

[1309] boolean isObjectChanged( );

[1310] ICBCTimestamp::julianDay

[1311] Returns the Julian day number corresponding to noon GMT on the date of this timestamp object. (Julian Day count started at noon, GMT, on Jan. 1 4712 BC.)

[1312] IDL Syntax

[1313] long julianDay( );

[1314] ICBCTimestamp::julianDayFromString

[1315] Returns the Julian day number corresponding to noon GMT on the timestamp encoded in the input string parameter. Julian Day count started at noon, GM on Jan. 1 4712 BC) The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1316] If the input parameter is not recognizable, a value of −1 is returned.

[1317] IDL Syntax

[1318] long julianDayFromString(in string aString);

[1319] ICBCTimestamp::lessThan

[1320] Returns TRUE if the date and time stored in this ICBCTimestamp object is less than the other ICBCTimestamp object.

[1321] IDL Syntax

[1322] boolean lessThan(in ICBCtimestamp aTimestamp);

[1323] ICBCTimestamp::lessThanOrEqualTo

[1324] Returns TRUE if the date and time stored in this ICBCTimestamp object is less than or equal to the other ICBCTimestamp object.

[1325] IDL Syntax

[1326] boolean lessThanOrEqualTo(in ICBCTimestamp aTimestamp);

[1327] ICBCTimestamp::microsecond

[1328] Returns the microsecond part of the timestamp.

[1329] IDL Syntax

[1330] long microsecond( );

[1331] ICBCTimestamp::minute

[1332] Returns the minute part of the timestamp.

[1333] IDL Syntax

[1334] long minute( );

[1335] ICBCTimestamp::modifiedJulianDay

[1336] Returns the Modified Julian day number (MJD) corresponding to time 00:00:00 GMT on the date of this timestamp object. MJD is defined as Julian Day—2,400,000.5 days. It thus starts at time 00:00:00 (i.e., midnight), in line with normal civil practice, and unlike Julian Day which extends from noon to noon.

[1337] IDL Syntax

[1338] long modifiedJulianDay( );

[1339] ICBCTimestamp::modifiedJulianDayFromString

[1340] Returns the Modified Julian day number (MJD) corresponding to time 00:00:00 GMT on the date of the timestamp encoded in the input string parameter. MJD is defined as Julian Day—2,400,000.5 days. It thus starts at time 00:00:00 (i.e., midnight), in line with normal civil practice, and unlike Julian Day which extends from noon to noon. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1341] If the input parameter is not recognizable, a value of −1 is returned.

[1342] IDL Syntax

[1343] long modifiedJulianDayFromString(in string aString);

[1344] ICBCTimestamp::month

[1345] Returns the month part of the timestamp.

[1346] IDL Syntax

[1347] long month( );

[1348] ICBCTimestamp::monthFromString

[1349] Returns the month part of the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1350] If the input parameter is not recognizable, a value of −1 is returned.

[1351] IDL Syntax

[1352] long monthFromString(in string aString);

[1353] ICBCTimestamp::monthName

[1354] Returns a string containing the name of the month of this timestamp object.

[1355] IDL Syntax

[1356] string monthName( );

[1357] ICBCTimestamp::monthNameFromNumber

[1358] Returns a string containing the name of the month for the month number within a year provided in the input parameter. The input parameter must be a number between 1 and 12.

[1359] If the input parameter is not recognizable, an empty string is returned.

[1360] IDL Syntax

[1361] string monthNameFromNumber(in long aDayIndex);

[1362] ICBCTimestamp::monthNameFromString

[1363] Returns a string containing the name of the month for the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1364] If the input parameter is not recognizable, an empty string is returned.

[1365] IDL Syntax

[1366] string monthNameFromString(in string aTimestamp);

[1367] ICBCTimestamp::notEqualTo

[1368] The opposite of the operator==member.

[1369] IDL Syntax

[1370] boolean notEqualTo(in ICBCTimestamp aTimestamp);

[1371] ICBCTimestamp::quarter

[1372] Returns a number for the quarter within the year for this timestamp object. timestamps between January 1 and March 31 are in the first quarter, and so on.

[1373] IDL Syntax

[1374] long quarter( );

[1375] ICBCTimestamp::quarterFromString

[1376] Returns a number for the quarter within the year for the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats. Timestamps between January 1 and March 31 are in the first quarter, and so on.

[1377] If the input parameter is not recognizable, a value of −1 is returned.

[1378] IDL Syntax

[1379] long quarterFromString(in string aTimestamp);

[1380] ICBCTimestamp::second

[1381] Returns the second part of the timestamp.

[1382] IDL Syntax

[1383] ICBCTimestamp::timestampOverflow

[1384] Returns the number of overflow or underflow years of a preceding increment or decrement operation. For an increment, returns the years in excess of year 9999. For a decrement, returns the number of years less than year 0001.

[1385] IDL Syntax

[1386] long timestampOverflow( );

[1387] ICBCTimestamp::year

[1388] Returns the year part of the timestamp.

[1389] IDL Syntax

[1390] long year( );

[1391] ICBCTimestamp::yearFromSting

[1392] Returns the year part of the timestamp encoded in the input string parameter. The input string parameter must conform to a format recognizable as a timestamp. Refer to ICBCTimestamp::initializeFromString( ) for a description of supported formats.

[1393] If the input parameter is not recognizable, a value of −1 is returned.

[1394] IDL Syntax

[1395] long yearFromString(in string aString);

Claims

1. A method for accessing a database, comprising the steps of:

(a) defining one or more object classes in a memory of a computer to match one or more corresponding specialized data types stored in the database; and
(b) creating one or more instances of the defined object classes in the memory of the computer to represent data in the database that comprise the corresponding specialized data types.

2. The method of claim 1 above, wherein the defining step further comprises the step of defining the object classes within a Component Broker.

3. The method of claim 1 above, wherein the defined object class includes one or more methods selected from a group comprising object initialization, comparisons, query functions, and manipulation functions.

4. The method of claim 1 above, wherein attributes and methods associated with the corresponding specialized data type are preserved in the defined object classes.

5. The method of claim 4 above, wherein the methods emulate semantics of the corresponding specialized data types.

6. The method of claim 4 above, wherein the methods produce similar results as equivalent expressions evaluated by a database manager for the database.

7. The method of claim 1 above, wherein a public interface of the defined object classes matches characteristics and usage of the specialized data type in the database.

8. The method of claim 1 above, wherein the specialized data types are selected from a group comprising date, decimal, duration, time, and timestamp.

9. The method of claim 1 above, wherein the defined object classes are selected from a group comprising date class, decimal class, duration class, time class, and timestamp class.

10. The method of claim 9 above, wherein the date class stores a calendar date value.

11. The method of claim 9 above, wherein the decimal class stores a decimal value.

12. The method of claim 9 above, wherein the duration class stores a duration value.

13. The method of claim 9 above, wherein the time class stores a time-of-day value.

14. The method of claim 9 above, wherein the timestamp class stores a timestamp value.

15. A computer-implemented system for accessing a database, comprising:

(a) a processor having a memory;
(b) one or more instructions, performed by the processor, for defining one or more object classes in the memory of the processor to match one or more corresponding specialized data types stored in the database and for creating one or more instances of the defined object classes in the memory of the processor to represent data in the database that comprise the corresponding specialized data types.

16. The system of claim 15 above, wherein the instructions for defining further comprise instructions for defining the object classes within a Component Broker.

17. The system of claim 15 above, wherein the defined object class includes one or more member functions selected from a group comprising object initialization, comparisons, query functions, and manipulation functions.

18. The system of claim 15 above, wherein attributes and member functions associated with the corresponding specialized data type are preserved in the defined object classes.

19. The system of claim 18 above, wherein the member functions emulate semantics of the corresponding specialized data types.

20. The system of claim 18 above, wherein the member functions produce similar results as equivalent expressions evaluated by a database manager for the database.

21. The system of claim 15 above, wherein a public interface of the defined object classes matches characteristics and usage of the specialized data type in the database.

22. The system of claim 15 above, wherein the specialized data types are selected from a group comprising date, decimal, duration, time, and timestamp.

23. The system of claim 15 above, wherein the defined object classes are selected from a group comprising date class, decimal class, duration class, time class, and timestamp class.

24. The system of claim 23 above, wherein the date class stores a calendar date value.

25. The system of claim 23 above, wherein the decimal class stores a decimal value.

26. The system of claim 23 above, wherein the duration class stores a duration value.

27. The system of claim 23 above, wherein the time class stores a time-of-day value.

28. The system of claim 23 above, wherein the timestamp class stores a timestamp value.

29. An article of manufacture comprising a carrier embodying logic for accessing a database, the method comprising the steps of:

(a) defining one or more object classes in a memory of a processor to match one or more corresponding specialized data types stored in the database; and
(b) creating one or more instances of the defined object classes in the memory of the processor to represent data in the database that comprise the corresponding specialized data types.

30. The method of claim 29 above, wherein the defining step further comprises the step of defining the object classes within a Component Broker.

31. The method of claim 29 above, wherein the defined object class includes one or more methods selected from a group comprising object initialization, comparisons, query functions, and manipulation functions.

32. The method of claim 29 above, wherein attributes and methods associated with the corresponding specialized data type are preserved in the defined object classes.

33. The method of claim 32 above, wherein the methods emulate semantics of the corresponding specialized data types.

34. The method of claim 32 above, wherein the methods produce similar results as equivalent expressions evaluated by a database manager for the database.

35. The method of claim 29 above, wherein a public interface of the defined object classes matches characteristics and usage of the specialized data type in the database.

36. The method of claim 29 above, wherein the specialized data types are selected from a group comprising date, decimal, duration, time, and timestamp.

37. The method of claim 29 above, wherein the defined object classes are selected from a group comprising date class, decimal class, duration class, time class, and timestamp class.

38. The method of claim 37 above, wherein the date class stores a calendar date value.

39. The method of claim 37 above, wherein the decimal class stores a decimal value.

40. The method of claim 37 above, wherein the duration class stores a duration value.

41. The method of claim 37 above, wherein the time class stores a time-of-day value.

42. The method of claim 37 above, wherein the timestamp class stores a timestamp value.

Patent History
Publication number: 20020046201
Type: Application
Filed: Sep 30, 1998
Publication Date: Apr 18, 2002
Inventor: DOUGLAS MICHAEL HEMBRY (LOS GATOS, CA)
Application Number: 09163505
Classifications
Current U.S. Class: 707/1; 707/104.1
International Classification: G06F007/00;