/[projects]/CircuitBreaker/src/dk/thoerup/circuitbreaker/invocations/SQLQueryInvocation.java
ViewVC logotype

Contents of /CircuitBreaker/src/dk/thoerup/circuitbreaker/invocations/SQLQueryInvocation.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 472 - (show annotations) (download)
Tue Oct 27 12:33:05 2009 UTC (14 years, 8 months ago) by torben
File size: 783 byte(s)
Added two more general purpose invocations
1 package dk.thoerup.circuitbreaker.invocations;
2
3 import java.sql.PreparedStatement;
4 import java.sql.ResultSet;
5 import java.sql.Statement;
6
7 import dk.thoerup.circuitbreaker.CircuitInvocation;
8
9 public class SQLQueryInvocation implements CircuitInvocation {
10
11 PreparedStatement pStatement = null;
12 Statement statement = null;
13 String sql = null;
14
15
16 public SQLQueryInvocation(Statement stmt, String sql) {
17 this.statement = stmt;
18 this.sql = sql;
19 }
20
21 public SQLQueryInvocation(PreparedStatement pstmt) {
22 pStatement = pstmt;
23 }
24
25
26 public ResultSet proceed() throws Exception {
27 ResultSet res;
28
29 if (pStatement != null) {
30 res = pStatement.executeQuery();
31 } else {
32 res = statement.executeQuery(sql);
33 }
34
35 return res;
36 }
37
38
39 }

  ViewVC Help
Powered by ViewVC 1.1.20