001: /*
002: Copyright (C) 2002-2007 MySQL AB
003:
004: This program is free software; you can redistribute it and/or modify
005: it under the terms of version 2 of the GNU General Public License as
006: published by the Free Software Foundation.
007:
008: There are special exceptions to the terms and conditions of the GPL
009: as it is applied to this software. View the full text of the
010: exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
011: software distribution.
012:
013: This program is distributed in the hope that it will be useful,
014: but WITHOUT ANY WARRANTY; without even the implied warranty of
015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: GNU General Public License for more details.
017:
018: You should have received a copy of the GNU General Public License
019: along with this program; if not, write to the Free Software
020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021:
022: */
023:
024: package com.mysql.jdbc;
025:
026: import java.io.InputStream;
027: import java.io.Reader;
028: import java.sql.Blob;
029: import java.sql.Clob;
030: import java.sql.SQLException;
031: import java.sql.RowId;
032: import java.sql.SQLXML;
033: import java.sql.NClob;
034:
035: import com.mysql.jdbc.exceptions.NotYetImplementedException;
036:
037: public class JDBC4CallableStatement extends CallableStatement {
038:
039: public JDBC4CallableStatement(ConnectionImpl conn,
040: CallableStatementParamInfo paramInfo) throws SQLException {
041: super (conn, paramInfo);
042: }
043:
044: public JDBC4CallableStatement(ConnectionImpl conn, String sql,
045: String catalog, boolean isFunctionCall) throws SQLException {
046: super (conn, sql, catalog, isFunctionCall);
047: }
048:
049: public void setRowId(String parameterName, RowId x)
050: throws SQLException {
051: JDBC4PreparedStatementHelper.setRowId(this , getNamedParamIndex(
052: parameterName, false), x);
053: }
054:
055: public void setSQLXML(String parameterName, SQLXML xmlObject)
056: throws SQLException {
057: JDBC4PreparedStatementHelper.setSQLXML(this ,
058: getNamedParamIndex(parameterName, false), xmlObject);
059:
060: }
061:
062: public SQLXML getSQLXML(int parameterIndex) throws SQLException {
063: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
064:
065: SQLXML retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
066: .getSQLXML(mapOutputParameterIndexToRsIndex(parameterIndex));
067:
068: this .outputParamWasNull = rs.wasNull();
069:
070: return retValue;
071:
072: }
073:
074: public SQLXML getSQLXML(String parameterName) throws SQLException {
075: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
076: // from ?=
077:
078: SQLXML retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
079: .getSQLXML(fixParameterName(parameterName));
080:
081: this .outputParamWasNull = rs.wasNull();
082:
083: return retValue;
084: }
085:
086: public RowId getRowId(int parameterIndex) throws SQLException {
087: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
088:
089: RowId retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
090: .getRowId(mapOutputParameterIndexToRsIndex(parameterIndex));
091:
092: this .outputParamWasNull = rs.wasNull();
093:
094: return retValue;
095: }
096:
097: public RowId getRowId(String parameterName) throws SQLException {
098: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
099: // from ?=
100:
101: RowId retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
102: .getRowId(fixParameterName(parameterName));
103:
104: this .outputParamWasNull = rs.wasNull();
105:
106: return retValue;
107: }
108:
109: public void setNClob(String parameterName, NClob value)
110: throws SQLException {
111: JDBC4PreparedStatementHelper.setNClob(this , getNamedParamIndex(
112: parameterName, false), value);
113:
114: }
115:
116: public void setNClob(String parameterName, Reader reader)
117: throws SQLException {
118: setNClob(getNamedParamIndex(parameterName, false), reader);
119:
120: }
121:
122: public void setNClob(String parameterName, Reader reader,
123: long length) throws SQLException {
124: setNClob(getNamedParamIndex(parameterName, false), reader,
125: length);
126:
127: }
128:
129: public void setNString(String parameterName, String value)
130: throws SQLException {
131: setNString(getNamedParamIndex(parameterName, false), value);
132: }
133:
134: public boolean isWrapperFor(Class arg0) throws SQLException {
135: throw new NotYetImplementedException();
136:
137: }
138:
139: public Object unwrap(Class arg0) throws SQLException {
140: throw new NotYetImplementedException();
141:
142: }
143:
144: /**
145: * @see java.sql.CallableStatement#getCharacterStream(int)
146: */
147: public Reader getCharacterStream(int parameterIndex)
148: throws SQLException {
149: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
150:
151: Reader retValue = rs
152: .getCharacterStream(mapOutputParameterIndexToRsIndex(parameterIndex));
153:
154: this .outputParamWasNull = rs.wasNull();
155:
156: return retValue;
157: }
158:
159: /**
160: * @see java.sql.CallableStatement#getCharacterStream(java.lang.String)
161: */
162: public Reader getCharacterStream(String parameterName)
163: throws SQLException {
164: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
165: // from ?=
166:
167: Reader retValue = rs
168: .getCharacterStream(fixParameterName(parameterName));
169:
170: this .outputParamWasNull = rs.wasNull();
171:
172: return retValue;
173: }
174:
175: /**
176: * @see java.sql.CallableStatement#getNCharacterStream(int)
177: */
178: public Reader getNCharacterStream(int parameterIndex)
179: throws SQLException {
180: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
181:
182: Reader retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
183: .getNCharacterStream(mapOutputParameterIndexToRsIndex(parameterIndex));
184:
185: this .outputParamWasNull = rs.wasNull();
186:
187: return retValue;
188: }
189:
190: /**
191: * @see java.sql.CallableStatement#getNCharacterStream(java.lang.String)
192: */
193: public Reader getNCharacterStream(String parameterName)
194: throws SQLException {
195: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
196: // from ?=
197:
198: Reader retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
199: .getNCharacterStream(fixParameterName(parameterName));
200:
201: this .outputParamWasNull = rs.wasNull();
202:
203: return retValue;
204: }
205:
206: /**
207: * @see java.sql.CallableStatement#getNClob(int)
208: */
209: public NClob getNClob(int parameterIndex) throws SQLException {
210: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
211:
212: NClob retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
213: .getNClob(mapOutputParameterIndexToRsIndex(parameterIndex));
214:
215: this .outputParamWasNull = rs.wasNull();
216:
217: return retValue;
218: }
219:
220: /**
221: * @see java.sql.CallableStatement#getNClob(java.lang.String)
222: */
223: public NClob getNClob(String parameterName) throws SQLException {
224: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
225: // from ?=
226:
227: NClob retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
228: .getNClob(fixParameterName(parameterName));
229:
230: this .outputParamWasNull = rs.wasNull();
231:
232: return retValue;
233: }
234:
235: /**
236: * @see java.sql.CallableStatement#getNString(int)
237: */
238: public String getNString(int parameterIndex) throws SQLException {
239: ResultSetInternalMethods rs = getOutputParameters(parameterIndex);
240:
241: String retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
242: .getNString(mapOutputParameterIndexToRsIndex(parameterIndex));
243:
244: this .outputParamWasNull = rs.wasNull();
245:
246: return retValue;
247: }
248:
249: /**
250: * @see java.sql.CallableStatement#getNString(java.lang.String)
251: */
252: public String getNString(String parameterName) throws SQLException {
253: ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be
254: // from ?=
255:
256: String retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
257: .getNString(fixParameterName(parameterName));
258:
259: this.outputParamWasNull = rs.wasNull();
260:
261: return retValue;
262: }
263: }
|