Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 182 |  | Methods: | 14
| NCLOC: | 82 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
LogConnection.java | - | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Joey and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      */
5 |  |
     /*
6 |  |
      * Created on 2004/03/01
7 |  |
      */
8 |  |
     package org.asyrinx.brownie.jdbc.logger;
9 |  |
10 |  |
     import java.sql.CallableStatement;
11 |  |
     import java.sql.Connection;
12 |  |
     import java.sql.PreparedStatement;
13 |  |
     import java.sql.SQLException;
14 |  |
     import java.sql.Statement;
15 |  |
16 |  |
     import org.asyrinx.brownie.core.log.CascadeNamedLog;
17 |  |
     import org.asyrinx.brownie.jdbc.wrapper.ConnectionWrapper;
18 |  |
19 |  |
     /**
20 |  |
      * @author akima
21 |  |
      */
22 |  |
     public class LogConnection extends ConnectionWrapper {
23 |  |
24 |  |
         /**
25 |  |
          * @param wrapped
26 |  |
          */
27 | 0 |
         public LogConnection(Connection wrapped, CascadeNamedLog parentLog) {
28 | 0 |
             super(wrapped);
29 | 0 |
             this.log = parentLog.subLog(this.wrapped);
30 |  |
         }
31 |  |
32 |  |
         private final CascadeNamedLog log;
33 |  |
34 |  |
         /*
35 |  |
          * (non-Javadoc)
36 |  |
          *
37 |  |
          * @see java.sql.Connection#createStatement()
38 |  |
          */
39 | 0 |
         public Statement createStatement() throws SQLException {
40 | 0 |
             return new LogStatement(super.createStatement(), log);
41 |  |
         }
42 |  |
43 |  |
         /*
44 |  |
          * (non-Javadoc)
45 |  |
          *
46 |  |
          * @see java.sql.Connection#createStatement(int, int, int)
47 |  |
          */
48 | 0 |
         public Statement createStatement(int resultSetType,
49 |  |
                 int resultSetConcurrency, int resultSetHoldability)
50 |  |
                 throws SQLException {
51 | 0 |
             return new LogStatement(super.createStatement(resultSetType,
52 |  |
                     resultSetConcurrency, resultSetHoldability), log);
53 |  |
         }
54 |  |
55 |  |
         /*
56 |  |
          * (non-Javadoc)
57 |  |
          *
58 |  |
          * @see java.sql.Connection#createStatement(int, int)
59 |  |
          */
60 | 0 |
         public Statement createStatement(int resultSetType, int resultSetConcurrency)
61 |  |
                 throws SQLException {
62 | 0 |
             return new LogStatement(super.createStatement(resultSetType,
63 |  |
                     resultSetConcurrency), log);
64 |  |
         }
65 |  |
66 |  |
         /*
67 |  |
          * (non-Javadoc)
68 |  |
          *
69 |  |
          * @see org.asyrinx.brownie.jdbc.logger.ConnectionWrapper#nativeSQL(java.lang.String)
70 |  |
          */
71 | 0 |
         public String nativeSQL(String sql) throws SQLException {
72 | 0 |
             try {
73 | 0 |
                 final String result = super.nativeSQL(sql);
74 | 0 |
                 log.log(sql);
75 | 0 |
                 return result;
76 |  |
             } catch (SQLException e) {
77 | 0 |
                 log.log((Object) sql, e);
78 | 0 |
                 throw e;
79 |  |
             }
80 |  |
         }
81 |  |
82 |  |
         /*
83 |  |
          * (non-Javadoc)
84 |  |
          *
85 |  |
          * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
86 |  |
          */
87 | 0 |
         public CallableStatement prepareCall(String sql, int resultSetType,
88 |  |
                 int resultSetConcurrency, int resultSetHoldability)
89 |  |
                 throws SQLException {
90 | 0 |
             return new LogCallableStatement(super.prepareCall(sql, resultSetType,
91 |  |
                     resultSetConcurrency, resultSetHoldability), sql, log);
92 |  |
         }
93 |  |
94 |  |
         /*
95 |  |
          * (non-Javadoc)
96 |  |
          *
97 |  |
          * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
98 |  |
          */
99 | 0 |
         public CallableStatement prepareCall(String sql, int resultSetType,
100 |  |
                 int resultSetConcurrency) throws SQLException {
101 | 0 |
             return new LogCallableStatement(super.prepareCall(sql, resultSetType,
102 |  |
                     resultSetConcurrency), sql, log);
103 |  |
         }
104 |  |
105 |  |
         /*
106 |  |
          * (non-Javadoc)
107 |  |
          *
108 |  |
          * @see java.sql.Connection#prepareCall(java.lang.String)
109 |  |
          */
110 | 0 |
         public CallableStatement prepareCall(String sql) throws SQLException {
111 | 0 |
             return new LogCallableStatement(super.prepareCall(sql), sql, log);
112 |  |
         }
113 |  |
114 |  |
         /*
115 |  |
          * (non-Javadoc)
116 |  |
          *
117 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String, int, int,
118 |  |
          *      int)
119 |  |
          */
120 | 0 |
         public PreparedStatement prepareStatement(String sql, int resultSetType,
121 |  |
                 int resultSetConcurrency, int resultSetHoldability)
122 |  |
                 throws SQLException {
123 | 0 |
             return new LogPreparedStatement(super.prepareStatement(sql,
124 |  |
                     resultSetType, resultSetConcurrency, resultSetHoldability),
125 |  |
                     sql, log);
126 |  |
         }
127 |  |
128 |  |
         /*
129 |  |
          * (non-Javadoc)
130 |  |
          *
131 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
132 |  |
          */
133 | 0 |
         public PreparedStatement prepareStatement(String sql, int resultSetType,
134 |  |
                 int resultSetConcurrency) throws SQLException {
135 | 0 |
             return new LogPreparedStatement(super.prepareStatement(sql,
136 |  |
                     resultSetType, resultSetConcurrency), sql, log);
137 |  |
         }
138 |  |
139 |  |
         /*
140 |  |
          * (non-Javadoc)
141 |  |
          *
142 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String, int)
143 |  |
          */
144 | 0 |
         public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
145 |  |
                 throws SQLException {
146 | 0 |
             return new LogPreparedStatement(super.prepareStatement(sql,
147 |  |
                     autoGeneratedKeys), sql, log);
148 |  |
         }
149 |  |
150 |  |
         /*
151 |  |
          * (non-Javadoc)
152 |  |
          *
153 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
154 |  |
          */
155 | 0 |
         public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
156 |  |
                 throws SQLException {
157 | 0 |
             return new LogPreparedStatement(super.prepareStatement(sql,
158 |  |
                     columnIndexes), sql, log);
159 |  |
         }
160 |  |
161 |  |
         /*
162 |  |
          * (non-Javadoc)
163 |  |
          *
164 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String,
165 |  |
          *      java.lang.String[])
166 |  |
          */
167 | 0 |
         public PreparedStatement prepareStatement(String sql, String[] columnNames)
168 |  |
                 throws SQLException {
169 | 0 |
             return new LogPreparedStatement(super
170 |  |
                     .prepareStatement(sql, columnNames), sql, log);
171 |  |
         }
172 |  |
173 |  |
         /*
174 |  |
          * (non-Javadoc)
175 |  |
          *
176 |  |
          * @see java.sql.Connection#prepareStatement(java.lang.String)
177 |  |
          */
178 | 0 |
         public PreparedStatement prepareStatement(String sql) throws SQLException {
179 | 0 |
             return new LogPreparedStatement(super.prepareStatement(sql), sql, log);
180 |  |
         }
181 |  |
182 |  |
     }