docs: public void add(Rec fieldList) throws DBException
      {
          Record record = (Record)fieldList;
          int iErrorCode = DBConstants.NORMAL_RETURN;
          if ((record.getOpenMode() & DBConstants.OPEN_READ_ONLY) != 0)
              throw new DatabaseException(DBConstants.ERROR_READ_ONLY);
          boolean[] rgbSaveEnabled = null;
          try   {
              if (record.getEditMode() != Constants.EDIT_ADD)
              {
                  if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
                      if ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY)
                  { // Special case - Add with refresh/update on add
                      iErrorCode = record.handleRecordChange(DBConstants.ADD_TYPE);
                      if (iErrorCode != DBConstants.NORMAL_RETURN)
                          throw new DatabaseException(iErrorCode);
                      rgbSaveEnabled = record.setEnableListeners(false);      // Don't trigger any UPDATE listeners
                      if (record.isModified())
                          this.set(record);
                      record.setEnableListeners(rgbSaveEnabled);
                      rgbSaveEnabled = null;
                      iErrorCode = record.handleRecordChange(DBConstants.AFTER_ADD_TYPE);
                      if (iErrorCode != DBConstants.NORMAL_RETURN)
                          throw new DatabaseException(iErrorCode);
                      return;
                  }
                  throw new DatabaseException(DBConstants.INVALID_RECORD);
              }
              CounterField fldCounter = (CounterField)record.getCounterField();
              if (fldCounter != null)
                  if (!DBConstants.FALSE.equalsIgnoreCase(this.getProperty(SQLParams.AUTO_SEQUENCE_ENABLED))) // Auto seq is enabled:
              {       // Just in case you had some data in the counter (it will be cleared).
                  boolean[] rgbEnabled = fldCounter.setEnableListeners(false);
                  fldCounter.setData(null);
                  fldCounter.setEnableListeners(rgbEnabled);
              }
              iErrorCode = record.handleRecordChange(DBConstants.ADD_TYPE);
              if (iErrorCode != DBConstants.NORMAL_RETURN)
                  throw new DatabaseException(iErrorCode);
              if (record.getEditMode() != Constants.EDIT_ADD)
              {   // It is possible that the add behavior wrote and refreshed the record, in that case, I need to update.
                  if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT))
                  { // Special case - Add with refresh/update on add
                      rgbSaveEnabled = record.setEnableListeners(false);      // Don't trigger any UPDATE listeners
                      if (record.isModified())
                          this.set(record);
                      record.setEnableListeners(rgbSaveEnabled);
                      rgbSaveEnabled = null;
                      iErrorCode = record.handleRecordChange(DBConstants.AFTER_ADD_TYPE);
                      if (iErrorCode != DBConstants.NORMAL_RETURN)
                          throw new DatabaseException(iErrorCode);
                      return;
                  }
                  throw new DatabaseException(DBConstants.INVALID_RECORD);
              }
              this.fieldsToData(record);
              this.setLastModHint(record);
              this.doAdd(record);
              m_iRecordStatus |= DBConstants.RECORD_INVALID;
          } catch (DBException ex)    {
              if (rgbSaveEnabled != null)
                  record.setEnableListeners(rgbSaveEnabled);
              if (ex.getErrorCode() == DBConstants.DUPLICATE_KEY)
              {   // If duplicate key, don't invalidate the record.
                  iErrorCode = this.getRecord().handleErrorReturn(DBConstants.AFTER_ADD_TYPE, ex.getErrorCode()); // Give the listeners a chance to fix the error.
                  if (iErrorCode == DBConstants.NORMAL_RETURN)
                      return;
              }
  //x            else
  //x                record.setEditMode(Constants.EDIT_NONE);
              throw ex;
          }
          iErrorCode = record.handleRecordChange(DBConstants.AFTER_ADD_TYPE);
          if (iErrorCode != DBConstants.NORMAL_RETURN)
              throw new DatabaseException(iErrorCode);
          record.setEditMode(Constants.EDIT_NONE);    // Unknown status after an add
          if ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY)
              return;   // Will need these to refresh record
          m_objectID = null;
          m_dataSource = null;
      }