OLEVARIANT 의 대체 - FIREDAC 의 TFDJSondataSets 와 TFDJSondeltas
13548 단어 json
OLEVARIANT—— COM , DATASNAP 20 ,
20 , :FIREDAC TFDJSONDataSets TFDJSONDeltas,XE5 UPDATE2 DATASNAP 2 。
FIREDAC TFDCONNECTION “GENERATE DATASNAP CLIENT CLASSES” , , TSQLCONNECTION ,
? 。
TFDJSONDataSets: , N , ( ) 。
TFDJSONDeltas: DELTA , N DELTA, ( ) 。
?
DATASNAP COM , 。
OLEVARIANT?
, 。
。
)
1) :
const
sDepartment = 'Department'; sEmployees = 'Employees';
2) 조회 데이터:
function TServerMethods1.GetDepartmentEmployees(const AID: string): TFDJSONDataSets; begin // Clear active so that query will reexecute. FDQueryDepartmentEmployees.Active := False; FDQueryDepartment.Active := False; FDQueryDepartment.Params[0].Value := AID; FDQueryDepartmentEmployees.Params[0].Value := AID; // Create dataset list Result := TFDJSONDataSets.Create; // Add departments dataset TFDJSONDataSetsWriter.ListAdd(Result, sDepartment, FDQueryDepartment); // Add employees dataset TFDJSONDataSetsWriter.ListAdd(Result, sEmployees, FDQueryDepartmentEmployees); end;
TFDJSONDataSets,FIREDAC , 。
3) :
procedure TServerMethods1.ApplyChangesDepartmentEmployees( const ADeltaList: TFDJSONDeltas); var LApply: IFDJSONDeltasApplyUpdates; begin // Create the apply object LApply := TFDJSONDeltasApplyUpdates.Create(ADeltaList); // Apply the department delta LApply.ApplyUpdates(sDepartment, FDQueryDepartment.Command); if LApply.Errors.Count = 0 then // If no errors, apply the employee delta LApply.ApplyUpdates(sEmployees, FDQueryDepartmentEmployees.Command); if LApply.Errors.Count > 0 then // Raise an exception if any errors. raise Exception.Create(LApply.Errors.Strings.Text); end;
)
1) :
procedure TForm2.GetDepartmentEmployees(const ADEPTNO: string); var LDataSetList: TFDJSONDataSets; LDataSet: TFDDataSet; begin LDataSetList := ClientModule1.ServerMethods1Client.GetDepartmentEmployees(ADEPTNO); // Get department dataset LDataSet := TFDJSONDataSetsReader.GetListValueByName(LDataSetList,sDepartment); // Update UI FDMemTableDepartment.Active := False; FDMemTableDepartment.AppendData(LDataSet); // Get employees dataset LDataSet := TFDJSONDataSetsReader.GetListValueByName(LDataSetList, sEmployees); // Update UI FDMemTableEmployee.Active := False; FDMemTableEmployee.AppendData(LDataSet); end;
2) :
function TForm2.GetDeltas: TFDJSONDeltas; begin // Post if editing if FDMemTableDepartment.State in dsEditModes then begin FDMemTableDepartment.Post; end; if FDMemTableEmployee.State in dsEditModes then begin FDMemTableEmployee.Post; end; // Create a delta list Result := TFDJSONDeltas.Create; // Add deltas TFDJSONDeltasWriter.ListAdd(Result, sEmployees, FDMemTableEmployee); TFDJSONDeltasWriter.ListAdd(Result, sDepartment, FDMemTableDepartment); end;
procedure TForm2.ApplyUpdates; var LDeltaList: TFDJSONDeltas; begin LDeltaList := GetDeltas; // Call server method. Pass the delta list. ClientModule1.ServerMethods1Client.ApplyChangesDepartmentEmployees(LDeltaList); end;
:
2 :
TFDStanStorageJSONLink
TFDStanStorageBinLink
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
콘텐츠 SaaS | JSON 스키마 양식 빌더Bloomreach Content를 위한 JSON Form Builder 맞춤형 통합을 개발합니다. 최근 Bloomreach Content SaaS는 내장 앱 프레임워크를 사용하여 혁신적인 콘텐츠 유형 필드를 구축할...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.