1 /* 2 * Copyright 1999-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package javax.servlet.jsp.jstl.sql; 18 19 /** 20 * <p>This interface allows tag handlers implementing it to receive 21 * values for parameter markers in their SQL statements.</p> 22 * 23 * <p>This interface is implemented by both <sql:query> and 24 * <sql:update>. Its <code>addSQLParameter()</code> method 25 * is called by nested parameter actions (such as <sql:param>) 26 * to substitute <code>PreparedStatement</code> parameter values for 27 * "?" parameter markers in the SQL statement of the enclosing 28 * <code>SQLExecutionTag</code> action.</p> 29 * 30 * <p>The given parameter values are converted to their corresponding 31 * SQL type (following the rules in the JDBC specification) before 32 * they are sent to the database.</p> 33 * 34 * <p>Keeping track of the index of the parameter values being added 35 * is the responsibility of the tag handler implementing this 36 * interface</p> 37 * 38 * <p>The <code>SQLExcecutionTag</code> interface is exposed in order 39 * to support custom parameter actions which may retrieve their 40 * parameters from any source and process them before substituting 41 * them for a parameter marker in the SQL statement of the 42 * enclosing <code>SQLExecutionTag</code> action</p> 43 * 44 * @author Justyna Horwat 45 */ 46 public interface SQLExecutionTag { 47 48 /** 49 * Adds a PreparedStatement parameter value. 50 * Must behave as if it calls <code>PreparedStatement.setObject(int, Object)</code>. 51 * For each tag invocation, the integral index passed logically to <code>setObject()</code> 52 * must begin with 1 and must be incremented by 1 for each subsequent invocation 53 * of <code>addSQLParameter()</code>. The Object logically passed to <code>setObject()</code> must be the 54 * unmodified object received in the value argument. 55 * 56 * @param value the <code>PreparedStatement</code> parameter value 57 */ 58 public void addSQLParameter(Object value); 59 } 60