TDASpiderMonkeyScriptProvider

Overview

The TDASpiderMonkeyScriptProvider component provides access to RemObjects DataAbstract Scripting feature. Use this component both on the server and client side to implement and execute server and client scripts.

The TDASpiderMonkeyScriptProvider is based on SpiderMonkey JavaScript engine that can work on Windows 32 and 64bit, OSX and Linux.

Usage

procedure TEcmaScriptService.DataAbstractServiceActivate(const aClientID: TGUID;
  aSession: TROSession; const aMessage: IROMessage);
begin
  Self.ScriptProvider := DASpiderMonkeyScriptProvider1;
end;
  • client-side: Drop TDASpiderMonkeyScriptProvider to client datamodule and link with TDADataTable.ScriptingProvider in design-time. In runtime it will be:
procedure TClientDataModule.DataModuleCreate(Sender: TObject);
begin
  tbl_Scripting_Clients.ScriptingProvider := DASpiderMonkeyScriptProvider1;
end;

See more about how to use TDASpiderMonkeyScriptProvider component at the article Business Rules Scripting.

Location

 

constructor Create  override

Standard component constructor

constructor Create(AOwner: TComponent)

Parameters:

  • AOwner: Owner

AfterCommit    (declared in TDABaseEcmaScriptProvider)

Called just after a transaction (set of insert/update/delete) has been committed.

procedure AfterCommit

AfterExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Called after an sql command is executed.

procedure AfterExecuteCommand(aSQL: string; aCommandName: string; aParameters: DataParameterArray; aRowsAffected: Integer)

Parameters:

  • aSQL: sql
  • aCommandName: command name
  • aParameters: parameters
  • aRowsAffected: rows affected

AfterGetData    (declared in TDABaseEcmaScriptProvider)

Called after a request for data is sent.

procedure AfterGetData(aTables: StringArray; aRequestInfo: TableRequestInfoArray)

Parameters:

  • aTables: table's names
  • aRequestInfo: request infos

AfterProcessDelta    (declared in TDABaseEcmaScriptProvider)

Called for each Delta on the server after it's applied. Any changes done to the delta will only be sent back to the client.

procedure AfterProcessDelta(aDelta: IDADelta)

Parameters:

  • aDelta: delta

AfterProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Called after each change is applied to the database.

procedure AfterProcessDeltaChange(aDelta: IDADelta; aChange: TDADeltaChange; aWasRefreshed: Boolean)

Parameters:

  • aDelta: delta
  • aChange: change
  • aWasRefreshed: mode

AfterRollback    (declared in TDABaseEcmaScriptProvider)

Called just after a transaction (set of insert/update/delete) is rolled back (canceled).

procedure AfterRollback

Assign  override    (declared in TDAScriptingProvider)

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

BeforeCommit    (declared in TDABaseEcmaScriptProvider)

Called just before a transaction (set of insert/update/delete) has been committed.

procedure BeforeCommit

BeforeDelete    (declared in TDABaseEcmaScriptProvider)

Called when the client (or server depending on the schema settings) deletes a record.

procedure BeforeDelete(aRow: IDARowHelper)

Parameters:

  • aRow: record

BeforeExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Called before an SQL command is executed.

procedure BeforeExecuteCommand(aSQL: string; aCommandName: string; aParameters: DataParameterArray)

Parameters:

  • aSQL: sql command
  • aCommandName: command's name
  • aParameters: parameters

BeforeGetData    (declared in TDABaseEcmaScriptProvider)

Called before a request for data is sent.

procedure BeforeGetData(aTables: StringArray; aRequestInfo: TableRequestInfoArray)

Parameters:

  • aTables: table's names
  • aRequestInfo: request infos

BeforePost    (declared in TDABaseEcmaScriptProvider)

Called before a change to a record is accepted.

procedure BeforePost(aRow: IDARowHelper)

Parameters:

  • aRow: record

BeforeProcessDelta    (declared in TDABaseEcmaScriptProvider)

Called for each delta on the server before it's applied. Any changes done to the delta will be posted to the database.

procedure BeforeProcessDelta(aDelta: IDADelta)

Parameters:

  • aDelta: delta

BeforeProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Called before each change is applied to the database. Any implementation should return the current value of canRemove unless it changed.

