001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.jca.jdbc;
023:
024: import java.sql.Connection;
025: import java.sql.ResultSet;
026: import java.sql.SQLException;
027: import java.sql.SQLWarning;
028: import java.sql.Statement;
029:
030: /**
031: * TestStatement.java
032: *
033: *
034: * Created: Sat Apr 20 14:29:19 2002
035: *
036: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
037: * @version
038: */
039:
040: public class TestStatement implements Statement {
041: private final TestDriver driver;
042:
043: int queryTimeout = 0;
044:
045: public TestStatement(final TestDriver driver) {
046: this .driver = driver;
047: }
048:
049: // implementation of java.sql.Statement interface
050:
051: /**
052: *
053: * @exception java.sql.SQLException <description>
054: */
055: public void close() throws SQLException {
056: }
057:
058: /**
059: *
060: * @param param1 <description>
061: * @return <description>
062: * @exception java.sql.SQLException <description>
063: */
064: public boolean execute(String sql) throws SQLException {
065: if (driver.getFail()) {
066: throw new SQLException("asked to fail");
067: } // end of if ()
068: return false;
069:
070: }
071:
072: /**
073: *
074: * @param param1 <description>
075: * @param param2 <description>
076: * @return <description>
077: * @exception java.sql.SQLException <description>
078: */
079: public boolean execute(String sql, int autoGeneratedKeys)
080: throws SQLException {
081: return execute(sql);
082: }
083:
084: /**
085: *
086: * @param param1 <description>
087: * @param param2 <description>
088: * @return <description>
089: * @exception java.sql.SQLException <description>
090: */
091: public boolean execute(String sql, int[] columnIndexes)
092: throws SQLException {
093: return execute(sql);
094: }
095:
096: /**
097: *
098: * @param param1 <description>
099: * @param param2 <description>
100: * @return <description>
101: * @exception java.sql.SQLException <description>
102: */
103: public boolean execute(String sql, String[] columnNames)
104: throws SQLException {
105: return execute(sql);
106: }
107:
108: /**
109: *
110: * @return <description>
111: * @exception java.sql.SQLException <description>
112: */
113: public Connection getConnection() throws SQLException {
114: return null;
115: }
116:
117: /**
118: *
119: * @return <description>
120: * @exception java.sql.SQLException <description>
121: */
122: public SQLWarning getWarnings() throws SQLException {
123: return null;
124: }
125:
126: /**
127: *
128: * @exception java.sql.SQLException <description>
129: */
130: public void clearWarnings() throws SQLException {
131: }
132:
133: /**
134: *
135: * @param param1 <description>
136: * @return <description>
137: * @exception java.sql.SQLException <description>
138: */
139: public ResultSet executeQuery(String sql) throws SQLException {
140: execute(sql);
141: return null;
142: }
143:
144: /**
145: *
146: * @param param1 <description>
147: * @return <description>
148: * @exception java.sql.SQLException <description>
149: */
150: public int executeUpdate(String sql) throws SQLException {
151: execute(sql);
152: return 0;
153: }
154:
155: /**
156: *
157: * @param param1 <description>
158: * @param param2 <description>
159: * @return <description>
160: * @exception java.sql.SQLException <description>
161: */
162: public int executeUpdate(String sql, int autoGeneratedKeys)
163: throws SQLException {
164: return executeUpdate(sql);
165: }
166:
167: /**
168: *
169: * @param param1 <description>
170: * @param param2 <description>
171: * @return <description>
172: * @exception java.sql.SQLException <description>
173: */
174: public int executeUpdate(String sql, int[] columnIndexes)
175: throws SQLException {
176: return executeUpdate(sql);
177: }
178:
179: /**
180: *
181: * @param param1 <description>
182: * @param param2 <description>
183: * @return <description>
184: * @exception java.sql.SQLException <description>
185: */
186: public int executeUpdate(String sql, String[] columnNames)
187: throws SQLException {
188: return executeUpdate(sql);
189: }
190:
191: /**
192: *
193: * @return <description>
194: * @exception java.sql.SQLException <description>
195: */
196: public int getMaxFieldSize() throws SQLException {
197: return 0;
198: }
199:
200: /**
201: *
202: * @param param1 <description>
203: * @exception java.sql.SQLException <description>
204: */
205: public void setMaxFieldSize(int max) throws SQLException {
206: }
207:
208: /**
209: *
210: * @return <description>
211: * @exception java.sql.SQLException <description>
212: */
213: public int getMaxRows() throws SQLException {
214: return 0;
215: }
216:
217: /**
218: *
219: * @param param1 <description>
220: * @exception java.sql.SQLException <description>
221: */
222: public void setMaxRows(int max) throws SQLException {
223: }
224:
225: /**
226: *
227: * @param param1 <description>
228: * @exception java.sql.SQLException <description>
229: */
230: public void setEscapeProcessing(boolean enable) throws SQLException {
231: }
232:
233: /**
234: *
235: * @return <description>
236: * @exception java.sql.SQLException <description>
237: */
238: public int getQueryTimeout() throws SQLException {
239: return queryTimeout;
240: }
241:
242: /**
243: *
244: * @param param1 <description>
245: * @exception java.sql.SQLException <description>
246: */
247: public void setQueryTimeout(int timeout) throws SQLException {
248: this .queryTimeout = timeout;
249: }
250:
251: /**
252: *
253: * @exception java.sql.SQLException <description>
254: */
255: public void cancel() throws SQLException {
256: }
257:
258: /**
259: *
260: * @param param1 <description>
261: * @exception java.sql.SQLException <description>
262: */
263: public void setCursorName(String name) throws SQLException {
264: }
265:
266: /**
267: *
268: * @return <description>
269: * @exception java.sql.SQLException <description>
270: */
271: public ResultSet getResultSet() throws SQLException {
272: return null;
273: }
274:
275: /**
276: *
277: * @return <description>
278: * @exception java.sql.SQLException <description>
279: */
280: public int getUpdateCount() throws SQLException {
281: return 0;
282: }
283:
284: /**
285: *
286: * @return <description>
287: * @exception java.sql.SQLException <description>
288: */
289: public boolean getMoreResults() throws SQLException {
290: return false;
291: }
292:
293: /**
294: *
295: * @param param1 <description>
296: * @return <description>
297: * @exception java.sql.SQLException <description>
298: */
299: public boolean getMoreResults(int current) throws SQLException {
300: return false;
301: }
302:
303: /**
304: *
305: * @param param1 <description>
306: * @exception java.sql.SQLException <description>
307: */
308: public void setFetchDirection(int direction) throws SQLException {
309: }
310:
311: /**
312: *
313: * @return <description>
314: * @exception java.sql.SQLException <description>
315: */
316: public int getFetchDirection() throws SQLException {
317: return 0;
318: }
319:
320: /**
321: *
322: * @param param1 <description>
323: * @exception java.sql.SQLException <description>
324: */
325: public void setFetchSize(int rows) throws SQLException {
326: }
327:
328: /**
329: *
330: * @return <description>
331: * @exception java.sql.SQLException <description>
332: */
333: public int getFetchSize() throws SQLException {
334: return 0;
335: }
336:
337: /**
338: *
339: * @return <description>
340: * @exception java.sql.SQLException <description>
341: */
342: public int getResultSetConcurrency() throws SQLException {
343: return 0;
344: }
345:
346: /**
347: *
348: * @return <description>
349: * @exception java.sql.SQLException <description>
350: */
351: public int getResultSetType() throws SQLException {
352: return 0;
353: }
354:
355: /**
356: *
357: * @param param1 <description>
358: * @exception java.sql.SQLException <description>
359: */
360: public void addBatch(String sql) throws SQLException {
361: }
362:
363: /**
364: *
365: * @exception java.sql.SQLException <description>
366: */
367: public void clearBatch() throws SQLException {
368: }
369:
370: /**
371: *
372: * @return <description>
373: * @exception java.sql.SQLException <description>
374: */
375: public int[] executeBatch() throws SQLException {
376: return null;
377: }
378:
379: /**
380: *
381: * @return <description>
382: * @exception java.sql.SQLException <description>
383: */
384: public ResultSet getGeneratedKeys() throws SQLException {
385: return null;
386: }
387:
388: /**
389: *
390: * @return <description>
391: * @exception java.sql.SQLException <description>
392: */
393: public int getResultSetHoldability() throws SQLException {
394: return 0;
395: }
396:
397: }// LocalStatement
|