unit ServiceMethods_Service_Impl; {----------------------------------------------------------------------------} { This unit was automatically generated by the RemObjects SDK after reading } { the RODL file associated with this project . } { } { This is where you are supposed to code the implementation of your objects. } {----------------------------------------------------------------------------} interface uses {vcl:} Classes, SysUtils, {RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions, {Ancestor Implementation:} DataAbstractService_Impl, {Used RODLs:} DataAbstract4_Intf, {Generated:} ServiceMethodsLibrary_Intf, uDADataStreamer, uDABinAdapter, uDAInterfaces, uDABusinessProcessor, uDAClasses, uRORemoteDataModule; type { TServiceMethods_Service } TServiceMethods_Service = class(TDataAbstractService, IServiceMethods_Service) BinDataStreamer: TDABinDataStreamer; DASchema: TDASchema; procedure DataAbstractServiceAfterAcquireConnection(aSender: TObject; const aConnectionName: string; const aAcquiredConnection: IDAConnection); procedure DataAbstractServiceAfterExecuteCommand(aSender: TObject; const aCommand: IDASQLCommand; aRowsAffacted: Integer); procedure DataAbstractServiceAfterGetDatasetData(aSender: TObject; const aDataset: IDADataset; const aIncludeSchema: Boolean; const aMaxRecords: Integer); procedure DataAbstractServiceAfterGetDatasetSchema(aSender: TObject; const aDataset: IDADataset); procedure DataAbstractServiceAfterProcessDeltas(aSender: TObject; aDeltaStructs: TDADeltaStructList); procedure DataAbstractServiceAfterReleaseConnection(aSender: TObject; const aConnectionName: string); procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string); procedure DataAbstractServiceBeforeExecuteCommand(aSender: TObject; const aCommand: IDASQLCommand); procedure DataAbstractServiceBeforeGetDatasetData(aSender: TObject; const aDataset: IDADataset; const aIncludeSchema: Boolean; const aMaxRecords: Integer); procedure DataAbstractServiceBeforeGetDatasetSchema(aSender: TObject; const aDataset: IDADataset); procedure DataAbstractServiceBeforeProcessDeltas(aSender: TObject; aDeltaStructs: TDADeltaStructList); procedure DataAbstractServiceBeforeReleaseConnection(aSender: TObject; const aConnectionName: string; const aAcquiredConnection: IDAConnection); procedure DataAbstractServiceGetSchemaAsXMLEvent(aSender: TObject; var aSchemaXML: string); procedure DataAbstractServiceProcessDeltasError(aSender: TObject; aDeltaStructs: TDADeltaStructList; aError: Exception; var aDoRaise: Boolean); procedure DataAbstractServiceUpdateDataBeginTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); procedure DataAbstractServiceUpdateDataCommitTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); procedure DataAbstractServiceUpdateDataRollBackTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); procedure DataAbstractServiceValidateCommandExecution(Sender: TObject; const aConnection: IDAConnection; const aDatasetName: string; const aParamNames: array of string; const aParamValues: array of Variant; aSchema: TDASchema; var Allowed: Boolean); procedure DataAbstractServiceValidateDatasetAccess(Sender: TObject; const aConnection: IDAConnection; const aDatasetName: string; const aParamNames: array of string; const aParamValues: array of Variant; aSchema: TDASchema; var Allowed: Boolean); procedure DataAbstractServiceValidateDirectSQLAccess(Sender: TObject; const aConnection: IDAConnection; const aSQLText: string; const aParamNames: array of string; const aParamValues: array of Variant; var Allowed: Boolean); procedure DataAbstractServiceAcquireConnectionFailure(aSender: TObject; const aConnectionName: string; aError: Exception); procedure DataAbstractServiceCreate(Sender: TObject); procedure DataAbstractServiceDestroy(Sender: TObject); procedure DataAbstractServiceActivate(const aClientID: TGUID; aSession: TROSession; const aMessage: IROMessage); procedure DataAbstractServiceDeactivate(const aClientID: TGUID; aSession: TROSession); procedure DataAbstractServiceBusinessProcessorAutoCreated( aSender: TRORemoteDataModule; BusinessProcessor: TDABusinessProcessor); private procedure Log(Astr: string); protected { IServiceMethods_Service methods } end; implementation {$R *.dfm} uses {Generated:} ServiceMethodsLibrary_Invk, ServiceMethods_ServerMain, Variants; procedure Create_ServiceMethods_Service(out anInstance: IUnknown); begin anInstance := TServiceMethods_Service.Create(nil); end; { TServiceMethods_Service } procedure TServiceMethods_Service.Log(Astr: string); begin ServiceMethods_ServerMainForm.Log(Astr); end; procedure TServiceMethods_Service.DataAbstractServiceAfterAcquireConnection( aSender: TObject; const aConnectionName: string; const aAcquiredConnection: IDAConnection); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterAcquireConnection.Checked then Exit; Log('***AfterAcquireConnection***'); Log('ConnectionName:'#9 + aConnectionName); Log('aAcquiredConnection.Name:'#9 + aAcquiredConnection.Name); Log('aAcquiredConnection.ConnectionString:'#9 + aAcquiredConnection.ConnectionString); Log('****************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAfterExecuteCommand( aSender: TObject; const aCommand: IDASQLCommand; aRowsAffacted: Integer); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterExecuteCommand.Checked then Exit; Log('***AfterExecuteCommand***'); Log('aCommand.Name:'#9 + aCommand.Name); Log('aCommand.SQL:'#9 + aCommand.SQL); Log('aRowsAffacted:'#9 + IntToStr(aRowsAffacted)); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAfterGetDatasetData( aSender: TObject; const aDataset: IDADataset; const aIncludeSchema: Boolean; const aMaxRecords: Integer); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterGetDatasetData.Checked then Exit; Log('***AfterGetDatasetData***'); Log('aDataset.Name:'#9 + aDataset.Name); Log('aDataset.SQL:'#9 + aDataset.SQL); Log('aIncludeSchema:'#9 + BoolStr[aIncludeSchema]); Log('aMaxRecords:'#9 + IntToStr(aMaxRecords)); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAfterGetDatasetSchema( aSender: TObject; const aDataset: IDADataset); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterGetDatasetSchema.Checked then Exit; Log('***AfterGetDatasetSchema***'); Log('aDataset.Name:'#9 + aDataset.Name); Log('aDataset.SQL:'#9 + aDataset.SQL); Log('***************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAfterProcessDeltas( aSender: TObject; aDeltaStructs: TDADeltaStructList); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterProcessDeltas.Checked then Exit; Log('***AfterProcessDeltas***'); Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count)); Log('************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAfterReleaseConnection( aSender: TObject; const aConnectionName: string); begin inherited; if not ServiceMethods_ServerMainForm.cbAfterReleaseConnection.Checked then Exit; Log('***AfterReleaseConnection***'); Log('aConnectionName:'#9 + aConnectionName); Log('****************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeAcquireConnection( aSender: TObject; var aConnectionName: string); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeAcquireConnection.Checked then Exit; Log('***BeforeAcquireConnection***'); Log('aConnectionName:'#9 + aConnectionName); Log('************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeExecuteCommand( aSender: TObject; const aCommand: IDASQLCommand); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeExecuteCommand.Checked then Exit; Log('***BeforeExecuteCommand***'); Log('aCommand.Name:'#9 + aCommand.Name); Log('aCommand.SQL:'#9 + aCommand.SQL); Log('************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeGetDatasetData( aSender: TObject; const aDataset: IDADataset; const aIncludeSchema: Boolean; const aMaxRecords: Integer); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeGetDatasetData.Checked then Exit; Log('***BeforeGetDatasetData***'); Log('aDataset.Name:'#9 + aDataset.Name); Log('aDataset.SQL:'#9 + aDataset.SQL); Log('aIncludeSchema:'#9 + BoolStr[aIncludeSchema]); Log('aMaxRecords:'#9 + IntToStr(aMaxRecords)); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeGetDatasetSchema( aSender: TObject; const aDataset: IDADataset); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeGetDatasetSchema.Checked then Exit; Log('***BeforeGetDatasetSchema***'); Log('aDataset.Name:'#9 + aDataset.Name); Log('aDataset.SQL:'#9 + aDataset.SQL); Log('****************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeProcessDeltas( aSender: TObject; aDeltaStructs: TDADeltaStructList); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeProcessDeltas.Checked then Exit; Log('***BeforeProcessDeltas***'); Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count)); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBeforeReleaseConnection( aSender: TObject; const aConnectionName: string; const aAcquiredConnection: IDAConnection); begin inherited; if not ServiceMethods_ServerMainForm.cbBeforeReleaseConnection.Checked then Exit; Log('***BeforeReleaseConnection***'); Log('aConnectionName:'#9 + aConnectionName); Log('aAcquiredConnection.Name:'#9 + aAcquiredConnection.Name); Log('aAcquiredConnection.ConnectionString:'#9 + aAcquiredConnection.ConnectionString); Log('*****************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceGetSchemaAsXMLEvent( aSender: TObject; var aSchemaXML: string); begin inherited; if not ServiceMethods_ServerMainForm.cbGetSchemaAsXMLEvent.Checked then Exit; Log('***GetSchemaAsXMLEvent***'); Log('Length(aSchemaXML):'#9 + intTostr(Length(aSchemaXML))); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceProcessDeltasError( aSender: TObject; aDeltaStructs: TDADeltaStructList; aError: Exception; var aDoRaise: Boolean); begin inherited; if not ServiceMethods_ServerMainForm.cbProcessDeltasError.Checked then Exit; aDoRaise := ServiceMethods_ServerMainForm.cbProcessDeltasErrorRaise.Checked; Log('***ProcessDeltasError***'); Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count)); Log('aError.ClassName:'#9 + aError.ClassName); Log('aError.Message:'#9 + aError.Message); Log('aDoRaise:'#9 + BoolStr[aDoRaise]); Log('*************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceUpdateDataBeginTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); begin inherited; if not ServiceMethods_ServerMainForm.cbUpdateDataBeginTransaction.Checked then Exit; Log('***UpdateDataBeginTransaction***'); Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]); Log('********************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceUpdateDataCommitTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); begin inherited; if not ServiceMethods_ServerMainForm.cbUpdateDataCommitTransaction.Checked then Exit; Log('***UpdateDataCommitTransaction***'); Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]); Log('*********************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceUpdateDataRollBackTransaction( Sender: TObject; var aUseDefaultTransactionLogic: Boolean); begin inherited; if not ServiceMethods_ServerMainForm.cbUpdateDataRollBackTransaction.Checked then Exit; Log('***UpdateDataRollBackTransaction***'); Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]); Log('***********************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceValidateCommandExecution( Sender: TObject; const aConnection: IDAConnection; const aDatasetName: string; const aParamNames: array of string; const aParamValues: array of Variant; aSchema: TDASchema; var Allowed: Boolean); var i: integer; SQLCommand: TDASQLCommand; begin inherited; if not ServiceMethods_ServerMainForm.cbValidateCommandExecution.Checked then Exit; Log('***ValidateCommandExecution***'); Log('aConnection.Name:'#9 + aConnection.Name); Log('aDatasetName:'#9 + aDatasetName); SQLCommand := aSchema.Commands.SQLCommandByName(aDatasetName); if (SQLCommand <> nil) and (SQLCommand.Statements.Count > 0) then Log('Command SQL:'#9 + SQLCommand.Statements[0].SQL); Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames)))); for i := Low(aParamNames) to High(aParamNames) do Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i])); Log('aSchema.Name:'#9 + aSchema.Name); Log('Allowed:'#9 + BoolStr[Allowed]); Log('******************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceValidateDatasetAccess( Sender: TObject; const aConnection: IDAConnection; const aDatasetName: string; const aParamNames: array of string; const aParamValues: array of Variant; aSchema: TDASchema; var Allowed: Boolean); var i: integer; begin inherited; if not ServiceMethods_ServerMainForm.cbValidateDatasetAccess.Checked then Exit; Log('***ValidateDatasetAccess***'); Log('aConnection.Name:'#9 + aConnection.Name); Log('aDatasetName:'#9 + aDatasetName); Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames)))); for i := Low(aParamNames) to High(aParamNames) do Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i])); Log('aSchema.Name:'#9 + aSchema.Name); Log('Allowed:'#9 + BoolStr[Allowed]); Log('***************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceValidateDirectSQLAccess( Sender: TObject; const aConnection: IDAConnection; const aSQLText: string; const aParamNames: array of string; const aParamValues: array of Variant; var Allowed: Boolean); var i: integer; begin inherited; if not ServiceMethods_ServerMainForm.cbValidateDirectSQLAccess.Checked then Exit; Log('***ValidateDirectSQLAccess***'); Log('aConnection.Name:'#9 + aConnection.Name); Log('aSQLText:'#9 + aSQLText); Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames)))); for i := Low(aParamNames) to High(aParamNames) do Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i])); Log('Allowed:'#9 + BoolStr[Allowed]); Log('***************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceAcquireConnectionFailure( aSender: TObject; const aConnectionName: string; aError: Exception); begin inherited; if not ServiceMethods_ServerMainForm.cbAcquireConnectionFailure.Checked then Exit; Log('***AcquireConnectionFailure***'); Log('aConnectionName:'#9 + aConnectionName); Log('aError.ClassName:'#9 + aError.ClassName); Log('aError.Message:'#9 + aError.Message); Log('******************************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceCreate( Sender: TObject); begin inherited; AllowSchemaAccess := ServiceMethods_ServerMainForm.cbAllowSchemaAccess.Checked; AcquireConnection := ServiceMethods_ServerMainForm.cbAcquireConnection.Checked; AllowDataAccess := ServiceMethods_ServerMainForm.cbAllowDataAccess.Checked; AllowWhereSQL := ServiceMethods_ServerMainForm.cbAllowWhereSQL.Checked; AllowExecuteCommands := ServiceMethods_ServerMainForm.cbAllowExecuteCommands.Checked; AllowExecuteSQL := ServiceMethods_ServerMainForm.cbAllowExecuteSQL.Checked; ProcessDeltasWithoutUpdateRules := ServiceMethods_ServerMainForm.cbProcessDeltasWithoutUpdateRules.Checked; AllowDynamicSelect := ServiceMethods_ServerMainForm.cbAllowDynamicSelect.Checked; AllowDynamicWhere := ServiceMethods_ServerMainForm.cbAllowDynamicWhere.Checked; AllowUpdates := ServiceMethods_ServerMainForm.cbAllowUpdates.Checked; AutoCreateBusinessProcessors := ServiceMethods_ServerMainForm.cbAutoCreateBusinessProcessors.Checked; Exit; Log('***Create***'); Log('************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceDestroy( Sender: TObject); begin Exit; Log('***Destroy***'); Log('*************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceActivate( const aClientID: TGUID; aSession: TROSession; const aMessage: IROMessage); begin Exit; Log('***Activate***'); Log('aClientID:'#9 + GUIDToString(aClientID)); // Log('aSession:'#9 + aSession.ClassName); // Log('aError.Message:'#9 + aError.Message); Log('**************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceDeactivate( const aClientID: TGUID; aSession: TROSession); begin Exit; Log('***Deactivate***'); Log('aClientID:'#9 + GUIDToString(aClientID)); Log('****************'); Log(''); end; procedure TServiceMethods_Service.DataAbstractServiceBusinessProcessorAutoCreated( aSender: TRORemoteDataModule; BusinessProcessor: TDABusinessProcessor); begin if not ServiceMethods_ServerMainForm.cbBusinessProcessorAutoCreated.Checked then Exit; Log('***BusinessProcessorAutoCreated***'); Log('****************'); Log(''); end; initialization TROClassFactory.Create('ServiceMethods_Service', Create_ServiceMethods_Service, TServiceMethods_Service_Invoker); finalization end.