1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.sql;
20
21 import net.sf.jameleon.ParamTag;
22
23 import org.apache.commons.jelly.MissingAttributeException;
24 import org.apache.commons.jelly.JellyTagException;
25
26 /***
27 * Used to set binding parameter to the parent sql-update tag.
28 *
29 * An example might be:
30 * <pre><source>
31 * <sql-update
32 * functionId="Insert a row into test table via a prepared statement with multiple param values"
33 * sqlUpdateSql="insert into test(test_str, test_str2) values(?,?)"/>
34 * <sql-param>
35 * <sql-param-value>text2>/sql-param-value>
36 * <sql-param-value>text3>/sql-param-value>
37 * </sql-param>
38 * </sql-update>
39 * </source></pre>
40 *
41 * @jameleon.function name="sql-param"
42 */
43 public class SqlParamTag extends ParamTag {
44
45 /***
46 * Used to validate everything is set up correctly.
47 * @throws MissingAttributeException - When a required attribute isn't set.
48 * @throws JellyTagException - When this tag is used out of context.
49 */
50 protected void validate()throws MissingAttributeException, JellyTagException{
51 if (values == null || values.size() < 1){
52 throw new MissingAttributeException("sql-param-value is a required tag!");
53 }
54 }
55
56 }