docs: public synchronized void add(FieldTable table) throws DBException
      {
          if (m_VKeyList == null)
              this.initKeyAreas(table);
  
          BaseBuffer bufferNew = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
          if (table.getRecord().getEditMode() == Constants.EDIT_ADD)
          {
              for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
              {
                  try   {
                      if (iKeyArea == Constants.MAIN_KEY_AREA)
                      {   // Special logic to set auto-counter field
                          FieldInfo field = table.getRecord().getCounterField();
                          if (field != null)
                              if (!field.isNull())
                                  if (!table.getRecord().isAutoSequence())
                          {   // Autosequence disabled
                              int iValue = (int)field.getValue();
                              if (iValue >= m_iCounter)
                                  m_iCounter = iValue + 1;    // New next counter value
                              field = null;   // Special case - autosequence is disabled, so write the field as is.
                          }
                          if (field != null)
                          {
                              field.setValue(m_iCounter++, Constants.DONT_DISPLAY, Constants.READ_MOVE);  // ReadMove keeps this method from being called again
                              table.fieldsToData(table.getRecord()); // Update buffer
                              bufferNew = (BaseBuffer)table.getDataSource();  // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
                          }
                      }
                      bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                      this.getPKeyArea(iKeyArea).doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                  } catch (DBException ex)    {
                      if (ex.getErrorCode() == Constants.DUPLICATE_KEY)
                      {
                          iKeyArea--;     // Duplicate key, delete all keys added so far!!!
                          while (iKeyArea >= Constants.MAIN_KEY_AREA)
                          {
                              bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                              this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                              iKeyArea--;
                          }
                      }
                      throw ex;
                  }
              }
              // Restore the record before returing (key.doWrite probably changed it).
              bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
          }
          else
              throw new DBException(Constants.INVALID_RECORD);
      }