<< Click to Display Table of Contents >> RayPack > 7.3 u6 > User Guide > PackDesigner > MSI / MST / RPP Based Projects > Visual Designer Mode > Database and Server > SQL Scripts Edit an SQL Script |
1.To edit an SQL script object, users load the list of existing items by calling the SQL Scripts view within the Visual Designer mode of PackDesigner.
2.Clicking on the list item of the object that has to be modified displays its details in the editor panel on the right-hand side of the RayPack application screen.
The following properties of the SQL script object may be manipulated:
Database
Select one of the SQL database objects that have been created for the current packaging project. If the required option is not available yet, the Create new SQL Database wizard has to be used to add one to the project. This wizard is available from the SQL Databases view.
User
RayPack allows to run SQL scripts either via Windows Authentication, or as a specific user. If the checkbox Use Windows Authentication is active, this option is used for the current SQL script.
To enable the usage of individual user credentials, the checkbox needs to be deselected. Once it is inactive, the controls for user object management become active for user selection.
Individual user credentials have to be given in the form of a user object. To select or create a user object, click on the browse button [...] at the right-hand side of the user input field. The Select User dialog is displayed. Please refer to the Common dialogs section for further details on how to manage user data objects.
Be aware: User objects may very likely be used at several places within SQL database, script, and IIS management structures. When the same user item is referred to from different locations, changing the properties of that user item actually takes effect for all related objects. Please double-check the correctness of user profile changes, and make sure all related objects are still valid and operational with the modified set of properties. |
Component
Each SQL script object has to be related to a component item of the packaging project. RayPack automatically creates a new component when an SQL database item is created. It is recommended to add SQL scripts to the same component as the parent SQL database object.
To select another existing component as parent container of the SQL script item, users click on the downwards-pointing arrow at the right-hand side of the component selector control. A list of existing components is displayed. The new selection is done with a click on any of the given components.
To create a new component for the SQL script object, users click on the browse button [...] at the right-hand side of the component control. The common dialog type Select Component is displayed, ready for creating and selecting components.
Sequence
The integer value is displayed in a read-only mode. The Visual Designer interface does not allow to modify the sequence value directly, but indirectly by the re-ordering options available from the context menu displayed when SQL script list items are right-clicked. (Execute first and Execute earlier reduce the sequence value, whilst Execute later and Execute last raise it.)
Tip: Any value that cannot be manipulated by dedicated Visual Designer user interface controls is nonetheless available for modification by the tools provided within the TABLES view of the Advanced mode. Even though there is a clear recommendation to leave the Advanced mode for experienced users, it is freely accessible for all RayPack users. |
Attributes
The attributes column of the RPSqlScript table is equipped to provide the following script execution options:
•Execute on install
The script will be executed when the package is installed.
•Execute on uninstall
The script will be executed when the package is uninstalled.
•Continue on error
If the script execution causes an error, the package run-time execution is not aborted, no matter if it is an installation, repair or uninstallation procedure.
•Rollback on install
The rollback mechanism for this SQL script is executed when the package is installed.
•Rollback on uninstall
The rollback mechanism for this SQL script is executed when the package is installed.
Users may activate each execution option by selecting the checkbox at the left-hand side of the option label.
Be aware: If neither "Execute on install" nor "Execute on uninstall" are selected, the script may very well never run on the target database during package run-time. |
The interface options for the SQL SCRIPT tab depend on the script source type that has been defined during SQL script object creation. However, if the displayed script has to be modified, users have to click on the Edit the SQL script... button above the actual script content display area. A new dialog window is opened, ready for manipulation according to the source type:
Binary
Users may either
•select another binary as source for the script string
•manually edit the content of the currently selected binary by simply editing the string shown in the SQL script text area
•replace the binary's content by loading new textual content from an external *.sql file
Property
Users may either
•select another property as source for the script string
•manually edit the content of the currently selected property by simply editing the string shown in the SQL script text area
•replace the properties content by loading new textual content from an external *.sql file
Text
Users may either
•manually edit the content of the Target column of the currently active RPSqlScript database table row reference by simply editing the string shown in the SQL script text area
•replace the Target column content of the very same RPSqlScript database table row reference by loading new textual content from an external *.sql file
Switch off '[', ']' and Switch on '[', ']'
Square brackets may either be considered to be triggers for special SQL script notations, such as delimited identifiers, or as simple text signs without special functionality. In order to support packagers in their aim for clean and unambiguous source definitions, the switch for square brackets has been added to the SQL script text area.
Switching square brackets off leads to the explicit escaping of square bracket, which means that each opening and closing square bracket is prefixed with escape triggers. The escaped bracket signs are no longer considered to be special notations, but as a mere opening / closing bracket signs without additional functionality.
Example:
The original text "This is [sample] text" turns into "This is [\[]sample[\]] text" once square brackets are turned off.
Switching square brackets on removes escaping from already existing escaped opening / closing bracket signs. They are considered to be special characters (SQL delimited identifiers) again.
Example:
The original text "This is [sample] text with different [\[]square[\]] bracket usages." turns into "This is [sample] text with different [square] bracket usages." once square brackets are turned on.
Changes to the SQL script content are saved with a click on the OK button at the bottom of the editor. The OK button is not available as long as the SQL script input field is empty, since the script content is a mandatory information. Hitting Cancel discards any unsaved changes and closes the dialog window.
Be aware: Saving changes to SQL script content that comes from a binary or property actually modifies the content of that specific packaging project item. If other functions or options rely on the very same binary or object, they will have to interact with the modified content as well. |
If search & replace activities on SQL scripts are required for execution at package run-time, this is the tab to manage them. With a click on the Add button, a new replacement task is generated with default values. It is automatically set to the end of the current replacement task sequence (which means at the lowest position of the task item list).
To change a replacement task property value, users have to double-click the cell value of the list item they want to modify. The current value is marked and ready for direct inline modification:
Sequence
The sequence value is an integer value, indicating the order of replacement execution. The item with the lowest sequence value is run first.
Search
The search string has to be given as plain text. There is no support for wild card usage or regular expression based search strings.
Please keep in mind, that the standard search algorithm is case insensitive. To change that, the attributes value 2 has to be set for the replacement job.
Replace
The string that will be put instead of the matched keyword from Search.
Please keep in mind, that the standard search algorithm replaces all matches. To stop the replacement after the first match, the attributes value 4 has to be set for the replacement job.
Attributes
Users may either enter any combination of the available attribute bit value representations manually, or use the helping hand of the Attributes Editor for this property. To display the Attributes Editor, users have to double-click the current value of the attributes column, and use the downwards pointing arrow button. Checkboxes become visible, allowing to individually enable or disable each attribute option:
1 = Match whole word only
2 = Match case
4 = Replace once only
The default attribute value for a replacement task is 1, which means that the search is resolved word by word.
To remove a replacement task, users have to select it from the list of existing replacements, and use the Remove button below the list. The task is removed immediately, without an intermediate confirm dialog.