procedure BeforeProcessDeltaChange(aDelta: IDADelta; aChange: TDADeltaChange; aWasRefreshed: Boolean; var aCanRemove: Boolean)

Parameters:

  • aDelta: delta
  • aChange: change
  • aWasRefreshed: mode
  • aCanRemove: specifies that this change can be removed from sending back to client

BeforeRollback    (declared in TDABaseEcmaScriptProvider)

Called just before a transaction (set of insert/update/delete) is rolled back (canceled).

procedure BeforeRollback

Context    (declared in TDABaseEcmaScriptProvider)

Represents specified contextual information about current instance.

property Context: IDAScriptContext read write

CreateTransaction    (declared in TDABaseEcmaScriptProvider)

Called when a new transaction is created to fetch or update records.

procedure CreateTransaction

DoContextChangedArgs  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnContextChanged event.

procedure DoContextChangedArgs(aEngine: TDAEcmaScriptEngine; aContext: IDAScriptContext; aServerContext: IDAServerScriptContext; IsSubscript: Boolean; aSubScript: string)

Parameters:

  • aEngine:
  • aContext:
  • aServerContext:
  • IsSubscript:
  • aSubScript:

DoError  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnError event

procedure DoError(aError: ScriptException)

Parameters:

  • aError: Exception

DoLog  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnLog event

procedure DoLog(aMessage: string)

Parameters:

  • aMessage: Message

Engine    (declared in TDABaseEcmaScriptProvider)

Represents native engine components that gives additional functionality.

For example, Engine object can be used to set custom functions as follows:

ScriptProvider.Engine.Variables.SetVariable('Base64GUID', Base64GUID);

property Engine: TDAEcmaScriptEngine read

Fail  protected    (declared in TDABaseEcmaScriptProvider)

Raises the specified exception.

function Fail(args: array of Variant): Variant

Parameters:

  • args: Specified array of parameters.

GetEngineClass  protected override

Returns default engine class for current script provider.

function GetEngineClass: TDAEcmaScriptEngineClass

GetLDAWrapperClass  protected override

Returns default LDAWrapper class, i.e. TDASpiderMonkeyLDAWrapper

function GetLDAWrapperClass: TDAEcmaLDAWrapperClass

GetNative  protected    (declared in TDABaseEcmaScriptProvider)

Implements IDANativeAccess method. Returns Self

function GetNative: TObject

GetWhereBuilderClass  protected override

Returns default WhereBuilderClass class, i.e. TDASpiderMonkeyWhereBuilderMethods

function GetWhereBuilderClass: TDAEcmaWhereBuilderMethodsClass

HasAfterCommit    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterCommit script is present. In other cases returns false.

property HasAfterCommit: Boolean read

HasAfterExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterExecuteCommand script is present. In other cases returns false.

property HasAfterExecuteCommand: Boolean read

HasAfterGetData    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterGetData script is present. In other cases returns false.

property HasAfterGetData: Boolean read

HasAfterProcessDelta    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterProcessDelta script is present. In other cases returns false.

property HasAfterProcessDelta: Boolean read

HasAfterProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterProcessDeltaChange script is present. In other cases returns false.

property HasAfterProcessDeltaChange: Boolean read

HasAfterRollback    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterRollback script is present. In other cases returns false.

property HasAfterRollback: Boolean read

HasBeforeCommit    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeCommit script is present. In other cases returns false.

property HasBeforeCommit: Boolean read

HasBeforeDelete    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeDelete script is present. In other cases returns false.

property HasBeforeDelete[aTable: string]: Boolean read

HasBeforeExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeExecuteCommand script is present. In other cases returns false.

property HasBeforeExecuteCommand: Boolean read

HasBeforeGetData    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeGetData script is present. In other cases returns false.

property HasBeforeGetData: Boolean read

HasBeforePost    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforePost script is present. In other cases returns false.

property HasBeforePost[aTable: string]: Boolean read

HasBeforeProcessDelta    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeProcessDelta script is present. In other cases returns false.

property HasBeforeProcessDelta: Boolean read

HasBeforeProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeProcessDeltaChange script is present. In other cases returns false.

property HasBeforeProcessDeltaChange: Boolean read

HasBeforeRollback    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeRollback script is present. In other cases returns false.

property HasBeforeRollback: Boolean read

