net.sf.jameleon.sql
Class SqlUpdateTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jameleon.LocationAwareTagSupport
          extended by net.sf.jameleon.JameleonTagSupport
              extended by net.sf.jameleon.function.FunctionTag
                  extended by net.sf.jameleon.sql.AbstractSqlTag
                      extended by net.sf.jameleon.sql.SqlUpdateTag
All Implemented Interfaces:
BreakPoint, Attributable, Storable, DynaTag, LocationAware, Tag

public class SqlUpdateTag
extends AbstractSqlTag

Runs a delete or update SQL statement against the database. Sometimes putting an application into a required state means connecting to a database and executing a SQL statment. This can be done with this tag. The SQL can be an insert, delete or update command. The body of this element should contain the SQL statement used. See the function tag docs for information on other attributes supported and/or required by this tag. An example might be:


 <junit-session xmlns:j="jelly:core">
   <sql-update 
       functionId="Insert another row into test table"
       jdbcDriver="org.hsqldb.jdbcDriver"
       jdbcUrl="jdbc:hsqldb:tst/_tmp/jameleon_test2"
       jdbcUsername="sa"
       jdbcPassword="">
       create cached table test2(
         test_str varchar,
         test_str2 varchar
      );
   </sql-update>
   <sql-update 
       functionId="Delete row from test table"
       jdbcDriver="org.hsqldb.jdbcDriver"
       jdbcUrl="jdbc:hsqldb:tst/_tmp/jameleon_test2"
       jdbcUsername="sa"
       jdbcPassword="">
       delete from test2 where test_str='some text';
       -- some SQL comment
       -- Another SQL comment
   </sql-update>
 </junit-session>
 

Tag Name: <sql-update> Type: action
Steps:
  1. Connect to the database for the the correct environment
  2. execute the provided sql statement.

Field Summary
 
Fields inherited from class net.sf.jameleon.sql.AbstractSqlTag
jdbcDriver, jdbcPassword, jdbcUrl, jdbcUsername, sqlVarName
 
Fields inherited from class net.sf.jameleon.function.FunctionTag
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, vpt
 
Fields inherited from class net.sf.jameleon.JameleonTagSupport
attributes, broker, contextVars, fp, unsupportedAttributes
 
Fields inherited from class net.sf.jameleon.LocationAwareTagSupport
columnNumber, elementTagName, lineNumber, scriptFileName
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
SqlUpdateTag()
           
 
Method Summary
protected  void executeSql(Connection conn, String sql)
           
 void setSqlUpdateSql(String sqlUpdateSql)
           
 
Methods inherited from class net.sf.jameleon.sql.AbstractSqlTag
destroy, getConnection, getSql, init, testBlock, validate
 
Methods inherited from class net.sf.jameleon.function.FunctionTag
addParam, addRequiredAttribute, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertFalse, assertFalse, assertMethod, assertMethodWithLevel, assertNotNull, assertNotNull, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNotSame, assertNotSame, assertNull, assertNull, assertNull, assertNull, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertSame, assertSame, assertSame, assertSame, assertTextContains, assertTextContains, assertTextContains, assertTextContains, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTrue, assertTrue, assertTrue, assertTrue, checkParamTypes, cleanUp, cleanUpEnvironment, delay, delay, doTag, fail, fail, fail, fail, getFunctionId, getFunctionResults, getMatchingRegexText, getParam, getParamLength, getParams, getParentTags, getSessionTag, getStoreToFileName, getStringOrDefault, getTestCaseTag, getVariable, getVariableAsBoolean, getVariableAsList, getVariableAsString, isBreakPoint, isContextVariableNull, pluginTearDown, recordFunctionResult, regexMatches, removeFunctionResult, removeVariable, setDefaultVariableValue, setDefaultVariableValue, setExpectException, setExpectFailure, setFunctionDelay, setFunctionId, setup, setupEnvironment, setUpFunctionResults, setVariable, store, tearDown, traceMsg
 
Methods inherited from class net.sf.jameleon.JameleonTagSupport
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught
 
Methods inherited from class net.sf.jameleon.LocationAwareTagSupport
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Constructor Detail

SqlUpdateTag

public SqlUpdateTag()
Method Detail

executeSql

protected void executeSql(Connection conn,
                          String sql)
                   throws SQLException
Specified by:
executeSql in class AbstractSqlTag
Throws:
SQLException

setSqlUpdateSql

public void setSqlUpdateSql(String sqlUpdateSql)
This attribute is recognized by Jameleon
Required: false


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.