|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > Database > OnPrepareSQLStatementForReleasedDatabase.LST script file |
available from build: 20040618
This script allows to alter directly the SQL command that inserts records in the Released Database.
This because you may have a RELEASED_DATABASE containing files different from the original.
Options→Environment→Release Database Mode
@SQLCMD |
the SQL command |
@SQLCMD |
the SQL command |
OnCopyReleasedFileToSecuredStorageArea.LST script file
The following script changes the target drive from J:\ to S:\ and from N:\ to W:\ while updating the RELEASED_DATABASE paths
.VBSCRIPT
Sub Main()
DBWInit(True)
sqlCommand = DBWInput("@SQLCMD")
If InStr(sqlCommand, "INSERT INTO DOCUMENT") > 0 Then
If InStr(sqlCommand, "'J:\") > 0 Then
'DBWMsgBox sqlCommand
sqlCommand = Replace(sqlCommand, "'J:\", "'S:\")
'DBWMsgBox sqlCommand
End If
If InStr(sqlCommand, "'N:\") > 0 Then
'DBWMsgBox sqlCommand
sqlCommand = Replace(sqlCommand, "'N:\", "'W:\")
'DBWMsgBox sqlCommand
End If
ElseIf InStr(sqlCommand, "UPDATE DOCUMENT SET") > 0 Then
If InStr(sqlCommand, "FILE_DIRECTORY='J:\") > 0 Then
'DBWMsgBox sqlCommand
sqlCommand = Replace(sqlCommand, "FILE_DIRECTORY='J:\", "FILE_DIRECTORY='S:\")
'DBWMsgBox sqlCommand
End If
If InStr(sqlCommand, "FILE_DIRECTORY='N:\") > 0 Then
'DBWMsgBox sqlCommand
sqlCommand = Replace(sqlCommand, "FILE_DIRECTORY='N:\", "FILE_DIRECTORY='W:\")
'DBWMsgBox sqlCommand
End If
End If
'DBWMsgBox sqlCommand
DBWOutput "@SQLCMD", sqlCommand, ForWriting
End Sub