HasCreateTransaction    (declared in TDABaseEcmaScriptProvider)

Returns true if CreateTransaction script is present. In other cases returns false.

property HasCreateTransaction: Boolean read

HasOnNewRow    (declared in TDABaseEcmaScriptProvider)

Returns true if OnNewRow script is present. In other cases returns false.

property HasOnNewRow[aTable: string]: Boolean read

HasProcessError    (declared in TDABaseEcmaScriptProvider)

Returns true if ProcessError script is present. In other cases returns false.

property HasProcessError: Boolean read

HasUnknownSqlMacroIdentifier    (declared in TDABaseEcmaScriptProvider)

Returns true if onUnknownSqlMacroIdentifier script is present. In other cases returns false.

property HasUnknownSqlMacroIdentifier: Boolean read

HasValidateCommandAccess    (declared in TDABaseEcmaScriptProvider)

Returns true if ValidateCommandAccess script is present. In other cases returns false.

property HasValidateCommandAccess: Boolean read

HasValidateDataTableAccess    (declared in TDABaseEcmaScriptProvider)

Returns true.

property HasValidateDataTableAccess: Boolean read

HasValidateDirectSQLAccess    (declared in TDABaseEcmaScriptProvider)

Returns true.

property HasValidateDirectSQLAccess: Boolean read

InitializeEngine  protected override

Performs initialization of engine.

procedure InitializeEngine(aEngine: TDAEcmaScriptEngine)

Parameters:

  • aEngine: engine

LoadScript    (declared in TDABaseEcmaScriptProvider)

Loads specified script.

procedure LoadScript(aScript: string)

Parameters:

  • aScript: Specified script.

LogMessage  protected    (declared in TDABaseEcmaScriptProvider)

Logs specified information.

function LogMessage(args: array of Variant): Variant

Parameters:

  • args: Specified collection with information need to log.

MaxMemory

Maximum number of allocated bytes after which garbage collection of SpiderMonkey is run. 1mb is default value

property MaxMemory: Cardinal read write

NewGuid  protected    (declared in TDABaseEcmaScriptProvider)

Creates and returns new Guid value.

function NewGuid(args: array of Variant): Variant

Parameters:

  • args: are not used.

NewGuidString  protected    (declared in TDABaseEcmaScriptProvider)

Creates and returns new Guid value as string.

function NewGuidString(args: array of Variant): Variant

Parameters:

  • args: are not used.

Notification  protected override    (declared in TDABaseScriptingProvider)

Forwards notification messages to all owned components.

procedure Notification(AComponent: TComponent; Operation: TOperation)

Parameters:

  • AComponent: component
  • Operation: operation

OnContextChanged    (declared in TDABaseEcmaScriptProvider)

Fires when Context property is changing.

property OnContextChanged: TDABaseEcmaScriptContextChangedArgs read write
delegate: procedure OnContextChanged(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aEngine: TDAEcmaScriptEngine; aContext: IDAScriptContext; aServerContext: IDAServerScriptContext; IsSubscript: Boolean; aSubScript: string)

OnError    (declared in TDABaseEcmaScriptProvider)

Fires when Error is happed.

property OnError: TDABaseEcmaScriptErrorEvent read write
delegate: procedure OnError(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aError: ScriptException)

OnLog    (declared in TDABaseEcmaScriptProvider)

Fires when script execute function LogMessage to log specified information.

property OnLog: TDABaseEcmaScriptLogEvent read write
delegate: procedure OnLog(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aMessage: string)

OnNewRow    (declared in TDABaseEcmaScriptProvider)

Called when creating new rows, it can be used to initialize new records.

procedure OnNewRow(aRow: IDARowHelper)

Parameters:

  • aRow: Row

ProcessError    (declared in TDABaseEcmaScriptProvider)

Called when an error occurs during applying a change. Should return the current value of aCanContinue, or false to stop trying the next change.

procedure ProcessError(aDelta: IDADelta; aChange: TDADeltaChange; var aCanContinue: Boolean; var aError: Exception)

Parameters:

  • aDelta: Delta instance containing failed data change
  • aChange: DeltaChange that cannot be applied to the database
  • aCanContinue: Flag indicating wthether Data Abstract should process other DeltaChange instances instead of rolling back the transaction immediately
  • aError: Exception raised by the data change attempt

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

