Common Database Driver Features

Top  Previous  Next


Importing File Definitions

For existing data, you can generally import file definitions into your Clarion data dictionary. We strongly recommend importing file definitions whenever possible, because it reduces your development time and effort, plus it results in fewer errors in file definitions.

Keys, Indexes, and Performance

Although you may define indexes within your Clarion data dictionary that do not exist within the native file system, we do not recommend doing so because your application performance will generally suffer. Instead, we recommend defining the required key or index with the native file system's tools, then importing the file definition, including the key or index definitions, into your Clarion data dictionary.

Sorting and Collating Sequences

By default, all SoftVelocity's database drivers sort using the ANSI collating sequence. Adding the OEM attribute causes the driver to use the ASCII collating sequence.

Disk Caching and Data Integrity

Disk caching can interfere with the data integrity features of many file systems. By disk caching, we mean any facility (for example SMARTDRV) that tells the database driver that a record was written to the disk when in fact it was not.

To improve performance, disk-caching facilities typically accumulate several records at a time in RAM then write them to disk all at once. While this does improve performance, it can result in corrupt data files if the system fails (due to a power outage, etc.) before the records are written to disk.

A reliable Uninterruptible Power Supply (UPS) can drastically reduce this risk. Therefore, we generally recommend no disk caching, but if you must cache, then be sure to use a reliable UPS.

Database Driver System-wide Logging

All of SoftVelocity's database drivers can create a log file documenting Clarion I/O statements they process, and the SQL Accelerator drivers can log the corresponding SQL statements, and the SQL return codes.

You can generate system-wide logs and on-demand logs (conditional logging based on your program logic).

A utility/example application is included--Trace.EXE. A compiled version is installed in the ..\bin directory and the source .APP is installed in the \Examples\Resource\Trace directory. This utility allows you to easily set tracing options for each file driver and for the VIEW engine. These setting are stored in WIN.INI.

For system-wide logging, you can add the following to your WIN.INI file:

[filedriver]

Profile=[1|0]

Details=[1|0]

Trace=[1|0]

TraceFile=[Pathname]

where filedriver is the database driver name (for example [MS-SQL]). Neither the INI section name [filedriver] nor the INI entry names are case sensitive.

Profile=1 tells the driver to include the Clarion I/O statements in the log file; Profile=0 tells the driver to omit Clarion I/O statements. The Profile switch must be turned on for the Details switch to have any effect.

Details=1 tells the driver to include record buffer contents in the log file; however, if the file is encrypted, you must turn on both the Details switch and the ALLOWDETAILS switch to log record buffer contents (see ALLOWDETAILS). Details=0 tells the driver to omit record buffer contents. The Profile switch must be turned on for the Details switch to have any effect.

Trace=1 tells the driver to include all calls to the back-end DBMS, including the generated SQL statements and their return codes, in the log file. Trace=0 omits these calls. The Trace switch generally generates log information that helps to debug the SQL drivers, but is normally not particularly useful to the developer.

TraceFile names the log file to write to. If TraceFile is omitted the driver writes the log to driver.log in the current directory. Pathname is the full pathname or the filename of the log file to write. If no path is specified, the driver writes the specified file to the current directory.

Logging opens the named log file for exclusive access. If the file exists, the new log data is appended to the file.

On Demand Logging

For on-demand logging you can use property syntax within your program to conditionally turn various levels of logging on and off. The logging is effective for the target table and any view for which the target table is the primary table.

file{PROP:Profile}=Pathname   !Turns Clarion I/O logging on

file{PROP:Profile}=''         !Turns Clarion I/O logging off

PathName = file{PROP:Profile} !Queries the name of the log file

file{PROP:Log}=string         !Writes the string to the log file

file{PROP:Details}=1          !Turns Record Buffer logging on

fFile{PROP:Details}=0         !Turns Record Buffer logging off

Pathname is the full pathname or the filename of the log file to create. If you do not specify a path, the driver writes the log file to the current directory.

You can also accomplish on demand logging with a SEND() command and the LOGFILE driver string.