Home > Language Reference > Classes

Database Class

  + Object
    + Database

Description

The Database class implements the methods common to all the objects that manage databases. This class is not instantiable, derivable or cloneable. You can only use the methods which it defines through its derived classes. The diagram below shows the hierarchy of these different classes :

The inheritance rules in HB++ are well suited to Palm OS® database management. For example, the RecordDB and ResourceDB objects implement only appropriate functionality for manipulating respectively records and resources databases, while the common functions like opening and closing of databases are grouped in the parent classes GenericDB and Database. The Application object allows high level access to the database containing the application itself while the inherited methods of the ResourceDB class offers low level access.

The table below summarizes which object to use according to the functionality required:

Class Description
RecordDBAllows low level access to all records database. This object is typically used when you want to manipulate a database created by another application, for example to add records into the address book.
ResourceDBAllows low level access to all resources database. This object is typically used when you want to extract resources from another application, for example its title, version or icon.
RecordsetAllows high level access to tables defined in the development environment. This object is used to store data manipulated by your application and allows for example the execution of simple SQL requests.
ApplicationAllows access to the database containing the application itself. There is only one instance of this class, available through the intermediary of the global App variable.

The Database class only has four functions: the Close method which closes the database to which the object refers, the Info property returning a DatabaseInfo object allowing the manipulation of its attributes, the CategoryName property allowing to return or set category names, and the DmOpenRef property which returns the database handle, to be used with low level Palm OS® Data Manager API.

The documentation of the RecordDB, ResourceDB and Recordset classes as well as the Samples section of this manual contain several database access examples. If you are not familiar with databases on the Palm OS® platform, you can also refer to the Palm OS® Programming section in the Programmer's Guide.

Members

MembersDescription
CategoryName Set or return a category name.
Close Closes the database.
DmOpenRef Internal database reference.
Info Returns a DatabaseInfo object.
OpenCount Number of times the database was opened.
Inherited from ObjectDescription
ClassID Returns the type identifier corresponding to the actual class of the object.
Implements Determines whether the object implements the features of a given class.
Iterate Event raised to iterate over the elements of a container object.
Recipient Recipient of events sent by the object.
Serialize Event raised to serialize the object content into a stream.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A