ScriptableComponent    (declared in TDAScriptingProvider)

property ScriptableComponent: TScriptableComponent read write

ScriptObjectToVariant  protected virtual    (declared in TDABaseEcmaScriptProvider)

Used for convertation of Script object into variant object.

TDAActiveScriptProvider converts ScriptObject into COM compatible object.

function ScriptObjectToVariant(aObj: TDAEcmaBaseScriptObject): Variant

Parameters:

  • aObj: Object

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

StackSize

The size, in bytes, of each "stack chunk". This is a memory management tuning parameter of SpiderMonkey which most users should not adjust. 8192 is a good default value.

property StackSize: Cardinal read write

SubScripts    (declared in TDABaseEcmaScriptProvider)

Represent the whole list of Scripts for every data table in the TDASchema.

property SubScripts: TObjectDictionary<string, TDAEcmaScriptEngine> read

SupportsLanguage    (declared in TDABaseEcmaScriptProvider)

Returns true if aName equals: js, javascript, jscript, ecmascript, rsljavascript. Otherwise returns false.

function SupportsLanguage(aName: string): Boolean

Parameters:

  • aName: specified language name.

UnknownSqlMacroIdentifier    (declared in TDABaseEcmaScriptProvider)

Called when an unknown macro is used from within an sql statement.

procedure UnknownSqlMacroIdentifier(aIdentifier: string; var aValue: string)

Parameters:

  • aIdentifier: identifier.
  • aValue: value.

ValidateCommandAccess    (declared in TDABaseEcmaScriptProvider)

Called before a command is executed. Should return true if access is allowed.

