logo
down
shadow

How is TClientDataSet sending SQL statements on ApplyUpdates


How is TClientDataSet sending SQL statements on ApplyUpdates

Content Index :

How is TClientDataSet sending SQL statements on ApplyUpdates
Tag : delphi , By : Tetting
Date : November 27 2020, 01:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Delphi 3 ApplyUpdates


Tag : delphi , By : user140973
Date : March 29 2020, 07:55 AM
it should still fix some issue If you mean the database table, that's exactly how ApplyUpdates is supposed to work. Are you using MIDAS or cached updates? In the former case data are stored in the in-memory cache of TClientDataset, and can be accessed on the client side using TClientDataset methods (i.e. reading UpdateStatus, or setting StatusFilter) or accessing directly the Delta property. If you're using BDE cached updates, changes are stored AFAIK in some local temporary tables the BDE creates. You can still use UpdateStatus or UpdateRecordType to check for changes to records. In both situations, you have no way to see changes outside the client until they are applied - until then they exist only in the client local cache.

TClientDataset ApplyUpdates error because of database table constraint


Tag : database , By : Alex Sadzawka
Date : March 29 2020, 07:55 AM
To fix this issue I think you may try to implement the OnReconcileError event which is being fired once for each record that could not be applied to the dataset. So I would try the following code, raSkip means here to skip the current record:
procedure TForm1.ClientDataSet1ReconcileError(DataSet: TCustomClientDataSet;
  E: EReconcileError; UpdateKind: TUpdateKind; var Action: TReconcileAction);
begin
  Action := raSkip;
  ShowMessage('The record with ID = ' + DataSet.FieldByName('ID').AsString +
    ' couldn''t be updated!' + sLineBreak + E.Context);
end;

TClientDataset.ApplyUpdates fails with 'SQL not supported' when using SQLDirect components


Tag : delphi , By : Ansari
Date : March 29 2020, 07:55 AM
With these it helps When Googling the error message I stumbled upon this post SProviderSQLNotSupported on DOA with Delphi XE3 where a user had similar issues with Oracle Direct Access.
It suggests either:
function TDataSet.PSExecuteStatement(const ASQL: string; AParams: TParams): Integer;
begin
  Result := 0;
  DatabaseError(SProviderSQLNotSupported, Self);
end;
function PSExecuteStatement(const ASQL: string; AParams: TParams; {$IFDEF SD_CLR} var ResultSet: TObject {$ELSE} {$IFDEF SD_VCL17} var ResultSet: TDataSet {$ELSE} ResultSet: TSDPtr = nil {$ENDIF} {$ENDIF}): Integer; overload; override;
function PSExecuteStatement(const ASQL: string; AParams: TParams; var ResultSet: TDataSet): Integer; overload; override;
function TDataSet.PSExecuteStatement(const ASQL: string; AParams: TParams): Integer;
function PSExecuteStatement(const ASQL: string; AParams: TParams): Integer; overload; override; // New override
function PSExecuteStatement(const ASQL: string; AParams: TParams; {$IFDEF SD_CLR} var ResultSet: TObject {$ELSE} {$IFDEF SD_VCL17} var ResultSet: TDataSet {$ELSE} ResultSet: TSDPtr = nil {$ENDIF} {$ENDIF}): Integer; overload; override;
function TSDDataSet.PSExecuteStatement(const ASQL: string; AParams: TParams): Integer;  // JD 20-4-2016
var
  ds: TDataSet;
begin
  ds := nil;
  Result := InternalPSExecuteStatement( ASQL, AParams, false, ds );
end;

TClientDataSet.ApplyUpdates() doesn't apply updates


Tag : delphi , By : sadboy
Date : March 29 2020, 07:55 AM
I wish this help you I ran into this problem recently on a quick project I rustled up without the precaution of setting an OnReconcileError handler, as queried by @mjn.
Once I'd set up the OnReconcileError handler, it was obvious that the problem was that the provider's TSqlResolver wasn't able to identify the row to update. Iirc, the message on the ReconcileError pop-up form was words to the effect of "Unable to locate record. No key specified."
CDS1.Fields[0].ProviderFlags := [pfInKey];

Does TClientDataSet.ApplyUpdates(0) require to execute CheckBrowseMode/Post before?


