5.4 Using Basic Logging

To use basic logging, a log file must be named in the database's catalog entry. You can set the database's log file name with dbadmin(C-1). This log file should be on a separate physical volume from the database. That way, if the database resides on a physical device that is destroyed (perhaps by a disk head crash), the data can be restored from the backups and log file.

In addition to naming a log file, each logical RMSfile in the database must be flagged as requiring logging in the catalog. With these two constraints satisfied, basic logging is performed by any C/Base command. To use basic logging in your C program (including user-edit routines), call the logical RMSfile open routine dlopen(C-3). This routine has the same arguments as the RMSfile pathname open routine dopen(C-3), but it does two additional things: basic logging and database access. Instead of naming RMSfiles with their pathnames (like data\mag), you can use logical names (like magazine or demo~magazine). Dlopen also understands the RMSfile pathname conventions used by dopen, but in this case logging is not done. (See C/Base Reference Manual Chapter 2, Databases, for more information on flagging databases and logical RMSfiles for logging).

After calling dlopen, the RMS routines dinsert(C-3), dupdate(C-3) and ddelete(C-3) record changes to the log file as they are called. Note that dwrite(C-3) is not included. Dwrite is a low level RMS routine and it is assumed that anyone calling dwrite is doing their own access methods and backups.