KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > minerva > pool > jdbc > PSCacheKey


1 /*
2  * Licensed under the X license (see http://www.x.org/terms.htm)
3  */

4 package org.ofbiz.minerva.pool.jdbc;
5
6 import java.sql.Connection JavaDoc;
7 import java.sql.ResultSet JavaDoc;
8
9 /**
10  * Temporarily not used. Identifies a PreparedStatement by
11  * SQL, type, and concurrency.
12  *
13  * @author Aaron Mulder ammulder@alumni.princeton.edu
14  */

15 public class PSCacheKey {
16
17     public Connection JavaDoc con;
18     public String JavaDoc sql;
19     public int rsType;
20     public int rsConcur;
21
22     public PSCacheKey(Connection JavaDoc con, String JavaDoc sql) {
23         this.con = con;
24         this.sql = sql;
25         this.rsType = ResultSet.TYPE_FORWARD_ONLY;
26         this.rsConcur = ResultSet.CONCUR_READ_ONLY;
27     }
28
29     public PSCacheKey(Connection JavaDoc con, String JavaDoc sql, int rsType, int rsConcur) {
30         this.con = con;
31         this.sql = sql;
32         this.rsType = rsType;
33         this.rsConcur = rsConcur;
34     }
35
36     public boolean equals(Object JavaDoc o) {
37         PSCacheKey key = (PSCacheKey) o;
38         return key.con.equals(con) && key.sql.equals(sql) && key.rsType == rsType && key.rsConcur == rsConcur;
39     }
40
41     public int hashCode() {
42         return con.hashCode() ^ sql.hashCode() ^ rsType ^ rsConcur;
43     }
44 }
45
Popular Tags