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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20