procedure ValidateCommandAccess(aName: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aName: command name.
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

ValidateDataTableAccess    (declared in TDABaseEcmaScriptProvider)

Called during validation of request (fetching) for a data table. Should return true if access to that table should be allowed.

procedure ValidateDataTableAccess(aName: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aName: table name
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

ValidateDirectSQLAccess    (declared in TDABaseEcmaScriptProvider)

Called when a user executes raw sql, generally this is disabled but can be allowed by returning true here.

procedure ValidateDirectSQLAccess(aSQL: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aSQL: raw sql.
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

VariantArrayToEcmaVariant  protected virtual    (declared in TDABaseEcmaScriptProvider)

Converts array of variant into variant.

function VariantArrayToEcmaVariant(args: array of Variant): Variant

Parameters:

  • args: array of variant

 

Context    (declared in TDABaseEcmaScriptProvider)

Represents specified contextual information about current instance.

property Context: IDAScriptContext read write

Engine    (declared in TDABaseEcmaScriptProvider)

Represents native engine components that gives additional functionality.

For example, Engine object can be used to set custom functions as follows:

ScriptProvider.Engine.Variables.SetVariable('Base64GUID', Base64GUID);

property Engine: TDAEcmaScriptEngine read

HasAfterCommit    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterCommit script is present. In other cases returns false.

property HasAfterCommit: Boolean read

HasAfterExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterExecuteCommand script is present. In other cases returns false.

property HasAfterExecuteCommand: Boolean read

HasAfterGetData    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterGetData script is present. In other cases returns false.

property HasAfterGetData: Boolean read

HasAfterProcessDelta    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterProcessDelta script is present. In other cases returns false.

property HasAfterProcessDelta: Boolean read

HasAfterProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterProcessDeltaChange script is present. In other cases returns false.

property HasAfterProcessDeltaChange: Boolean read

HasAfterRollback    (declared in TDABaseEcmaScriptProvider)

Returns true if AfterRollback script is present. In other cases returns false.

property HasAfterRollback: Boolean read

HasBeforeCommit    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeCommit script is present. In other cases returns false.

property HasBeforeCommit: Boolean read

HasBeforeDelete    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeDelete script is present. In other cases returns false.

property HasBeforeDelete[aTable: string]: Boolean read

HasBeforeExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeExecuteCommand script is present. In other cases returns false.

property HasBeforeExecuteCommand: Boolean read

HasBeforeGetData    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeGetData script is present. In other cases returns false.

property HasBeforeGetData: Boolean read

HasBeforePost    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforePost script is present. In other cases returns false.

property HasBeforePost[aTable: string]: Boolean read

HasBeforeProcessDelta    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeProcessDelta script is present. In other cases returns false.

property HasBeforeProcessDelta: Boolean read

HasBeforeProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeProcessDeltaChange script is present. In other cases returns false.

property HasBeforeProcessDeltaChange: Boolean read

HasBeforeRollback    (declared in TDABaseEcmaScriptProvider)

Returns true if BeforeRollback script is present. In other cases returns false.

property HasBeforeRollback: Boolean read

HasCreateTransaction    (declared in TDABaseEcmaScriptProvider)

Returns true if CreateTransaction script is present. In other cases returns false.

property HasCreateTransaction: Boolean read

HasOnNewRow    (declared in TDABaseEcmaScriptProvider)

Returns true if OnNewRow script is present. In other cases returns false.

property HasOnNewRow[aTable: string]: Boolean read

HasProcessError    (declared in TDABaseEcmaScriptProvider)

Returns true if ProcessError script is present. In other cases returns false.

property HasProcessError: Boolean read

HasUnknownSqlMacroIdentifier    (declared in TDABaseEcmaScriptProvider)

Returns true if onUnknownSqlMacroIdentifier script is present. In other cases returns false.

property HasUnknownSqlMacroIdentifier: Boolean read

HasValidateCommandAccess    (declared in TDABaseEcmaScriptProvider)

Returns true if ValidateCommandAccess script is present. In other cases returns false.

property HasValidateCommandAccess: Boolean read

HasValidateDataTableAccess    (declared in TDABaseEcmaScriptProvider)

Returns true.

property HasValidateDataTableAccess: Boolean read

HasValidateDirectSQLAccess    (declared in TDABaseEcmaScriptProvider)

Returns true.

property HasValidateDirectSQLAccess: Boolean read

MaxMemory

Maximum number of allocated bytes after which garbage collection of SpiderMonkey is run. 1mb is default value

property MaxMemory: Cardinal read write

ScriptableComponent    (declared in TDAScriptingProvider)

property ScriptableComponent: TScriptableComponent read write

StackSize

The size, in bytes, of each "stack chunk". This is a memory management tuning parameter of SpiderMonkey which most users should not adjust. 8192 is a good default value.

property StackSize: Cardinal read write

SubScripts    (declared in TDABaseEcmaScriptProvider)

Represent the whole list of Scripts for every data table in the TDASchema.

property SubScripts: TObjectDictionary<string, TDAEcmaScriptEngine> read

 

constructor Create  override

Standard component constructor

constructor Create(AOwner: TComponent)

Parameters:

  • AOwner: Owner

AfterCommit    (declared in TDABaseEcmaScriptProvider)

Called just after a transaction (set of insert/update/delete) has been committed.

procedure AfterCommit

AfterExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Called after an sql command is executed.

procedure AfterExecuteCommand(aSQL: string; aCommandName: string; aParameters: DataParameterArray; aRowsAffected: Integer)

Parameters:

  • aSQL: sql
  • aCommandName: command name
  • aParameters: parameters
  • aRowsAffected: rows affected

AfterGetData    (declared in TDABaseEcmaScriptProvider)

Called after a request for data is sent.

procedure AfterGetData(aTables: StringArray; aRequestInfo: TableRequestInfoArray)

Parameters:

  • aTables: table's names
  • aRequestInfo: request infos

AfterProcessDelta    (declared in TDABaseEcmaScriptProvider)

Called for each Delta on the server after it's applied. Any changes done to the delta will only be sent back to the client.

procedure AfterProcessDelta(aDelta: IDADelta)

Parameters:

  • aDelta: delta

AfterProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Called after each change is applied to the database.

procedure AfterProcessDeltaChange(aDelta: IDADelta; aChange: TDADeltaChange; aWasRefreshed: Boolean)

Parameters:

  • aDelta: delta
  • aChange: change
  • aWasRefreshed: mode

AfterRollback    (declared in TDABaseEcmaScriptProvider)

Called just after a transaction (set of insert/update/delete) is rolled back (canceled).

procedure AfterRollback

Assign  override    (declared in TDAScriptingProvider)

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

BeforeCommit    (declared in TDABaseEcmaScriptProvider)

Called just before a transaction (set of insert/update/delete) has been committed.

procedure BeforeCommit

BeforeDelete    (declared in TDABaseEcmaScriptProvider)

Called when the client (or server depending on the schema settings) deletes a record.

procedure BeforeDelete(aRow: IDARowHelper)

Parameters:

  • aRow: record

BeforeExecuteCommand    (declared in TDABaseEcmaScriptProvider)

Called before an SQL command is executed.

procedure BeforeExecuteCommand(aSQL: string; aCommandName: string; aParameters: DataParameterArray)

Parameters:

  • aSQL: sql command
  • aCommandName: command's name
  • aParameters: parameters

BeforeGetData    (declared in TDABaseEcmaScriptProvider)

Called before a request for data is sent.

procedure BeforeGetData(aTables: StringArray; aRequestInfo: TableRequestInfoArray)

Parameters:

  • aTables: table's names
  • aRequestInfo: request infos

BeforePost    (declared in TDABaseEcmaScriptProvider)

Called before a change to a record is accepted.

procedure BeforePost(aRow: IDARowHelper)

Parameters:

  • aRow: record

BeforeProcessDelta    (declared in TDABaseEcmaScriptProvider)

Called for each delta on the server before it's applied. Any changes done to the delta will be posted to the database.

procedure BeforeProcessDelta(aDelta: IDADelta)

Parameters:

  • aDelta: delta

BeforeProcessDeltaChange    (declared in TDABaseEcmaScriptProvider)

Called before each change is applied to the database. Any implementation should return the current value of canRemove unless it changed.

procedure BeforeProcessDeltaChange(aDelta: IDADelta; aChange: TDADeltaChange; aWasRefreshed: Boolean; var aCanRemove: Boolean)

Parameters:

  • aDelta: delta
  • aChange: change
  • aWasRefreshed: mode
  • aCanRemove: specifies that this change can be removed from sending back to client

BeforeRollback    (declared in TDABaseEcmaScriptProvider)

Called just before a transaction (set of insert/update/delete) is rolled back (canceled).

procedure BeforeRollback

CreateTransaction    (declared in TDABaseEcmaScriptProvider)

Called when a new transaction is created to fetch or update records.

procedure CreateTransaction

DoContextChangedArgs  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnContextChanged event.

procedure DoContextChangedArgs(aEngine: TDAEcmaScriptEngine; aContext: IDAScriptContext; aServerContext: IDAServerScriptContext; IsSubscript: Boolean; aSubScript: string)

Parameters:

  • aEngine:
  • aContext:
  • aServerContext:
  • IsSubscript:
  • aSubScript:

DoError  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnError event

procedure DoError(aError: ScriptException)

Parameters:

  • aError: Exception

DoLog  protected virtual    (declared in TDABaseEcmaScriptProvider)

Fires OnLog event

procedure DoLog(aMessage: string)

Parameters:

  • aMessage: Message

Fail  protected    (declared in TDABaseEcmaScriptProvider)

Raises the specified exception.

function Fail(args: array of Variant): Variant

Parameters:

  • args: Specified array of parameters.

GetEngineClass  protected override

Returns default engine class for current script provider.

function GetEngineClass: TDAEcmaScriptEngineClass

GetLDAWrapperClass  protected override

Returns default LDAWrapper class, i.e. TDASpiderMonkeyLDAWrapper

function GetLDAWrapperClass: TDAEcmaLDAWrapperClass

GetNative  protected    (declared in TDABaseEcmaScriptProvider)

Implements IDANativeAccess method. Returns Self

function GetNative: TObject

GetWhereBuilderClass  protected override

Returns default WhereBuilderClass class, i.e. TDASpiderMonkeyWhereBuilderMethods

function GetWhereBuilderClass: TDAEcmaWhereBuilderMethodsClass

InitializeEngine  protected override

Performs initialization of engine.

procedure InitializeEngine(aEngine: TDAEcmaScriptEngine)

Parameters:

  • aEngine: engine

LoadScript    (declared in TDABaseEcmaScriptProvider)

Loads specified script.

procedure LoadScript(aScript: string)

Parameters:

  • aScript: Specified script.

LogMessage  protected    (declared in TDABaseEcmaScriptProvider)

Logs specified information.

function LogMessage(args: array of Variant): Variant

Parameters:

  • args: Specified collection with information need to log.

NewGuid  protected    (declared in TDABaseEcmaScriptProvider)

Creates and returns new Guid value.

function NewGuid(args: array of Variant): Variant

Parameters:

  • args: are not used.

NewGuidString  protected    (declared in TDABaseEcmaScriptProvider)

Creates and returns new Guid value as string.

function NewGuidString(args: array of Variant): Variant

Parameters:

  • args: are not used.

Notification  protected override    (declared in TDABaseScriptingProvider)

Forwards notification messages to all owned components.

procedure Notification(AComponent: TComponent; Operation: TOperation)

Parameters:

  • AComponent: component
  • Operation: operation

OnNewRow    (declared in TDABaseEcmaScriptProvider)

Called when creating new rows, it can be used to initialize new records.

procedure OnNewRow(aRow: IDARowHelper)

Parameters:

  • aRow: Row

ProcessError    (declared in TDABaseEcmaScriptProvider)

Called when an error occurs during applying a change. Should return the current value of aCanContinue, or false to stop trying the next change.

procedure ProcessError(aDelta: IDADelta; aChange: TDADeltaChange; var aCanContinue: Boolean; var aError: Exception)

Parameters:

  • aDelta: Delta instance containing failed data change
  • aChange: DeltaChange that cannot be applied to the database
  • aCanContinue: Flag indicating wthether Data Abstract should process other DeltaChange instances instead of rolling back the transaction immediately
  • aError: Exception raised by the data change attempt

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

ScriptObjectToVariant  protected virtual    (declared in TDABaseEcmaScriptProvider)

Used for convertation of Script object into variant object.

TDAActiveScriptProvider converts ScriptObject into COM compatible object.

function ScriptObjectToVariant(aObj: TDAEcmaBaseScriptObject): Variant

Parameters:

  • aObj: Object

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SupportsLanguage    (declared in TDABaseEcmaScriptProvider)

Returns true if aName equals: js, javascript, jscript, ecmascript, rsljavascript. Otherwise returns false.

function SupportsLanguage(aName: string): Boolean

Parameters:

  • aName: specified language name.

UnknownSqlMacroIdentifier    (declared in TDABaseEcmaScriptProvider)

Called when an unknown macro is used from within an sql statement.

procedure UnknownSqlMacroIdentifier(aIdentifier: string; var aValue: string)

Parameters:

  • aIdentifier: identifier.
  • aValue: value.

ValidateCommandAccess    (declared in TDABaseEcmaScriptProvider)

Called before a command is executed. Should return true if access is allowed.

procedure ValidateCommandAccess(aName: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aName: command name.
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

ValidateDataTableAccess    (declared in TDABaseEcmaScriptProvider)

Called during validation of request (fetching) for a data table. Should return true if access to that table should be allowed.

procedure ValidateDataTableAccess(aName: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aName: table name
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

ValidateDirectSQLAccess    (declared in TDABaseEcmaScriptProvider)

Called when a user executes raw sql, generally this is disabled but can be allowed by returning true here.

procedure ValidateDirectSQLAccess(aSQL: string; aParameterNames: array of string; aParameterValues: array of Variant; var aAllowed: Boolean)

Parameters:

  • aSQL: raw sql.
  • aParameterNames: parameter names
  • aParameterValues: parameter values
  • aAllowed: contains access state

VariantArrayToEcmaVariant  protected virtual    (declared in TDABaseEcmaScriptProvider)

Converts array of variant into variant.

function VariantArrayToEcmaVariant(args: array of Variant): Variant

Parameters:

  • args: array of variant

 

OnContextChanged    (declared in TDABaseEcmaScriptProvider)

Fires when Context property is changing.

property OnContextChanged: TDABaseEcmaScriptContextChangedArgs read write
delegate: procedure OnContextChanged(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aEngine: TDAEcmaScriptEngine; aContext: IDAScriptContext; aServerContext: IDAServerScriptContext; IsSubscript: Boolean; aSubScript: string)

OnError    (declared in TDABaseEcmaScriptProvider)

Fires when Error is happed.

property OnError: TDABaseEcmaScriptErrorEvent read write
delegate: procedure OnError(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aError: ScriptException)

OnLog    (declared in TDABaseEcmaScriptProvider)

Fires when script execute function LogMessage to log specified information.

property OnLog: TDABaseEcmaScriptLogEvent read write
delegate: procedure OnLog(aEcmaScriptProvider: TDABaseEcmaScriptProvider; aMessage: string)