1 21 22 package org.apache.derby.impl.sql.conn; 23 24 import org.apache.derby.iapi.services.context.ContextManager; 25 26 import org.apache.derby.iapi.error.StandardException; 27 import org.apache.derby.impl.sql.GenericPreparedStatement; 28 import org.apache.derby.impl.sql.GenericStatement; 29 30 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 31 32 import org.apache.derby.iapi.sql.PreparedStatement; 33 34 import org.apache.derby.iapi.services.cache.Cacheable; 35 36 import org.apache.derby.iapi.services.sanity.SanityManager; 37 38 import org.apache.derby.iapi.services.monitor.Monitor; 39 40 43 public class CachedStatement implements Cacheable { 44 45 private GenericPreparedStatement ps; 46 private Object identity; 47 48 public CachedStatement() { 49 } 50 51 54 public GenericPreparedStatement getPreparedStatement() { 55 return ps; 56 } 57 58 59 60 64 public void clean(boolean forRemove) { 65 } 66 67 69 public Cacheable setIdentity(Object key) { 70 71 identity = key; 72 ps = new GenericPreparedStatement((GenericStatement) key); 73 ps.setCacheHolder(this); 74 75 return this; 76 } 77 78 79 public Cacheable createIdentity(Object key, Object createParameter) { 80 if (SanityManager.DEBUG) 81 SanityManager.THROWASSERT("Not expecting any create() calls"); 82 83 return null; 84 85 } 86 87 88 public void clearIdentity() { 89 90 if (SanityManager.DEBUG) 91 SanityManager.DEBUG("StatementCacheInfo","CLEARING IDENTITY: "+ps.getSource()); 92 ps.setCacheHolder(null); 93 94 identity = null; 95 ps = null; 96 } 97 98 99 public Object getIdentity() { 100 return identity; 101 } 102 103 104 public boolean isDirty() { 105 return false; 106 } 107 108 109 } 110 | Popular Tags |