Revision 45425 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/impl/ResulSetControlerBase.java
ResulSetControlerBase.java | ||
---|---|---|
33 | 33 |
private String sql; |
34 | 34 |
private final FeatureAttributeDescriptor[] columns; |
35 | 35 |
private final String[] extraValueNames; |
36 |
private Throwable closeCause ; |
|
37 |
|
|
38 |
private String connId; |
|
39 |
private String hexId; |
|
36 | 40 |
|
37 | 41 |
public ResultSetEntryBase(ResultSet resulSet, String sql, FeatureAttributeDescriptor[] columns, String[] extraValueNames) { |
42 |
this.closeCause = null; |
|
38 | 43 |
this.resultSet = resulSet; |
44 |
this.connId = JDBCUtils.getConnId(this.resultSet); |
|
45 |
this.hexId = JDBCUtils.getHexId(this); |
|
39 | 46 |
this.id = nextid++; |
40 | 47 |
this.sql = sql; |
41 | 48 |
this.columns = columns; |
... | ... | |
43 | 50 |
used(); |
44 | 51 |
resulSets.put(this.getID(), this); |
45 | 52 |
if( LOGGER.isDebugEnabled() ) { |
46 |
LOGGER.debug("["+JDBCUtils.getConnId(resulSet)+"] ResultSetEntryBase "+JDBCUtils.getHexId(this)+" "+sql);
|
|
53 |
LOGGER.debug("["+JDBCUtils.getConnId(resulSet)+"] ResultSetEntryBase "+this.hexId+" "+sql);
|
|
47 | 54 |
} |
48 | 55 |
} |
49 | 56 |
|
... | ... | |
99 | 106 |
|
100 | 107 |
@Override |
101 | 108 |
public boolean next() throws SQLException { |
109 |
if( this.closeCause!=null ) { |
|
110 |
LOGGER.debug("["+this.connId+"] ResultSetEntryBase already closed "+this.hexId); |
|
111 |
throw new IllegalStateException("ResultSetEntryBase already closed, connId="+this.connId+", id="+this.hexId+" (sql="+sql+")", closeCause); |
|
112 |
} |
|
102 | 113 |
return this.resultSet.next(); |
103 | 114 |
} |
104 | 115 |
|
105 | 116 |
@Override |
106 | 117 |
public void close() throws Exception { |
107 | 118 |
if( LOGGER.isDebugEnabled() ) { |
108 |
LOGGER.debug("["+JDBCUtils.getConnId(this.resultSet)+"] ResultSetEntryBase close "+JDBCUtils.getHexId(this));
|
|
119 |
LOGGER.debug("["+this.connId+"] ResultSetEntryBase close "+this.hexId);
|
|
109 | 120 |
} |
110 | 121 |
if( this.resultSet == null ) { |
111 | 122 |
// Already close |
112 | 123 |
return; |
113 | 124 |
} |
125 |
this.closeCause = new Throwable(); |
|
126 |
|
|
114 | 127 |
Statement st = null; |
115 | 128 |
Connection con = null; |
116 | 129 |
try { |
Also available in: Unified diff