1 28 29 package com.caucho.sql; 30 31 34 class PreparedStatementKey { 35 private String _sql; 36 private int _resultType; 37 38 PreparedStatementKey() 39 { 40 } 41 42 PreparedStatementKey(String sql) 43 { 44 init(sql); 45 } 46 47 PreparedStatementKey(String sql, int resultType) 48 { 49 _sql = sql; 50 _resultType = resultType; 51 } 52 53 void init(String sql, int resultType) 54 { 55 _sql = sql; 56 _resultType = resultType; 57 } 58 59 void init(String sql) 60 { 61 _sql = sql; 62 _resultType = -1; 63 } 64 65 PreparedStatementKey copy() 66 { 67 return new PreparedStatementKey(_sql, _resultType); 68 } 69 70 public int hashCode() 71 { 72 int hash = _sql.hashCode(); 73 74 hash = 65521 * hash + _resultType; 75 76 return hash; 77 } 78 79 public boolean equals(Object o) 80 { 81 if (o == null || ! getClass().equals(o.getClass())) 82 return false; 83 84 PreparedStatementKey key = (PreparedStatementKey) o; 85 86 if (! _sql.equals(key._sql)) 87 return false; 88 else if (_resultType != key._resultType) 89 return false; 90 else 91 return true; 92 } 93 } 94 | Popular Tags |