FDQuery

 FDQuery1->ChangeCount;也有UpdatesPending属性
 FDQuery1->ApplyUpdates()

ExecSQL('select * from t where id=:?',[100]);

 FDQuery1->Table->Rows[2].Free();
 FDQuery1->UpdateCursorPos();
 FDQuery1->Resync(TResyncMode());

 FDQuery1->FetchAll();

 FDQuery1->Open("select * from t")

 FDQuery1->Open("select * from t where id=?",[100]);

 FDQuery1->OpenOrExecute()

FDQuery.Constraints.Add.CustomConstraint := 'FIELD_NAME > 1';
FDQuery.UpdateConstraints;
FDQuery.Table.Constraints.Check(FDQuery.GetRow(), rsModified, ctAtEditEnd);

隐藏当前行

 FDQuery1->UpdateCursorPos();
 FDQuery1->GetRow()->Free();
 FDQuery1->Resync(TResyncMode());
 FDQuery1->UpdateCursorPos();

增强的Locate功能LocateEx、LookupEx函数

lxoCheckOnly  If included, then LocateEx does not:

Change the current position. Fire BeforeScroll / AfterScroll events. Finish editing mode.  

 

FDQuery1.Data;

FDMemTable2.Data := FDQuery1.Data;

Delta

ADMemTable1.FilterChanges := [rtModified, rtInserted, rtDeleted];
ADMemTable1.Data := ADQuery1.Delta;

 

FilteredData

Represents the currently visible dataset data.

 

FDQuery1.SavePoint 还原点

var
  iSavePoint: Integer;
....
  // remember changes log state
  iSavePoint := FDMemTable1.SavePoint;
  try
    FDMemTable1.AppendRecord(....);
    FDMemTable1.AppendRecord(....);
    FDMemTable1.AppendRecord(....);
    ...
    FDMemTable1.Delete;
    // mark changes as persistent and clear change log
    FDMemTable1.CommitUpdates;
  except
    // in case of exception, undo changes
    FDMemTable1.SavePoint := iSavePoint;
    raise;
  end;
View Code

 FDQuery1.SourceView

var
  i, iVal, iMax: Integer;
....
// searching the maximum value of ID integer field, without navigating through dataset
iMax := 0;
for i := 0 to FDQuery1.SourceView.Rows.Count - 1 do
  if FDQuery1.SourceView.Rows[i].GetData('id', @iVal) and (iVal > iMax) then
    iMax := iVal;
View Code

FDQuery1.Table

// delete all rows, where ID = 100, without navigating through dataset
for i := FDQuery1.Table.Rows.Count - 1 downto 0 do
  if FDQuery1.Table.Rows[i].GetData('id') = 100 then
    FDQuery1.Table.Rows[i].Delete;
FDQuery1.Resync([]);
View Code

强大的功能来了,FDQuery提供了遍历数据集,而不移动当前记录指针的功能。这是ADOQuery、BDEQuery一直没有的功能!!这样和.net的DataSet有的一拼。

 for (int i = 0; i < FDQuery1->RecordCount; i++)
 {
  Caption = FDQuery1->Table->Rows->ItemsI[i]->GetData("id");
 }

 取得当前记录的前一条和后一条的数据。

 FDQuery1->Table->Rows->ItemsI[FDQuery1->RecNo - 2]->GetData("id");
 FDQuery1->Table->Rows->ItemsI[FDQuery1->RecNo]->GetData("id");

 

 AbortJob

AttachTable

CopyDataSet

CopyFields

CopyRecord

EmptyDataSet

EmptyView

FDQuery1.BeginBatch;
FDQuery1.EndBatch;
ExecSQL

FetchBlobs

FetchDetails

GetDetailDataSets(System::Generics::Collections::TList__1<TDataSet*>* List);

GetNextPacket

GetParentRow

GetResults

IsSequenced

NextRecordSet

Reconcile

RefreshRecord

RevertRecord

Resync

UpdateRecord

posted on 2014-09-02 19:15  lypzxy  阅读(2388)  评论(0编辑  收藏  举报