DP4 programs access databases using types declared directly within the program. For example a customer record would be accessed using a variable declared as struct CUSTOMER in C, as class CDP4Customer in C++, as class TCustomer in Delphi and so on. These variables contain members that are in one to one correspondence with the fields on the database. The declarations needed for each table are prepared by the DP4 utility LIBMAKE, which in many cases also generates the code needed to establish a connection to the DP4 database manager and terminal manager. The data independence mechanism built into the DP4 database manager ensures that programs continue to work even if the database structure is changed after the program has been built. (There are limitations to this facility however, and it is important that you familiarise yourself with these when planning to make changes to a live system.)
When you call functions to update a DP4 database you are not actually changing the database at that time. You are adding pending requests to a queue of updates for the current transaction. The transaction will be completed when you call one of the functions that commit your changes. Either all the updates in a single transaction will be applied at the same time, or they will all be rejected, if there is a contention error, or a constraint violation. It is important that changes are only committed when it is logically appropriate to do so.
Unlike most databases, it is possible, and indeed usual, to bypass most constraint checking when you commit changes to a DP4 database. The rationale behind this is that application programs typically make all necessary checks before updating the database in the first place, so that for the database manager to make the checks again is unnecessary. However this puts an onus on the programmer to make sure the program is correct.
There are two sets of libraries and support files for programming using the DP4 API.
The "traditional" DP4 API using the ccown library (the actual name depends on the platform). This is the library used by the vast majority of DP4 utilities, and the primary focus of this manual. This wraps the interface-level DP4 functions with a collection of C functions used to implement high level functions for doing things like managing dialogs and list boxes, creating files that implement views of the database, and so on. This library is primarily intended for C programs, though it can also be used from C++. The library makes extensive use of global variables. For single-threaded programs that access only one or two databases this library is very convenient to use. However, if you are planning to use multiple threads or open many databases it may not be the best choice.
The interface level DP4 API is available from release 4.620, though some parts of it were available previously via the DP4DYN interface. The interface level functions are essentially a subset of the C functions described in this manual. However, most of these functions require extra parameters, to avoid any need for using global variables. For C++ this library has been "wrapped" in the CDP4Database and related classes.