Tag : delphi , By : phatfish
Date : March 29 2020, 07:55 AM
I hope this helps you . I have TIBQuery-TDataSetProvider-TClientDataSet chain in Delphi 2009 (Firebird 3.0) and I execute MyClientDataSet.ApplyUpdates(0). Am I required to call CheckBrowseMode or Post on this CDS before calling ApplyUpdates(0). I am almost sure that I am required to call Post/CheckBrowseMode and I think that no-posted updates will not be applied to the IBQuery, I have no documentation for/against such thinking but it is logical to think so. But sometimes I can observe that MyClientDataSet is in [dsInsert, dsEdit] state before ApplyUpdates(0) and the new values are still posted and saved in query. But there are evidence and reason against that as well. So - I am confused. ,
or is it rule that I can find in the documentation?
function TCustomClientDataSet.ApplyUpdates(MaxErrors: Integer): Integer;
var
  RootDataset: TCustomClientDataset;
begin
  CheckBrowseMode;
  RootDataset := Self;
  while RootDataset.FParentDataSet <> nil do
    RootDataset := RootDataset.FParentDataset;
  with RootDataset do
    if ChangeCount = 0 then
      Result := 0 else
      Reconcile(DoApplyUpdates(Delta, MaxErrors, Result));
end;
Related Posts Related QUESTIONS :
  • How to use .Ini Files in FMX/Delphi
  • create a wav file from multiple wav files in delphi
  • Can Delphi dragging be "promoted" to docking?
  • Using Delphi's ShellExecute() with the process inheriting the original console?
  • How can create a color progressbar in delphi?
  • Is there a Delphi dropdown notification component?
  • How make DBLookupcombobox has a Windows 7 Look with RAD 2010?
  • How to change the pixelformat of a TWICImage in Delphi 2010
  • Improve speed of own debug visualizer for Delphi 2010
  • I have the Process ID and need to close the associate process programmatically with Delphi 5
  • How test a Delphi app with Application Verifier 4.0?
  • DataSetProvider - DataSet to ClientDataSet
  • Creating Delphi Objects at runtime based on class type
  • installing Delphi5 pro in windows 64b
  • Which is more appropriate for pbx events, TIdTCPServer or TIdTCPClient?
  • How reduce dll size again
  • Why "menus" unit is finalized too early?
  • Small Command line scripter (like Autocad commands) one line editor
  • Delphi: How to set the default project in a project group?
  • Is there any way to run "dir" directly?
  • Where to download Delphi BDE 5.01
  • Delphi exe, will it run with just BDE configuration?
  • Looking for Delphi 4 professional/Quickreport
  • AcroPDF in Delphi - How do I scroll?
  • How retrive full path with file name or folder name from ShellTreeView/ShellListView
  • Sending a file from my application (Indy/Delphi) to an ASP page and then onto another server (Amazon S3)
  • Need to send a pasting command from one program to another?
  • Delphi, read data from 3rd party data field
  • Delphi 7 inheritance
  • Looking for a good Delphi unicode string library
  • How can I create a context menu for a Delphi component?
  • How to access a Cassandra distributed database from Delphi
  • How to avoid the focus on Delphi application?
  • Emulate terminal services
  • A better way of converting Codepage-1251 in RTF to Unicode
  • How to pass multiple different records (not class due to delphi limitations) to a function?
  • Resize PNG image
  • Easiest way to find previous instance of an application
  • Difference between GetPixel and Canvas.Pixels in Delphi
  • Get Current Pixel value using Scanline in Delphi
  • Delphi: hook ToggleSwitch manual State change to avoid a Click call
  • TRttiContext GetTypes not finding my types
  • Can you change the span of a control at run time which was created at run time in TGridPanel
  • How variables are catched inside anonymous method?
  • change x-axis label in xy value plot
  • when run "printui.exe /s",it return error code 33 (error_lock_acess),how to fix it?
  • I keep getting a read error when copying stream data
  • How to let the IDE know that I use ancestor variable?
  • Why doesn't this code break (array of pointers to pointers of record)
  • How to check a BLE device still connected with Delphi 10.3
  • Send Perform Message with Record
  • Delphi Rio 10.3.2: remove file from a ZIP file
  • I want to encrypt TidBytes with AES
  • How to get correct number of logical processors
  • Convert variant of type (Dispatch)
  • Can't check if class has been created
  • Bind parent object's event to temporary child object's method
  • Compiler bug with overloaded function
  • Delphi marquee progress bar
  • DirectX/DirectCompute CreateBuffer failure with error 0x80070057 (E_INVALIDARG)
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com