1 2 12 package com.versant.core.jdbc.conn; 13 14 import java.sql.*; 15 16 22 public final class StatementWithLastSQL implements Statement { 23 24 private String lastSQL = ""; 25 private final Statement statement; 26 27 public StatementWithLastSQL(Statement statement) { 28 this.statement = statement; 29 } 30 31 34 public String getLastSQL() { 35 return lastSQL; 36 } 37 38 public boolean getMoreResults(int current) throws SQLException { 39 return statement.getMoreResults(current); 40 } 41 42 public ResultSet getGeneratedKeys() throws SQLException { 43 return statement.getGeneratedKeys(); 44 } 45 46 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { 47 return statement.executeUpdate(lastSQL = sql, autoGeneratedKeys); 48 } 49 50 public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { 51 return statement.executeUpdate(lastSQL = sql, columnIndexes); 52 } 53 54 public int executeUpdate(String sql, String columnNames[]) throws SQLException { 55 return statement.executeUpdate(lastSQL = sql, columnNames); 56 } 57 58 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { 59 return statement.execute(lastSQL = sql, autoGeneratedKeys); 60 } 61 62 public boolean execute(String sql, int columnIndexes[]) throws SQLException { 63 return statement.execute(lastSQL = sql, columnIndexes); 64 } 65 66 public boolean execute(String sql, String columnNames[]) throws SQLException { 67 return statement.execute(lastSQL = sql, columnNames); 68 } 69 70 public int getResultSetHoldability() throws SQLException { 71 return statement.getResultSetHoldability(); 72 } 73 74 public ResultSet executeQuery(String sql) throws SQLException { 75 return statement.executeQuery(lastSQL = sql); 76 } 77 78 public int executeUpdate(String sql) throws SQLException { 79 return statement.executeUpdate(lastSQL = sql); 80 } 81 82 public void close() throws SQLException { 83 statement.close(); 84 } 85 86 public int getMaxFieldSize() throws SQLException { 87 return statement.getMaxFieldSize(); 88 } 89 90 public void setMaxFieldSize(int max) throws SQLException { 91 statement.setMaxFieldSize(max); 92 } 93 94 public int getMaxRows() throws SQLException { 95 return statement.getMaxRows(); 96 } 97 98 public void setMaxRows(int max) throws SQLException { 99 statement.setMaxRows(max); 100 } 101 102 public void setEscapeProcessing(boolean enable) throws SQLException { 103 statement.setEscapeProcessing(enable); 104 } 105 106 public int getQueryTimeout() throws SQLException { 107 return statement.getQueryTimeout(); 108 } 109 110 public void setQueryTimeout(int seconds) throws SQLException { 111 statement.setQueryTimeout(seconds); 112 } 113 114 public void cancel() throws SQLException { 115 statement.cancel(); 116 } 117 118 public SQLWarning getWarnings() throws SQLException { 119 return statement.getWarnings(); 120 } 121 122 public void clearWarnings() throws SQLException { 123 statement.clearWarnings(); 124 } 125 126 public void setCursorName(String name) throws SQLException { 127 statement.setCursorName(name); 128 } 129 130 public boolean execute(String sql) throws SQLException { 131 return statement.execute(lastSQL = sql); 132 } 133 134 public ResultSet getResultSet() throws SQLException { 135 return statement.getResultSet(); 136 } 137 138 public int getUpdateCount() throws SQLException { 139 return statement.getUpdateCount(); 140 } 141 142 public boolean getMoreResults() throws SQLException { 143 return statement.getMoreResults(); 144 } 145 146 public void setFetchDirection(int direction) throws SQLException { 147 statement.setFetchDirection(direction); 148 } 149 150 public int getFetchDirection() throws SQLException { 151 return statement.getFetchDirection(); 152 } 153 154 public void setFetchSize(int rows) throws SQLException { 155 statement.setFetchSize(rows); 156 } 157 158 public int getFetchSize() throws SQLException { 159 return statement.getFetchSize(); 160 } 161 162 public int getResultSetConcurrency() throws SQLException { 163 return statement.getResultSetConcurrency(); 164 } 165 166 public int getResultSetType() throws SQLException { 167 return statement.getResultSetType(); 168 } 169 170 public void addBatch(String sql) throws SQLException { 171 statement.addBatch(sql); 172 } 173 174 public void clearBatch() throws SQLException { 175 statement.clearBatch(); 176 } 177 178 public int[] executeBatch() throws SQLException { 179 return statement.executeBatch(); 180 } 181 182 public Connection getConnection() throws SQLException { 183 return statement.getConnection(); 184 } 185 } 186 | Popular Tags |