001/*
002 * Copyright 2002-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.jdbc.core;
018
019import java.sql.ResultSet;
020
021/**
022 * Subclass of {@link SqlOutParameter} to represent an INOUT parameter.
023 * Will return {@code true} for SqlParameter's {@link #isInputValueProvided}
024 * test, in contrast to a standard SqlOutParameter.
025 *
026 * <p>Output parameters - like all stored procedure parameters - must have names.
027 *
028 * @author Thomas Risberg
029 * @author Juergen Hoeller
030 * @since 2.0
031 */
032public class SqlInOutParameter extends SqlOutParameter {
033
034        /**
035         * Create a new SqlInOutParameter.
036         * @param name the name of the parameter, as used in input and output maps
037         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
038         */
039        public SqlInOutParameter(String name, int sqlType) {
040                super(name, sqlType);
041        }
042
043        /**
044         * Create a new SqlInOutParameter.
045         * @param name the name of the parameter, as used in input and output maps
046         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
047         * @param scale the number of digits after the decimal point
048         * (for DECIMAL and NUMERIC types)
049         */
050        public SqlInOutParameter(String name, int sqlType, int scale) {
051                super(name, sqlType, scale);
052        }
053
054        /**
055         * Create a new SqlInOutParameter.
056         * @param name the name of the parameter, as used in input and output maps
057         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
058         * @param typeName the type name of the parameter (optional)
059         */
060        public SqlInOutParameter(String name, int sqlType, String typeName) {
061                super(name, sqlType, typeName);
062        }
063
064        /**
065         * Create a new SqlInOutParameter.
066         * @param name the name of the parameter, as used in input and output maps
067         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
068         * @param typeName the type name of the parameter (optional)
069         * @param sqlReturnType custom value handler for complex type (optional)
070         */
071        public SqlInOutParameter(String name, int sqlType, String typeName, SqlReturnType sqlReturnType) {
072                super(name, sqlType, typeName, sqlReturnType);
073        }
074
075        /**
076         * Create a new SqlInOutParameter.
077         * @param name the name of the parameter, as used in input and output maps
078         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
079         * @param rse the {@link ResultSetExtractor} to use for parsing the {@link ResultSet}
080         */
081        public SqlInOutParameter(String name, int sqlType, ResultSetExtractor<?> rse) {
082                super(name, sqlType, rse);
083        }
084
085        /**
086         * Create a new SqlInOutParameter.
087         * @param name the name of the parameter, as used in input and output maps
088         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
089         * @param rch the {@link RowCallbackHandler} to use for parsing the {@link ResultSet}
090         */
091        public SqlInOutParameter(String name, int sqlType, RowCallbackHandler rch) {
092                super(name, sqlType, rch);
093        }
094
095        /**
096         * Create a new SqlInOutParameter.
097         * @param name the name of the parameter, as used in input and output maps
098         * @param sqlType the parameter SQL type according to {@code java.sql.Types}
099         * @param rm the {@link RowMapper} to use for parsing the {@link ResultSet}
100         */
101        public SqlInOutParameter(String name, int sqlType, RowMapper<?> rm) {
102                super(name, sqlType, rm);
103        }
104
105
106        /**
107         * This implementation always returns {@code true}.
108         */
109        @Override
110        public boolean isInputValueProvided() {
111                return true;
112        }
113
114}