-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIonicStatement.java
More file actions
256 lines (206 loc) · 6.44 KB
/
IonicStatement.java
File metadata and controls
256 lines (206 loc) · 6.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
package com.ionic.sdk.addon.jdbc;
import com.ionic.sdk.agent.Agent;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
/**
* Implementation of JDBC interface {@link java.sql.Statement}. Populated from IDE "Implement Methods" wizard.
*/
public class IonicStatement implements java.sql.Statement {
/**
* The wrapped object (supplied by the underlying {@link Connection}).
*/
private final Statement wrapped;
/**
* Ionic agent, used to protect data on database insert, and unprotect data on database fetch.
*/
private final Agent agent;
/**
* Constructor.
*
* @param wrapped {@link Statement} supplied by the underlying {@link Connection}
* @param agent Ionic agent, used to protect data on database insert, and to unprotect data on database fetch
*/
public IonicStatement(final Statement wrapped, Agent agent) {
this.wrapped = wrapped;
this.agent = agent;
}
@Override
public ResultSet executeQuery(String sql) throws SQLException {
return wrapped.executeQuery(sql);
}
@Override
public int executeUpdate(String sql) throws SQLException {
return wrapped.executeUpdate(sql);
}
@Override
public void close() throws SQLException {
wrapped.close();
}
@Override
public int getMaxFieldSize() throws SQLException {
return wrapped.getMaxFieldSize();
}
@Override
public void setMaxFieldSize(int max) throws SQLException {
wrapped.setMaxFieldSize(max);
}
@Override
public int getMaxRows() throws SQLException {
return wrapped.getMaxRows();
}
@Override
public void setMaxRows(int max) throws SQLException {
wrapped.setMaxRows(max);
}
@Override
public void setEscapeProcessing(boolean enable) throws SQLException {
wrapped.setEscapeProcessing(enable);
}
@Override
public int getQueryTimeout() throws SQLException {
return wrapped.getQueryTimeout();
}
@Override
public void setQueryTimeout(int seconds) throws SQLException {
wrapped.setQueryTimeout(seconds);
}
@Override
public void cancel() throws SQLException {
wrapped.cancel();
}
@Override
public SQLWarning getWarnings() throws SQLException {
return wrapped.getWarnings();
}
@Override
public void clearWarnings() throws SQLException {
wrapped.clearWarnings();
}
@Override
public void setCursorName(String name) throws SQLException {
wrapped.setCursorName(name);
}
@Override
public boolean execute(String sql) throws SQLException {
return wrapped.execute(sql);
}
@Override
public ResultSet getResultSet() throws SQLException {
return new IonicResultSet(wrapped.getResultSet(), agent);
}
@Override
public int getUpdateCount() throws SQLException {
return wrapped.getUpdateCount();
}
@Override
public boolean getMoreResults() throws SQLException {
return wrapped.getMoreResults();
}
@Override
public void setFetchDirection(int direction) throws SQLException {
wrapped.setFetchDirection(direction);
}
@Override
public int getFetchDirection() throws SQLException {
return wrapped.getFetchDirection();
}
@Override
public void setFetchSize(int rows) throws SQLException {
wrapped.setFetchSize(rows);
}
@Override
public int getFetchSize() throws SQLException {
return wrapped.getFetchSize();
}
@Override
public int getResultSetConcurrency() throws SQLException {
return wrapped.getResultSetConcurrency();
}
@Override
public int getResultSetType() throws SQLException {
return wrapped.getResultSetType();
}
@Override
public void addBatch(String sql) throws SQLException {
wrapped.addBatch(sql);
}
@Override
public void clearBatch() throws SQLException {
wrapped.clearBatch();
}
@Override
public int[] executeBatch() throws SQLException {
return wrapped.executeBatch();
}
@Override
public Connection getConnection() throws SQLException {
return wrapped.getConnection();
}
@Override
public boolean getMoreResults(int current) throws SQLException {
return wrapped.getMoreResults(current);
}
@Override
public ResultSet getGeneratedKeys() throws SQLException {
return wrapped.getGeneratedKeys();
}
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
return wrapped.executeUpdate(sql, autoGeneratedKeys);
}
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
return wrapped.executeUpdate(sql, columnIndexes);
}
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
return wrapped.executeUpdate(sql, columnNames);
}
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
return wrapped.execute(sql, autoGeneratedKeys);
}
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return wrapped.execute(sql, columnIndexes);
}
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
return wrapped.execute(sql, columnNames);
}
@Override
public int getResultSetHoldability() throws SQLException {
return wrapped.getResultSetHoldability();
}
@Override
public boolean isClosed() throws SQLException {
return wrapped.isClosed();
}
@Override
public void setPoolable(boolean poolable) throws SQLException {
wrapped.setPoolable(poolable);
}
@Override
public boolean isPoolable() throws SQLException {
return wrapped.isPoolable();
}
@Override
public void closeOnCompletion() throws SQLException {
wrapped.closeOnCompletion();
}
@Override
public boolean isCloseOnCompletion() throws SQLException {
return wrapped.isCloseOnCompletion();
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return wrapped.unwrap(iface);
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return wrapped.isWrapperFor(iface);
}
}