Project Report: fawkez

Packagesummary org.jcoderz.commons.util

org.jcoderz.commons.util.DbUtil

LineHitsNoteSource
1  /*
2   * $Id: DbUtil.java 1566 2009-11-01 16:11:16Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33 (1)package org.jcoderz.commons.util;
34  
35  import java.io.InputStream;
36  import java.io.Reader;
37  import java.io.StringReader;
38  import java.math.BigDecimal;
39  import java.net.URL;
40  import java.sql.Array;
41  import java.sql.Blob;
42  import java.sql.Clob;
43  import java.sql.Connection;
44  import java.sql.Date;
45  import java.sql.Driver;
46  import java.sql.DriverManager;
47  import java.sql.ParameterMetaData;
48  import java.sql.PreparedStatement;
49  import java.sql.Ref;
50  import java.sql.ResultSet;
51  import java.sql.ResultSetMetaData;
52  import java.sql.SQLException;
53  import java.sql.SQLWarning;
54  import java.sql.Statement;
55  import java.sql.Time;
56  import java.sql.Timestamp;
57  import java.sql.Types;
58  import java.util.ArrayList;
59  import java.util.Calendar;
60  import java.util.Iterator;
61  import java.util.List;
62  import java.util.logging.Level;
63  import java.util.logging.Logger;
64  
65  /**
66   * Utility class for some DB routines.
67   *
68   * @author Albrecht Messner
69   */
70  public final class DbUtil
71  {
72     /** class name for use in logger */
7375    private static final String CLASSNAME = DbUtil.class.getName();
74  
75     /** logging facility */
76100    private static final Logger logger = Logger.getLogger(CLASSNAME);
77  
78     /** The oracle driver class for Oracle 8.x and 9.x */
79     private static final String ORACLE_DRIVER_CLASSNAME
80           = "oracle.jdbc.OracleDriver";
81     /**
82      * private constructor to avoid instantiation.
83      */
84     private DbUtil ()
850    {
86        // utility class -- no instances are allowed.
870    }
88  
89     /**
90      * Close a statement according to resource handling idiom.
91      * @param stmt the statement to be closed
92      */
93     public static void close (Statement stmt)
94     {
95100       if (stmt != null)
96        {
97           try
98           {
99100             stmt.close();
100           }
1010          catch (SQLException x)
102           {
1030             logger.log(Level.FINE, "Error during resource cleanup: "
104                    + "java.sql.Statement.close()", x);
105100          }
106        }
107100    }
108  
109     /**
110      * Close a DB connection according to resource handling idiom.
111      * @param con the connection to be closed
112      */
113     public static void close (Connection con)
114     {
115100       if (con != null)
116        {
117           try
118           {
119100             con.close();
120           }
1210          catch (SQLException x)
122           {
1230             logger.log(Level.FINE, "Error during resource cleanup: "
124                    + "java.sql.Connection.close()", x);
125100          }
126        }
127100    }
128  
129     /**
130      * Close a result set according to resource handling idiom.
131      * @param resultSet the result set to close
132      */
133     public static void close (ResultSet resultSet)
134     {
135100       if (resultSet != null)
136        {
137           try
138           {
139100             resultSet.close();
140           }
1410          catch (SQLException x)
142           {
1430             logger.log(Level.FINE, "Error during resource cleanup: "
144                    + "java.sql.ResultSet.close()", x);
145100          }
146        }
147100    }
148  
149     /**
150      * Sets a parameter in a PreparedStatement to either a value or null.
151      *
152      * @param pstmt the prepared statement
153      * @param paramIndex the parameter index of the parameter to be set
154      * @param value the value to which the parameter must be set
155      * @throws SQLException if a database access error occurs.
156      */
157     public static void setVarcharOrNull (
158           PreparedStatement pstmt, int paramIndex, String value)
159           throws SQLException
160     {
161100       setParameterOrNull(pstmt, paramIndex, value, Types.VARCHAR);
162100    }
163  
164     /**
165      * Sets a parameter in a PreparedStatement to either a value or null.
166      *
167      * @param pstmt the prepared statement
168      * @param paramIndex the parameter index of the parameter to be set
169      * @param value the value to which the parameter must be set
170      * @throws SQLException if a database access error occurs.
171      */
172     public static void setCharOrNull (
173           PreparedStatement pstmt, int paramIndex, String value)
174           throws SQLException
175     {
176100       setParameterOrNull(pstmt, paramIndex, value, Types.CHAR);
177100    }
178  
179     /**
180      * Sets a parameter in a PreparedStatement to either a value or null.
181      *
182      * @param pstmt the prepared statement
183      * @param paramIndex the parameter index of the parameter to be set
184      * @param value the value to which the parameter must be set
185      * @throws SQLException if a database access error occurs.
186      */
187     public static void setClobOrNull (
188           PreparedStatement pstmt, int paramIndex, String value)
189           throws SQLException
190     {
191100       setParameterOrNull(pstmt, paramIndex, value, Types.CLOB);
192100    }
193  
194     /**
195      * Sets a parameter in a PreparedStatement to either a value or null.
196      *
197      * @param pstmt the prepared statement
198      * @param paramIndex the parameter index of the parameter to be set
199      * @param value the value to which the parameter must be set
200      * @throws SQLException if a database access error occurs.
201      */
202     public static void setTimestampOrNull (
203           PreparedStatement pstmt, int paramIndex, Timestamp value)
204           throws SQLException
205     {
206100       setParameterOrNull(pstmt, paramIndex, value, Types.TIMESTAMP);
207100    }
208  
209     /**
210      * Sets a parameter in a PreparedStatement to either a value or null.
211      *
212      * @param pstmt the prepared statement
213      * @param paramIndex the parameter index of the parameter to be set
214      * @param value the value to which the parameter must be set
215      * @throws SQLException if a database access error occurs.
216      */
217     public static void setIntegerOrNull (
218           PreparedStatement pstmt, int paramIndex, Integer value)
219           throws SQLException
220     {
221100       setParameterOrNull(pstmt, paramIndex, value, Types.INTEGER);
222100    }
223  
224     /**
225      * Sets a parameter in a PreparedStatement to either a value or null.
226      *
227      * @param pstmt the prepared statement
228      * @param paramIndex the parameter index of the parameter to be set
229      * @param value the value to which the parameter must be set
230      * @throws SQLException if a database access error occurs.
231      */
232     public static void setLongOrNull (
233           PreparedStatement pstmt, int paramIndex, Long value)
234           throws SQLException
235     {
236        // Sorry, can't delegate this one to setParameterOrNull because
237        // it's got a different type than setIntegerOrNull, but the same
238        // SQL type code.
239100       if (value != null)
240        {
241100          pstmt.setLong(paramIndex, value.longValue());
242        }
243        else
244        {
245100          pstmt.setNull(paramIndex, Types.INTEGER);
246        }
247100    }
248  
249     /**
250      * Registers the oracle JDBC driver.
251      *
252      * NOTE: only use either in testcases that need a direct JDBC connection
253      * or in stand-alone applications, never in the Application Server.
254      */
255     public static void registerOracleDriver ()
256     {
257        try
258        {
2590          final Class driverClass
260                 = Class.forName(ORACLE_DRIVER_CLASSNAME);
2610          final Driver driverObject = (Driver) driverClass.newInstance();
2620          DriverManager.registerDriver(driverObject);
263        }
2640       catch (Exception e)
265        {
2660          final RuntimeException rte = new RuntimeException(
267                 "Failed to register oracle driver "
268                 + ORACLE_DRIVER_CLASSNAME, e);
2690          throw rte;
2700       }
2710    }
272  
273     /**
274      * This method wraps the {@link PreparedStatement} given as argument
275      * into a delegate object that calls the <code>executeBatch</code>
276      * method every <code>maxBatchSize</code>th time a batch is added to
277      * the statement with the <code>addBatch</code> method.
278      *
279      * @param pstmt the prepared statement to wrap
280      * @param maxBatchSize the maximum batch size at which an executeBatch
281      *       should be called
282      * @return a PreparedStatement implementation that does automatic
283      *       batch updates
284      */
285     public static PreparedStatement getLimitedBatchSizePreparedStatement (
286           PreparedStatement pstmt, int maxBatchSize)
287     {
2880(2)      return null; // new LimitedBatchSizePreparedStatement(pstmt, maxBatchSize);
289     }
290  
291     private static void setParameterOrNull (
292           PreparedStatement pstmt, int paramIndex, Object value, int type)
293           throws SQLException
294     {
295100       if (value != null)
296        {
297100          switch (type)
298           {
299              case Types.VARCHAR:
300              case Types.CHAR:
301100                pstmt.setString(paramIndex, (String) value);
302100                break;
303              case Types.CLOB:
304100                final String strVal = (String) value;
305100                pstmt.setCharacterStream(
306                       paramIndex, new StringReader(strVal), strVal.length());
307100                break;
308              case Types.TIMESTAMP:
309100                final Timestamp tstampVal = (Timestamp) value;
310100                pstmt.setTimestamp(paramIndex, tstampVal);
311100                break;
312              case Types.INTEGER:
313100                final Integer intVal = (Integer) value;
314100                pstmt.setInt(paramIndex, intVal.intValue());
315100                break;
316              default:
31750                throw new RuntimeException("Unexpected SQL type "
318                       + type + " encountered");
319           }
320        }
321        else
322        {
323100          pstmt.setNull(paramIndex, type);
324        }
325100    }
326  
327     private static final class LimitedBatchSizePreparedStatement
328 (3)// FIXME: does not work with JDK1.6.0     implements PreparedStatement
329     {
330        private final PreparedStatement mPreparedStatement;
331        private final int mMaxBatchSize;
3320       private final List mResultList = new ArrayList();
333  
3340       private int mBatchCount = 0;
335  
336        private LimitedBatchSizePreparedStatement
337              (PreparedStatement pstmt, int maxBatchSize)
3380       {
3390          mPreparedStatement = pstmt;
3400          mMaxBatchSize = maxBatchSize;
3410       }
342  
343        /** {@inheritDoc} */
344        public void addBatch ()
345              throws SQLException
346        {
3470          if (mBatchCount >= mMaxBatchSize)
348           {
3490             internalExecuteBatch();
350           }
3510          mPreparedStatement.addBatch();
3520          mBatchCount++;
3530       }
354  
355        /** {@inheritDoc} */
356        public void addBatch (String sql)
357              throws SQLException
358        {
3590          if (mBatchCount >= mMaxBatchSize)
360           {
3610             internalExecuteBatch();
362           }
3630          mPreparedStatement.addBatch(sql);
3640          mBatchCount++;
3650       }
366  
367        /** {@inheritDoc} */
368        public int[] executeBatch ()
369              throws SQLException
370        {
3710          internalExecuteBatch();
372  
3730          int totalBatchSize = 0;
3740          for (final Iterator it = mResultList.iterator(); it.hasNext(); )
375           {
3760             final int[] updateResult = (int[]) it.next();
3770             totalBatchSize += updateResult.length;
3780          }
379  
3800          final int[] result = new int[totalBatchSize];
3810          int offset = 0;
3820          for (final Iterator it = mResultList.iterator(); it.hasNext(); )
383           {
3840             final int[] updateResult = (int[]) it.next();
3850             System.arraycopy(
386                    updateResult, 0, result, offset, updateResult.length);
3870             offset += updateResult.length;
3880          }
3890          mResultList.clear();
3900          return result;
391        }
392  
393        /** {@inheritDoc} */
394        public void clearBatch ()
395              throws SQLException
396        {
3970          mPreparedStatement.clearBatch();
3980          mBatchCount = 0;
3990          mResultList.clear();
4000       }
401  
402        /** {@inheritDoc} */
403        public String toString ()
404        {
4050          return "[LimitedBatchSizePreparedStatement: mBatchSize="
406                 + mMaxBatchSize + ", mPreparedStatement="
407                 + mPreparedStatement + "]";
408        }
409  
410        private void internalExecuteBatch ()
411              throws SQLException
412        {
4130          mBatchCount = 0;
4140          final int[] result = mPreparedStatement.executeBatch();
4150          mResultList.add(result.clone());
4160       }
417  
418        // ==============================================================
419        // only delegates below this point
420        // ==============================================================
421  
422        /** {@inheritDoc} */
423        public void cancel ()
424              throws SQLException
425        {
4260          mPreparedStatement.cancel();
4270       }
428  
429        /** {@inheritDoc} */
430        public void clearParameters ()
431              throws SQLException
432        {
4330          mPreparedStatement.clearParameters();
4340       }
435  
436        /** {@inheritDoc} */
437        public void clearWarnings ()
438              throws SQLException
439        {
4400          mPreparedStatement.clearWarnings();
4410       }
442  
443        /** {@inheritDoc} */
444        public void close ()
445              throws SQLException
446        {
4470          mPreparedStatement.close();
4480       }
449  
450        /** {@inheritDoc} */
451        public boolean execute ()
452              throws SQLException
453        {
4540          return mPreparedStatement.execute();
455        }
456  
457        /** {@inheritDoc} */
458        public boolean execute (String sql)
459              throws SQLException
460        {
4610          return mPreparedStatement.execute(sql);
462        }
463  
464        /** {@inheritDoc} */
465        public boolean execute (String sql, int autoGeneratedKeys)
466              throws SQLException
467        {
4680          return mPreparedStatement.execute(sql, autoGeneratedKeys);
469        }
470  
471        /** {@inheritDoc} */
472        public boolean execute (String sql, int[] columnIndexes)
473              throws SQLException
474        {
4750          return mPreparedStatement.execute(sql, columnIndexes);
476        }
477  
478        /** {@inheritDoc} */
479        public boolean execute (String sql, String[] columnNames)
480              throws SQLException
481        {
4820          return mPreparedStatement.execute(sql, columnNames);
483        }
484  
485        /** {@inheritDoc} */
486        public ResultSet executeQuery ()
487              throws SQLException
488        {
4890          return mPreparedStatement.executeQuery();
490        }
491  
492        /** {@inheritDoc} */
493        public ResultSet executeQuery (String sql)
494              throws SQLException
495        {
4960          return mPreparedStatement.executeQuery(sql);
497        }
498  
499        /** {@inheritDoc} */
500        public int executeUpdate ()
501              throws SQLException
502        {
5030          return mPreparedStatement.executeUpdate();
504        }
505  
506        /** {@inheritDoc} */
507        public int executeUpdate (String sql)
508              throws SQLException
509        {
5100          return mPreparedStatement.executeUpdate(sql);
511        }
512  
513        /** {@inheritDoc} */
514        public int executeUpdate (String sql, int autoGeneratedKeys)
515              throws SQLException
516        {
5170          return mPreparedStatement.executeUpdate(sql, autoGeneratedKeys);
518        }
519  
520        /** {@inheritDoc} */
521        public int executeUpdate (String sql, int[] columnIndexes)
522              throws SQLException
523        {
5240          return mPreparedStatement.executeUpdate(sql, columnIndexes);
525        }
526  
527        /** {@inheritDoc} */
528        public int executeUpdate (String sql, String[] columnNames)
529              throws SQLException
530        {
5310          return mPreparedStatement.executeUpdate(sql, columnNames);
532        }
533  
534        /** {@inheritDoc} */
535        public Connection getConnection ()
536              throws SQLException
537        {
5380          return mPreparedStatement.getConnection();
539        }
540  
541        /** {@inheritDoc} */
542        public int getFetchDirection ()
543              throws SQLException
544        {
5450          return mPreparedStatement.getFetchDirection();
546        }
547  
548        /** {@inheritDoc} */
549        public int getFetchSize ()
550              throws SQLException
551        {
5520          return mPreparedStatement.getFetchSize();
553        }
554  
555        /** {@inheritDoc} */
556        public ResultSet getGeneratedKeys ()
557              throws SQLException
558        {
5590          return mPreparedStatement.getGeneratedKeys();
560        }
561  
562        /** {@inheritDoc} */
563        public int getMaxFieldSize ()
564              throws SQLException
565        {
5660          return mPreparedStatement.getMaxFieldSize();
567        }
568  
569        /** {@inheritDoc} */
570        public int getMaxRows ()
571              throws SQLException
572        {
5730          return mPreparedStatement.getMaxRows();
574        }
575  
576        /** {@inheritDoc} */
577        public ResultSetMetaData getMetaData ()
578              throws SQLException
579        {
5800          return mPreparedStatement.getMetaData();
581        }
582  
583        /** {@inheritDoc} */
584        public boolean getMoreResults ()
585              throws SQLException
586        {
5870          return mPreparedStatement.getMoreResults();
588        }
589  
590        /** {@inheritDoc} */
591        public boolean getMoreResults (int current)
592              throws SQLException
593        {
5940          return mPreparedStatement.getMoreResults(current);
595        }
596  
597        /** {@inheritDoc} */
598        public ParameterMetaData getParameterMetaData ()
599              throws SQLException
600        {
6010          return mPreparedStatement.getParameterMetaData();
602        }
603  
604        /** {@inheritDoc} */
605        public int getQueryTimeout ()
606              throws SQLException
607        {
6080          return mPreparedStatement.getQueryTimeout();
609        }
610  
611        /** {@inheritDoc} */
612        public ResultSet getResultSet ()
613              throws SQLException
614        {
6150          return mPreparedStatement.getResultSet();
616        }
617  
618        /** {@inheritDoc} */
619        public int getResultSetConcurrency ()
620              throws SQLException
621        {
6220          return mPreparedStatement.getResultSetConcurrency();
623        }
624  
625        /** {@inheritDoc} */
626        public int getResultSetHoldability ()
627              throws SQLException
628        {
6290          return mPreparedStatement.getResultSetHoldability();
630        }
631  
632        /** {@inheritDoc} */
633        public int getResultSetType ()
634              throws SQLException
635        {
6360          return mPreparedStatement.getResultSetType();
637        }
638  
639        /** {@inheritDoc} */
640        public int getUpdateCount ()
641              throws SQLException
642        {
6430          return mPreparedStatement.getUpdateCount();
644        }
645  
646        /** {@inheritDoc} */
647        public SQLWarning getWarnings ()
648              throws SQLException
649        {
6500          return mPreparedStatement.getWarnings();
651        }
652  
653        /** {@inheritDoc} */
654        public void setArray (int i, Array x)
655              throws SQLException
656        {
6570          mPreparedStatement.setArray(i, x);
6580       }
659  
660        /** {@inheritDoc} */
661        public void setAsciiStream (int parameterIndex, InputStream x, int length)
662              throws SQLException
663        {
6640          mPreparedStatement.setAsciiStream(parameterIndex, x, length);
6650       }
666  
667        /** {@inheritDoc} */
668        public void setBigDecimal (int parameterIndex, BigDecimal x)
669              throws SQLException
670        {
6710          mPreparedStatement.setBigDecimal(parameterIndex, x);
6720       }
673  
674        /** {@inheritDoc} */
675        public void setBinaryStream (
676              int parameterIndex, InputStream x, int length)
677              throws SQLException
678        {
6790          mPreparedStatement.setBinaryStream(parameterIndex, x, length);
6800       }
681  
682        /** {@inheritDoc} */
683        public void setBlob (int i, Blob x)
684              throws SQLException
685        {
6860          mPreparedStatement.setBlob(i, x);
6870       }
688  
689        /** {@inheritDoc} */
690        public void setBoolean (int parameterIndex, boolean x)
691              throws SQLException
692        {
6930          mPreparedStatement.setBoolean(parameterIndex, x);
6940       }
695  
696        /** {@inheritDoc} */
697        public void setByte (int parameterIndex, byte x)
698              throws SQLException
699        {
7000          mPreparedStatement.setByte(parameterIndex, x);
7010       }
702  
703        /** {@inheritDoc} */
704        public void setBytes (int parameterIndex, byte[] x)
705              throws SQLException
706        {
7070          mPreparedStatement.setBytes(parameterIndex, x);
7080       }
709  
710        /** {@inheritDoc} */
711        public void setCharacterStream (int parameterIndex, Reader reader,
712              int length)
713              throws SQLException
714        {
7150          mPreparedStatement.setCharacterStream(parameterIndex, reader, length);
7160       }
717  
718        /** {@inheritDoc} */
719        public void setClob (int i, Clob x)
720              throws SQLException
721        {
7220          mPreparedStatement.setClob(i, x);
7230       }
724  
725        /** {@inheritDoc} */
726        public void setCursorName (String name)
727              throws SQLException
728        {
7290          mPreparedStatement.setCursorName(name);
7300       }
731  
732        /** {@inheritDoc} */
733        public void setDate (int parameterIndex, Date x)
734              throws SQLException
735        {
7360          mPreparedStatement.setDate(parameterIndex, x);
7370       }
738  
739        /** {@inheritDoc} */
740        public void setDate (int parameterIndex, Date x, Calendar cal)
741              throws SQLException
742        {
7430          mPreparedStatement.setDate(parameterIndex, x, cal);
7440       }
745  
746        /** {@inheritDoc} */
747        public void setDouble (int parameterIndex, double x)
748              throws SQLException
749        {
7500          mPreparedStatement.setDouble(parameterIndex, x);
7510       }
752  
753        /** {@inheritDoc} */
754        public void setEscapeProcessing (boolean enable)
755              throws SQLException
756        {
7570          mPreparedStatement.setEscapeProcessing(enable);
7580       }
759  
760        /** {@inheritDoc} */
761        public void setFetchDirection (int direction)
762              throws SQLException
763        {
7640          mPreparedStatement.setFetchDirection(direction);
7650       }
766  
767        /** {@inheritDoc} */
768        public void setFetchSize (int rows)
769              throws SQLException
770        {
7710          mPreparedStatement.setFetchSize(rows);
7720       }
773  
774        /** {@inheritDoc} */
775        public void setFloat (int parameterIndex, float x)
776              throws SQLException
777        {
7780          mPreparedStatement.setFloat(parameterIndex, x);
7790       }
780  
781        /** {@inheritDoc} */
782        public void setInt (int parameterIndex, int x)
783              throws SQLException
784        {
7850          mPreparedStatement.setInt(parameterIndex, x);
7860       }
787  
788        /** {@inheritDoc} */
789        public void setLong (int parameterIndex, long x)
790              throws SQLException
791        {
7920          mPreparedStatement.setLong(parameterIndex, x);
7930       }
794  
795        /** {@inheritDoc} */
796        public void setMaxFieldSize (int max)
797              throws SQLException
798        {
7990          mPreparedStatement.setMaxFieldSize(max);
8000       }
801  
802        /** {@inheritDoc} */
803        public void setMaxRows (int max)
804              throws SQLException
805        {
8060          mPreparedStatement.setMaxRows(max);
8070       }
808  
809        /** {@inheritDoc} */
810        public void setNull (int parameterIndex, int sqlType)
811              throws SQLException
812        {
8130          mPreparedStatement.setNull(parameterIndex, sqlType);
8140       }
815  
816        /** {@inheritDoc} */
817        public void setNull (int paramIndex, int sqlType, String typeName)
818              throws SQLException
819        {
8200          mPreparedStatement.setNull(paramIndex, sqlType, typeName);
8210       }
822  
823        /** {@inheritDoc} */
824        public void setObject (int parameterIndex, Object x)
825              throws SQLException
826        {
8270          mPreparedStatement.setObject(parameterIndex, x);
8280       }
829  
830        /** {@inheritDoc} */
831        public void setObject (int parameterIndex, Object x, int targetSqlType)
832              throws SQLException
833        {
8340          mPreparedStatement.setObject(parameterIndex, x, targetSqlType);
8350       }
836  
837        /** {@inheritDoc} */
838        public void setObject (int parameterIndex, Object x, int targetSqlType,
839              int scale)
840              throws SQLException
841        {
8420          mPreparedStatement.setObject(parameterIndex, x, targetSqlType, scale);
8430       }
844  
845        /** {@inheritDoc} */
846        public void setQueryTimeout (int seconds)
847              throws SQLException
848        {
8490          mPreparedStatement.setQueryTimeout(seconds);
8500       }
851  
852        /** {@inheritDoc} */
853        public void setRef (int i, Ref x)
854              throws SQLException
855        {
8560          mPreparedStatement.setRef(i, x);
8570       }
858  
859        /** {@inheritDoc} */
860        public void setShort (int parameterIndex, short x)
861              throws SQLException
862        {
8630          mPreparedStatement.setShort(parameterIndex, x);
8640       }
865  
866        /** {@inheritDoc} */
867        public void setString (int parameterIndex, String x)
868              throws SQLException
869        {
8700          mPreparedStatement.setString(parameterIndex, x);
8710       }
872  
873        /** {@inheritDoc} */
874        public void setTime (int parameterIndex, Time x)
875              throws SQLException
876        {
8770          mPreparedStatement.setTime(parameterIndex, x);
8780       }
879  
880        /** {@inheritDoc} */
881        public void setTime (int parameterIndex, Time x, Calendar cal)
882              throws SQLException
883        {
8840          mPreparedStatement.setTime(parameterIndex, x, cal);
8850       }
886  
887        /** {@inheritDoc} */
888        public void setTimestamp (int parameterIndex, Timestamp x)
889              throws SQLException
890        {
8910          mPreparedStatement.setTimestamp(parameterIndex, x);
8920       }
893  
894        /** {@inheritDoc} */
895        public void setTimestamp (int parameterIndex, Timestamp x, Calendar cal)
896              throws SQLException
897        {
8980          mPreparedStatement.setTimestamp(parameterIndex, x, cal);
8990       }
900  
901        /** {@inheritDoc} */
902        public void setUnicodeStream (int parameterIndex, InputStream x,
903              int length)
904              throws SQLException
905        {
9060(4)         mPreparedStatement.setUnicodeStream(parameterIndex, x, length);
9070       }
908  
909        /** {@inheritDoc} */
910        public void setURL (int parameterIndex, URL x)
911              throws SQLException
912        {
9130          mPreparedStatement.setURL(parameterIndex, x);
9140       }
915     }
916  }

Findings in this File

c (1) 33 : 1 This class has a bunch of public methods and attributes
c (2) 288 : 0 Line is longer than 80 characters.
i (3) 328 : 0 Comment matches to-do format '(TODO|FIXME|CHECKME)'.
d (4) 906 : 28 [deprecation] setUnicodeStream(int,java.io.InputStream,int) in java.sql.PreparedStatement has been deprecated