Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Required: TField.Required;
Required: TField.Required;
Posted: 2007/10/31 10:28
 
Hi Dimitry,

thanks, we are using your component NCOI8 now since more than 5 years, beginning with Delphi5. A time ago, we updatet to BDS2006.

Actually we are using BDS 2006, Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production

During some tests I noticed a weird behaviour: The Required-Property of a field seems to be ignored. So I made extensive tests:

TOCIDatabase.DataFormat -> EnableRequired
TOCIQuery.DataFormat -> EnableRequired
TField.Required: True

I can change settings like CachedUpdates and others, but the component does not make any test against the field content anymore. The only (error)-messages I get, is when the component writes back to the database and the database raises an error (ORA-xxxx, constraint...)

I think, that former version did made a test and did not even wrote back to the database?

Thanks for your help,
Sascha
Re:Required: TField.Required;
Posted: 2007/11/05 10:23
 
Hi,

I found the error. Borland/Codegear has changed it's source codes in DB.pas:

former Version (like Delpi 5) was:


 procedure TDataSet.Post; begin   UpdateRecord;   case State of     dsEditdsInsert:       begin         DataEvent(deCheckBrowseMode0);         <strong>CheckRequiredFields</strong>;         DoBeforePost;         CheckOperation(InternalPostFOnPostError);         FreeFieldBuffers;         SetState(dsBrowse);         Resync([]);         DoAfterPost;       end;   end; end;



in BDS 2006 the code is:


 procedure TDataSet.Post; begin   UpdateRecord;   case State of     dsEditdsInsert:       begin         DataEvent(deCheckBrowseMode0);         DoBeforePost; <strong>        CheckOperation(InternalPostFOnPostError);</strong>         FreeFieldBuffers;         SetState(dsBrowse);         Resync([]);         DoAfterPost;       end;   end; end; // and InteralPost ist: procedure TDataSet.InternalPost; begin <strong>  CheckRequiredFields;</strong> end;



in NCOCIDB.pas the procedure INTERNALPOST assumes, that CheckRequiredFields has already been called:


 procedure TOCIDataSet.InternalPost; begin     Database.StartWait;     try         if State dsEdit then begin             FOCICursor.ModifyRecord(nilPOCIBookmark(ActiveBuffer));             UpdateProcessor(skUnLock, [soImmediatesoSave]);         end         else begin             FOCICursor.InsertRecord(POCIBookmark(ActiveBuffer));             UpdateProcessor(skUnLock, [soImmediatesoSave]);         end;     finally         Database.EndWait;     end; end;



So I just added an inherited; to the beginning of the procedure and now it works....

BUT - I don't want to know, what Codegear has changed additionally....