1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * Portions Copyright Apache Software Foundation.
7 *
8 * The contents of this file are subject to the terms of either the GNU
9 * General Public License Version 2 only ("GPL") or the Common Development
10 * and Distribution License("CDDL") (collectively, the "License"). You
11 * may not use this file except in compliance with the License. You can obtain
12 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
13 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
14 * language governing permissions and limitations under the License.
15 *
16 * When distributing the software, include this License Header Notice in each
17 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
18 * Sun designates this particular file as subject to the "Classpath" exception
19 * as provided by Sun in the GPL Version 2 section of the License file that
20 * accompanied this code. If applicable, add the following below the License
21 * Header, with the fields enclosed by brackets [] replaced by your own
22 * identifying information: "Portions Copyrighted [year]
23 * [name of copyright owner]"
24 *
25 * Contributor(s):
26 *
27 * If you wish your version of this file to be governed by only the CDDL or
28 * only the GPL Version 2, indicate your decision by adding "[Contributor]
29 * elects to include this software in this distribution under the [CDDL or GPL
30 * Version 2] license." If you don't indicate a single choice of license, a
31 * recipient has the option to distribute your version of this file under
32 * either the CDDL, the GPL Version 2 or to extend the choice of license to
33 * its licensees as provided above. However, if you add GPL Version 2 code
34 * and therefore, elected the GPL Version 2 license, then the option applies
35 * only if the new code is made subject to such option by the copyright
36 * holder.
37 */
38
39 package javax.servlet.jsp.jstl.sql;
40
41 /**
42 * <p>This interface allows tag handlers implementing it to receive
43 * values for parameter markers in their SQL statements.</p>
44 *
45 * <p>This interface is implemented by both <sql:query> and
46 * <sql:update>. Its <code>addSQLParameter()</code> method
47 * is called by nested parameter actions (such as <sql:param>)
48 * to substitute <code>PreparedStatement</code> parameter values for
49 * "?" parameter markers in the SQL statement of the enclosing
50 * <code>SQLExecutionTag</code> action.</p>
51 *
52 * <p>The given parameter values are converted to their corresponding
53 * SQL type (following the rules in the JDBC specification) before
54 * they are sent to the database.</p>
55 *
56 * <p>Keeping track of the index of the parameter values being added
57 * is the responsibility of the tag handler implementing this
58 * interface</p>
59 *
60 * <p>The <code>SQLExcecutionTag</code> interface is exposed in order
61 * to support custom parameter actions which may retrieve their
62 * parameters from any source and process them before substituting
63 * them for a parameter marker in the SQL statement of the
64 * enclosing <code>SQLExecutionTag</code> action</p>
65 *
66 * @author Justyna Horwat
67 */
68 public interface SQLExecutionTag {
69
70 /**
71 * Adds a PreparedStatement parameter value.
72 * Must behave as if it calls <code>PreparedStatement.setObject(int, Object)</code>.
73 * For each tag invocation, the integral index passed logically to <code>setObject()</code>
74 * must begin with 1 and must be incremented by 1 for each subsequent invocation
75 * of <code>addSQLParameter()</code>. The Object logically passed to <code>setObject()</code> must be the
76 * unmodified object received in the value argument.
77 *
78 * @param value the <code>PreparedStatement</code> parameter value
79 */
80 public void addSQLParameter(Object value);
81 }