public void close() throws SQLException { if (m_portal.isValid()) { m_portal.close(); m_statement.resultSetClosed(this); m_table = null; m_tableRow = -1; m_currentRow = null; m_nextRow = null; super.close(); } }
SPIResultSet(SPIStatement statement, Portal portal, int maxRows) throws SQLException { super(statement.getFetchSize()); m_statement = statement; m_portal = portal; m_maxRows = maxRows; m_tupleDesc = portal.getTupleDesc(); m_tableRow = -1; }
protected final TupleTable getTupleTable() throws SQLException { if (m_table == null) { Portal portal = this.getPortal(); if (portal.isAtEnd()) return null; int mx; int fetchSize = this.getFetchSize(); if (m_maxRows > 0) { mx = m_maxRows - portal.getPortalPos(); if (mx <= 0) return null; if (mx > fetchSize) mx = fetchSize; } else mx = fetchSize; try { int result = portal.fetch(true, mx); if (result > 0) m_table = SPI.getTupTable(m_tupleDesc); m_tableRow = -1; } finally { SPI.freeTupTable(); } } return m_table; }
protected final Portal getPortal() throws SQLException { if (!m_portal.isValid()) throw new SQLException("ResultSet is closed"); return m_portal; }