com.ptc.windchill.upgrade.util
Class SQLScriptExecutor

java.lang.Object
  extended bywt.dataservice.SQLScriptExecutor
      extended bycom.ptc.windchill.upgrade.util.SQLScriptExecutor

public class SQLScriptExecutor
extends SQLScriptExecutor

Used to execute general SQL strings or to SQL Script files, but the result is a long string equal to "as seen on a console". It buffers a working version of the command in a wt.temp file. The execution is by SQLplus.


Nested Class Summary
 
Nested classes inherited from class wt.dataservice.SQLScriptExecutor
SQLScriptExecutor.ExecutionException
 
Field Summary
private  boolean inactivityTimeoutIsNumericInput_
           
private  String inactivityTimeoutString_
           
private  boolean overallTimeoutIsNumericInput_
           
private  String overallTimeoutString_
           
 
Fields inherited from class wt.dataservice.SQLScriptExecutor
 
Constructor Summary
SQLScriptExecutor(String overall_time_out_string)
          Uses an Overall Timeout arguement to execute a SQL String or SQL Script file.
SQLScriptExecutor(String inactivity_time_out_string, String overall_time_out_string)
          Uses timeout arguements to execute a SQL String or SQL Script file.
 
Method Summary
protected  String execute(String sql_to_execute, PrintStream print_stream)
          Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.
private  String getDataServiceProperty(String prop_name, String default_value)
           
private  long getDataServicePropertyAsLong(String prop_name, String default_value)
           
 
Methods inherited from class wt.dataservice.SQLScriptExecutor
executeScript, executeScript, executeScript, executeSQL, getInactivityTimeOut, getOverallTimeOut, main, setConfigureConnectionFromPropertyFiles, setConnectString, setInactivityTimeout, setOverallTimeout, setPassword, setUserName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

overallTimeoutString_

private String overallTimeoutString_

inactivityTimeoutString_

private String inactivityTimeoutString_

overallTimeoutIsNumericInput_

private boolean overallTimeoutIsNumericInput_

inactivityTimeoutIsNumericInput_

private boolean inactivityTimeoutIsNumericInput_
Constructor Detail

SQLScriptExecutor

public SQLScriptExecutor(String overall_time_out_string)
Uses an Overall Timeout arguement to execute a SQL String or SQL Script file.

Parameters:
overall_time_out_string - A number (msec) or an alpha-num key from a db.properties key=value pair.

SQLScriptExecutor

public SQLScriptExecutor(String inactivity_time_out_string,
                         String overall_time_out_string)
Uses timeout arguements to execute a SQL String or SQL Script file.

Parameters:
inactivity_time_out_string - A number (msec) or an alpha-num key from a db.properties key=value pair.
overall_time_out_string - A number (msec) or an alpha-num key from a db.properties key=value pair.
Method Detail

execute

protected String execute(String sql_to_execute,
                         PrintStream print_stream)
                  throws SQLScriptExecutor.ExecutionException
Description copied from class: SQLScriptExecutor
Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.

This is the single point where all script execution is performed. Subtypes may override this to extend execution behavior.

Overrides:
execute in class SQLScriptExecutor
Parameters:
sql_to_execute - This is the SQL that is buffered into a file.
print_stream - Used to start reading large outputs, even before execution has completed.
Returns:
The script's output, which will always be non-null, but will be blank if print_stream is null.
Throws:
SQLScriptExecutor.ExecutionException - If the SQL could not be executed. If there's a timeout, then getNestedThrowable() will be an instanceof wt.util.ProcessLauncher.TimeoutException

getDataServicePropertyAsLong

private long getDataServicePropertyAsLong(String prop_name,
                                          String default_value)
                                   throws SQLScriptExecutor.ExecutionException
Throws:
SQLScriptExecutor.ExecutionException

getDataServiceProperty

private String getDataServiceProperty(String prop_name,
                                      String default_value)
                               throws SQLScriptExecutor.ExecutionException
Throws:
SQLScriptExecutor.ExecutionException