Defining Script Objects
New Information - SQL Server 2000 SP3.
You can assign Microsoft® ActiveX® scripts to method and property definitions in an information model. The repository engine exposes these methods and properties, and invokes the associated script at run time. You can also use scripts to program transient object collections.
You can create script using Microsoft JScript® and Microsoft Visual Basic® Scripting Edition (VBScript). To define scripts in your information model, use the IScriptDef interface for COM programs or the ScriptDef object for Automation programs. Only one script definition can be associated for each method or property.
Attaching scripts to properties that are defined as BLOBs (that is, PropertyDef objects that have SQLType set to SQL_LONGVARBINARY or SQL_LONGVARCHAR) is not supported. Attaching scripts to large property objects does not result in an error or warning; the script is not invoked.
IScriptDef properties do not reside on the IMethodDef or IPropertyDef interfaces by design. Associating a script at the interface or class level allows you to implement the same method in a variety of contexts.
Security Note By default, script support in information models is disabled to prevent attackers from adding malicious script to an information model or modifying existing script so that it damages the system or data. If malicious script is added to an information model, it runs whenever a client accesses the properties or methods that are associated with the script.
To use script, you can create a registry setting that enables script support, and then secure the information models and repository database to prevent unauthorized access.
To create the registry setting, open Registry Editor and navigate to
Create a registry key for
Repository, and then create a subkey for
Engine so that the path equals
Repository\Engine. On the
Engine registry key, add a new DWORD value, name the value AllowScripting, and set the value to 1. If you want to disable scripting later, you can set the value to 0.
The following topics provide more information about script implementation.
|Binding Scripts||Explains the binding algorithm that links scripts to specific methods and properties|
|Accessing a Script||Describes how to access a script|
|Predefined Script Variables||Describes variables that you can use when creating a script|
|Method Invocation for Scripted Methods||Describes requirements and considerations for invoking a scripted method|
|Get Method for Scripted Properties||Describes requirements and considerations for creating the Get function of a scripted property|
|Put Method for Scripted Properties||Describes requirements and considerations for creating the Put function of a scripted property|