Data Access Class Library and Generated Code

The Data Access classes enable you to connect to databases, map database tables to objects, and work with the data inside the databases by using object-oriented programming. The base classes in the Data Access Class Library provide generic methods for accessing and manipulating database information, interacting with other builders, handling messages and exceptions, and working with large objects. The generated classes extend the base classes and implement operations tailored for specific situations, as you define them in the main Data Access Builder window. In most cases, you will use the generated classes in your data access applications.

Reference Library Notation
In all documentation for generated code, the notation <class> represents the name of the Data Access class for which you are generating code. The notation <attribute> represents any one of the class' attributes, as mapped from the database table or view (corresponding to a column from the table), and <attributeType> represents that attribute's type.

Also, square brackets enclosing one or more parameters in a method's signature indicate that the parameters are repeated to include all attributes of the object. For example,

public <class>([<attributeType> an<Attribute>, ...]) 

Here, the parameter list will be a list of each attribute (and its type) mapped from the table to the object.

When a method name includes <attribute>, it means that the generated code will include an implementation of that method for each attribute that the class has. For example, if <class> has two attributes, Attr1 and Attr2, and set<attribute> is one of the generated methods for <class>, then two methods, setAttr1 and setAttr2 will be generated.

Some generated class members may use one of three different Datastore class types: IDatastore, IDatastoreDB2, or IDatastoreODBC, depending on which access method you chose at mapping time. The notation IDatastorexxx indicates that one of these three is used, depending on your mapping choice.

Data Access Class Library Reference
The Data Access Class Library includes the following classes. Click on the name of the class to access class member reference information.

Class Name Description
IDatastoreBase Base class for other Datastore classes. Parent class of IDatastoreBaseCLI. Manages database connections, providing client connection to a database, disconnection from the database, and the ability to commit and rollback database transactions.
IDatastoreBaseCLI Parent class of IDatastoreODBC and IDatastoreDB2.
IDatastoreODBC Parent class for generated Datastore class using ODBC access.
IDatastoreDB2 Parent class for generated Datastore class using DB2 ESQL or DB2 CLI access, and parent class for IDatastore.
IDatastore Base class for generated Datastore class using DB2 ESQL access from previous releases of VisualAge C++ Data Access Builder.
IPersistentObject Provides interfaces for adding, deleting, retrieving, and updating a row from a table.
IPODataId Base class for objects that uniquely identify rows in tables
IDAManager Provides the ability to work with a collection of rows from a table, and facilitates movement through a collection of rows via a database cursor.
IDAException Defines exceptions thrown by the Data Access Builder and its generated code.
IDALobDO Base class for Data Access Large Object (LOB) support (DB2 only).
IDAClobDO Class for accessing Character Large Objects (CLOBs) (DB2 only).
IDADBClobDO Class for accessing Double-Byte Character Large Objects (DBCLOBs) (DB2 only).
IDABlobDO Class for accessing Character Large Objects (CLOBs) (DB2 only).

Data Access Generated Classes Reference
Data Access Builder generates the following classes. Click on the name of the class to access class member reference information.

Class and an Example Description
<class>Datastore
e.g.
EmployeeDatastore
Inherits from IDatastoreDB2 or IDatastoreODBC, depending on which access method is chosen at mapping time. Objects represent connections to the database.
<class>
e.g.
Employee
Inherits from IPersistentObject. Objects represent rows from the schema. Class contains database access methods, including user-defined methods and stored procedure calls, if any are defined.
<class>DataId
e.g.
EmployeeDataId
Inherits from IPODataId. Objects represent the set of columns that uniquely identify a row. This class is generated only if the mapping specifies a data ID column or columns.
<class>ManagerBase
<class>ManagerTemplate
<class>Manager
e.g.
EmployeeManager
Three classes that inherit from IDAManager. Enable you to select a collection of rows from the table and work with them, or to open a database cursor and access a collection of rows one at a time. Contains user-defined manager methods and stored procedure calls, if any are defined.
<class>DataIdManagerBase
<class>DataIdManagerTemplate
<class>DataIdManager
e.g. EmployeeDataIdManager
Three classes that inherit from IDAManager. Enable you to select a collection of Data IDs from the table and work with them, or to open a database cursor and access a collection of Data IDs one at a time. These classes are generated only if the mapping specifies a data ID column or columns.


Generated Methods
Read-Only Considerations
Null Value Considerations
Notifications
Background Threads


Derive Your Own Classes from Generated Classes
Connect and Disconnect
Commit and Roll Back
Retrieve Rows from the Database
Set and Retrieve IDate, ITime, and ITimestamp Attributes


File Naming Conventions
Connection Considerations
Exceptions and Messages