1 22 package org.enhydra.jdbc.core; 23 24 import org.enhydra.jdbc.util.JdbcUtil; 25 26 import java.sql.Connection ; 27 import java.sql.ResultSet ; 28 import java.sql.SQLException ; 29 import java.sql.SQLWarning ; 30 import java.sql.Statement ; 31 32 37 public abstract class CoreStatement extends JdbcUtil implements Statement { 38 39 protected Statement statement; 40 42 public void addBatch(String s) throws SQLException { 43 try { 45 statement.addBatch(s); 46 } catch (SQLException e) { 47 catchInvoke(e); 48 } 49 } 50 51 public void cancel() throws SQLException { 52 try { 54 statement.cancel(); 55 } catch (SQLException e) { 56 catchInvoke(e); 57 } 58 } 59 60 public void clearBatch() throws SQLException { 61 try { 63 statement.clearBatch(); 64 } catch (SQLException e) { 65 catchInvoke(e); 66 } 67 } 68 69 public void clearWarnings() throws SQLException { 70 try { 72 statement.clearWarnings(); 73 } catch (SQLException e) { 74 catchInvoke(e); 75 } 76 } 77 78 public void close() throws SQLException { 79 if (statement != null) { 80 statement.close(); 81 } 82 } 83 84 public boolean execute(String s) throws SQLException { 85 try { 87 return statement.execute(s); 88 } catch (SQLException e) { 89 catchInvoke(e); 90 } 91 return false; 92 } 93 94 public int[] executeBatch() throws SQLException { 95 try { 97 return statement.executeBatch(); 98 } catch (SQLException e) { 99 catchInvoke(e); 100 } 101 return null; 102 } 103 104 public ResultSet executeQuery(String s) throws SQLException { 105 try { 107 return statement.executeQuery(s); 108 } catch (SQLException e) { 109 catchInvoke(e); 110 } 111 return null; 112 } 113 114 public int executeUpdate(String s) throws SQLException { 115 try { 117 return statement.executeUpdate(s); 118 } catch (SQLException e) { 119 catchInvoke(e); 120 } 121 return 0; 122 } 123 124 public Connection getConnection() throws SQLException { 125 try { 127 return statement.getConnection(); 128 } catch (SQLException e) { 129 catchInvoke(e); 130 } 131 return null; 132 } 133 134 public int getFetchDirection() throws SQLException { 135 try { 137 return statement.getFetchDirection(); 138 } catch (SQLException e) { 139 catchInvoke(e); 140 } 141 return 0; 142 } 143 144 public int getFetchSize() throws SQLException { 145 try { 147 return statement.getFetchSize(); 148 } catch (SQLException e) { 149 catchInvoke(e); 150 } 151 return 0; 152 } 153 154 public ResultSet getGeneratedKeys() throws SQLException { 155 try { 157 return statement.getGeneratedKeys(); 158 } catch (SQLException e) { 159 catchInvoke(e); 160 } 161 return null; 162 } 163 164 public int getMaxFieldSize() throws SQLException { 165 try { 167 return statement.getMaxFieldSize(); 168 } catch (SQLException e) { 169 catchInvoke(e); 170 } 171 return 0; 172 } 173 174 public int getMaxRows() throws SQLException { 175 try { 177 return statement.getMaxRows(); 178 } catch (SQLException e) { 179 catchInvoke(e); 180 } 181 return 0; 182 } 183 184 public boolean getMoreResults() throws SQLException { 185 try { 187 return statement.getMoreResults(); 188 } catch (SQLException e) { 189 catchInvoke(e); 190 } 191 return false; 192 } 193 194 public int getQueryTimeout() throws SQLException { 195 try { 197 return statement.getQueryTimeout(); 198 } catch (SQLException e) { 199 catchInvoke(e); 200 } 201 return 0; 202 } 203 204 public ResultSet getResultSet() throws SQLException { 205 try { 207 return statement.getResultSet(); 208 } catch (SQLException e) { 209 catchInvoke(e); 210 } 211 return null; 212 } 213 214 public int getResultSetConcurrency() throws SQLException { 215 try { 217 return statement.getResultSetConcurrency(); 218 } catch (SQLException e) { 219 catchInvoke(e); 220 } 221 return 0; 222 } 223 224 public int getResultSetType() throws SQLException { 225 try { 227 return statement.getResultSetType(); 228 } catch (SQLException e) { 229 catchInvoke(e); 230 } 231 return 0; 232 } 233 234 public int getUpdateCount() throws SQLException { 235 try { 237 return statement.getUpdateCount(); 238 } catch (SQLException e) { 239 catchInvoke(e); 240 } 241 return 0; 242 } 243 244 public SQLWarning getWarnings() throws SQLException { 245 try { 247 return statement.getWarnings(); 248 } catch (SQLException e) { 249 catchInvoke(e); 250 } 251 return null; 252 } 253 254 public void setCursorName(String name) throws SQLException { 255 try { 257 statement.setCursorName(name); 258 } catch (SQLException e) { 259 catchInvoke(e); 260 } 261 } 262 263 public void setEscapeProcessing(boolean enable) throws SQLException { 264 try { 266 statement.setEscapeProcessing(enable); 267 } catch (SQLException e) { 268 catchInvoke(e); 269 } 270 } 271 272 public void setFetchDirection(int direction) throws SQLException { 273 try { 275 statement.setFetchDirection(direction); 276 } catch (SQLException e) { 277 catchInvoke(e); 278 } 279 } 280 281 public void setFetchSize(int rows) throws SQLException { 282 try { 284 statement.setFetchSize(rows); 285 } catch (SQLException e) { 286 catchInvoke(e); 287 } 288 } 289 290 public void setMaxFieldSize(int max) throws SQLException { 291 try { 293 statement.setMaxFieldSize(max); 294 } catch (SQLException e) { 295 catchInvoke(e); 296 } 297 } 298 299 public void setMaxRows(int max) throws SQLException { 300 try { 302 statement.setMaxRows(max); 303 } catch (SQLException e) { 304 catchInvoke(e); 305 } 306 } 307 308 public void setQueryTimeout(int seconds) throws SQLException { 309 try { 311 statement.setQueryTimeout(seconds); 312 } catch (SQLException e) { 313 catchInvoke(e); 314 } 315 } 316 317 322 public boolean execute(String sql, int autoGeneratedKeys) 323 throws SQLException { 324 try { 325 return statement.execute(sql, autoGeneratedKeys); 326 } catch (SQLException e) { 327 catchInvoke(e); 328 } 329 return false; 330 } 331 public boolean execute(String sql, int[] columnIndexes) 332 throws SQLException { 333 try { 334 return statement.execute(sql, columnIndexes); 335 } catch (SQLException e) { 336 catchInvoke(e); 337 } 338 return false; 339 } 340 public boolean execute(String sql, String [] columnNames) 341 throws SQLException { 342 try { 343 return statement.execute(sql, columnNames); 344 } catch (SQLException e) { 345 catchInvoke(e); 346 } 347 return false; 348 } 349 public int executeUpdate(String sql, int autoGeneratedKeys) 350 throws SQLException { 351 try { 352 return statement.executeUpdate(sql, autoGeneratedKeys); 353 } catch (SQLException e) { 354 catchInvoke(e); 355 } 356 return 0; 357 } 358 public int executeUpdate(String sql, int[] columnIndexes) 359 throws SQLException { 360 try { 361 return statement.executeUpdate(sql, columnIndexes); 362 } catch (SQLException e) { 363 catchInvoke(e); 364 } 365 return 0; 366 } 367 public int executeUpdate(String sql, String [] columnNames) 368 throws SQLException { 369 try { 370 return statement.executeUpdate(sql, columnNames); 371 } catch (SQLException e) { 372 catchInvoke(e); 373 } 374 return 0; 375 } 376 public boolean getMoreResults(int current) 377 throws SQLException { 378 try { 379 return statement.getMoreResults(current); 380 } catch (SQLException e) { 381 catchInvoke(e); 382 } 383 return false; 384 } 385 public int getResultSetHoldability() 386 throws SQLException { 387 try { 388 return statement.getResultSetHoldability(); 389 } catch (SQLException e) { 390 catchInvoke(e); 391 } 392 return 0; 393 } 394 395 399 abstract public void catchInvoke(SQLException e) throws SQLException ; 401 402 } | Popular Tags |