The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.
The ExecSQL method for an update component manually applies updates for the current record. Unlike the Apply method, ExecSQL does not bind parameters in the SQL statement before executing it. The ExecSQL method is most often called from within a handler for the OnUpdateRecord event (when using the BDE) or the BeforeUpdateRecord event (when using a client dataset).
Because ExecSQL does not bind parameter values, it is used primarily when the update object's SQL statements do not include parameters. You can use Apply instead, even when there are no parameters, but ExecSQL is more efficient because it does not check for parameters.
If the SQL statements include parameters, you can still call ExecSQL, but only after explicitly binding parameters. If you are using the BDE to cache updates, you can explicitly bind parameters by setting the update object's DataSet property and then calling its SetParams method. When using a client dataset to cache updates, you must supply parameters to the underlying query object maintained by TUpdateSQL. For information on how to do this, see Using an update component's Query property.
procedure TForm1.BDEClientDataSet1BeforeUpdateRecord(Sender: TObject; SourceDS: TDataSet; DeltaDS: TCustomClientDataSet; UpdateKind: TUpdateKind; var Applied: Boolean); begin with UpdateSQL1 do begin DatabaseName := (SourceDS as TDBDataSet).DatabaseName; SessionName := (SourceDS as TDBDataSet).SessionName; ExecSQL(UpdateKind); Applied := True; end; end;
void __fastcall TForm1::BDEClientDataSet1BeforeUpdateRecord(TObject *Sender, TDataSet *SourceDS, TCustomClientDataSet *DeltaDS, TUpdateKind UpdateKind, bool &Applied) { TDBDataSet *pSrcDS = dynamic_cast<TDBDataSet *>(SourceDS); UpdateSQL1->DatabaseName = pSrcDS->DatabaseName; UpdateSQL1->SessionName = pSrcDS->SessionName; UpdateSQL1->ExecSQL(UpdateKind); Applied = true; }
If an exception is raised during the execution of the update program, execution continues in the OnUpdateError event, if it is defined.
Name |
Description |
The Query property of an update component provides access to the query components that implement its DeleteSQL, InsertSQL, and ModifySQL statements. In most applications, there is no need to access these query components directly: you can use the DeleteSQL, InsertSQL, and ModifySQL properties to specify the statements these queries execute, and execute them by calling the update object's Apply or ExecSQL method. There are times, however, when you may need to directly manipulate the query component. In particular, the Query property is useful when you want to supply your own values for parameters in the SQL... more |
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|