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

Annotation of /miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/invocations/SQLQueryInvocation.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2448 - (hide annotations) (download)
Fri Mar 20 08:52:49 2015 UTC (9 years, 2 months ago) by torben
Original Path: miscJava/CircuitBreaker/src/dk/thoerup/circuitbreaker/invocations/SQLQueryInvocation.java
File size: 783 byte(s)
move java components to java folder
1 torben 472 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