com.ptc.windchill.upgrade.directives
Class SqlDirective

java.lang.Object
  extended bycom.ptc.windchill.upgrade.directives.SqlDirective
All Implemented Interfaces:
UpdateDirective

public class SqlDirective
extends Object
implements UpdateDirective

Applies the contained text as SQL. Only update statements are supported.

Format

    >SqlDirective<
       SQL statement
    >/SqlDirective<
 
Component Description Required Parameterizable
text() The SQL statement yes yes, all macros


Field Summary
private  ParameterizedString sql_
           
 
Constructor Summary
SqlDirective()
          Create an instance.
 
Method Summary
 void asDomOn(Element element)
          Writes the directive as a DOM element according to the class documentation above.
 void execute(DirectiveServices directive_services)
          Parameterizes the SQL statement to the current ParameterizedStringScope if necessary and executes it.
 void initializeFromDom(Element element)
          Reads the DOM element into this directive according to the class documentation above.
 void setSql(String sql)
          Sets the SQL statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sql_

private ParameterizedString sql_
Constructor Detail

SqlDirective

public SqlDirective()
Create an instance.

Method Detail

setSql

public void setSql(String sql)
            throws ParseException
Sets the SQL statement. The statement can be parameterized to class info. If this is done, the directive needs to be placed inside a directive that provides parameterization information such as ForEachConcreteImplementorOf.

Throws:
ParseException - if the SQL contains a parameterization as allowed in ParameterizedStrings, but it is syntactically incorrect or utilizes a macro incorrectly
See Also:
ForEachConcreteImplementorOf

asDomOn

public void asDomOn(Element element)
Writes the directive as a DOM element according to the class documentation above.

Specified by:
asDomOn in interface UpdateDirective

initializeFromDom

public void initializeFromDom(Element element)
                       throws DirectiveIOException
Reads the DOM element into this directive according to the class documentation above.

Specified by:
initializeFromDom in interface UpdateDirective
Throws:
DirectiveIOException - if there are syntax errors in parameterization of the statement

execute

public void execute(DirectiveServices directive_services)
             throws DirectiveExecutionException
Parameterizes the SQL statement to the current ParameterizedStringScope if necessary and executes it.

Specified by:
execute in interface UpdateDirective
Throws:
DirectiveExecutionException - if there are parameterization syntax erros, if the connection cannot be acquired, or if there is a SQLException