Duplicate Records

Back to index


Duplicate record handling is triggered by having one or more fields with an index type such as kIndexNoDups. It is currently only available with the c-tree Plus™ backend.

Duplicate Handling and internal save order

If dealing with a single object that has only fixed-length fields there is no difference with duplicate handling.

If the object has dbBLOB fields (includes dbText) then the main object may bewritten twice. The logic is:

if table has blobs that need saving
   if table has noDups fields that need saving
      write main record
write blobs
write main record

The reasoning behind the double write is to avoid orphan BLOB records.

Controlling Duplicate Handling

Reacting with Exception Handlers

Yet to be added.

Temporarily Suspending Duplicate Handling

In some import logic, for example, you may want to simply ignore any duplicate records and have the c-tree Plus error caught inside the database engine.

A pair of methods allow you to control this behaviour. The default behavior is to notice duplicates and either abort with an error message or throw an exception.

ignoreDuplicates()

noticeDuplicates()

GUI interaction with unique fields

If a field doesn't allow duplicates (ie: dbField::fieldIsUniqueIndexed() returns true) then the GUI link classes will not allow you to leave an empty value in an edit field. As you exit the field, its previous value will be retained.


Back to index