Java Doc for ResultSetIterator.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » db » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.db.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.hp.hpl.jena.db.impl.ResultSetIterator

All known Subclasses:   com.hp.hpl.jena.db.impl.ResultSetReifIterator,  com.hp.hpl.jena.db.impl.ResultSetNodeIterator,  com.hp.hpl.jena.db.impl.ResultSetTripleIterator,
ResultSetIterator
public class ResultSetIterator implements ExtendedIterator(Code)
Iterates over an SQL result set returning each row as an ArrayList of objects. The returned array is shared at each iteration so calling next() or even hasNext() changes the array contents. When the iterator terminates the resources are cleaned up and the underlying SQL PreparedStatement is returned to the SQLCache pool from whence it came.

Override the extractRow, getRow, and remove methods in subclasses to return an object collection derived from the row contents instead of the raw row contents.
author:
   Dave Reynolds
version:
   $Revision: 1.14 $ on $Date: 2008/01/02 12:08:24 $



Field Summary
protected static  Loglogger
    
protected  booleanm_finished
    
protected  intm_nCols
    
protected  Stringm_opname
    
protected  booleanm_prefetched
    
protected  ResultSetm_resultSet
    
protected  ArrayListm_row
    
protected  SQLCachem_sqlCache
    
protected  PreparedStatementm_statement
    
protected  booleanm_statementClean
    

Constructor Summary
public  ResultSetIterator()
     Create an empty iterator. Needs to be initialized by reset before it can be accessed.
public  ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)
    
public  ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement)
     Iterate over the results of a PreparedStatement, close the statement when finished.

Method Summary
public  ExtendedIteratorandThen(ClosableIterator other)
     return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator.
protected  voidcantRemove()
    
public  voidclose()
     Clean up the allocated resources - result set and statement.
protected  voidextractRow()
     Extract the current row Override in subclasses.
public  ExtendedIteratorfilterDrop(Filter f)
    
public  ExtendedIteratorfilterKeep(Filter f)
    
protected  voidfinalize()
     Clean up the database cursor.
protected  ObjectgetRow()
     Return the current row,should have already been extracted.
public  ObjectgetSingleton()
     Get a singleton result (single column from single row) and close the iterator.
public  booleanhasNext()
    
public  ExtendedIteratormapWith(Map1 map1)
    
protected  voidmoveForward()
     More forward one row.
public  Objectnext()
    
public  voidremove()
    
public  ObjectremoveNext()
    
public  voidreset(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)
     Reset an existing iterator to scan a new result set.
public  voidreset(ResultSet resultSet, PreparedStatement sourceStatement)
     Reset an existing iterator to scan a new result set.
public  ListtoList()
    
public  SettoSet()
    

Field Detail
logger
protected static Log logger(Code)



m_finished
protected boolean m_finished(Code)
Flag that the iteration has finished



m_nCols
protected int m_nCols(Code)
The number of columns in this result set



m_opname
protected String m_opname(Code)
The name of the original operation that lead to this statement, can be null if SQLCache is null



m_prefetched
protected boolean m_prefetched(Code)
Flag if we have prefeteched the next row but not yet returned it



m_resultSet
protected ResultSet m_resultSet(Code)
The ResultSet being iterated over



m_row
protected ArrayList m_row(Code)
The contents of the current row



m_sqlCache
protected SQLCache m_sqlCache(Code)
The originating SQLcache to return the statement to, can be null



m_statement
protected PreparedStatement m_statement(Code)
The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache



m_statementClean
protected boolean m_statementClean(Code)
If true, clean/close the prepared statement when iterator is closed




Constructor Detail
ResultSetIterator
public ResultSetIterator()(Code)
Create an empty iterator. Needs to be initialized by reset before it can be accessed. Useful to allow generic functions like SQLCache.runSQLQuery runSQLQuery to return different iterator types to the client.



ResultSetIterator
public ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)(Code)
Iterate over the results of a PreparedStatement generated by an SQLCache
Parameters:
  resultSet - the result set being iterated over
Parameters:
  sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache
Parameters:
  cache - The originating SQLcache to return the statement to, can be null
Parameters:
  opname - The name of the original operation that lead to this statement, can be null if SQLCache is null



ResultSetIterator
public ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement)(Code)
Iterate over the results of a PreparedStatement, close the statement when finished.
Parameters:
  resultSet - the result set being iterated over
Parameters:
  sourceStatement - The source Statement to be closed when the iterator finishes




Method Detail
andThen
public ExtendedIterator andThen(ClosableIterator other)(Code)
return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator. Does not copy either iterator; they are consumed as the result iterator is consumed.



cantRemove
protected void cantRemove()(Code)



close
public void close()(Code)
Clean up the allocated resources - result set and statement. If we know of an SQLCache return the statement there, otherwise close it.



extractRow
protected void extractRow() throws Exception(Code)
Extract the current row Override in subclasses.



filterDrop
public ExtendedIterator filterDrop(Filter f)(Code)



filterKeep
public ExtendedIterator filterKeep(Filter f)(Code)



finalize
protected void finalize() throws SQLException(Code)
Clean up the database cursor. Noramlly the client should read to the end or explicity close but....



getRow
protected Object getRow()(Code)
Return the current row,should have already been extracted. Override in subclasses.



getSingleton
public Object getSingleton() throws SQLException(Code)
Get a singleton result (single column from single row) and close the iterator. This may be too specialized but seems to come up a lot - rethink.



hasNext
public boolean hasNext()(Code)
Test if there is a next result to return



mapWith
public ExtendedIterator mapWith(Map1 map1)(Code)



moveForward
protected void moveForward()(Code)
More forward one row. Sets the m_finished flag if there is no more to fetch



next
public Object next()(Code)
Return the current row



remove
public void remove()(Code)
Delete the current row entry



removeNext
public Object removeNext()(Code)



reset
public void reset(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)(Code)
Reset an existing iterator to scan a new result set.
Parameters:
  resultSet - the result set being iterated over
Parameters:
  sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache
Parameters:
  cache - The originating SQLcache to return the statement to, can be null
Parameters:
  opname - The name of the original operation that lead to this statement, can be null if SQLCache is null



reset
public void reset(ResultSet resultSet, PreparedStatement sourceStatement)(Code)
Reset an existing iterator to scan a new result set.
Parameters:
  resultSet - the result set being iterated over
Parameters:
  sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cachenote: the sourceStatement is not closed or returned when the iterator is closed.



toList
public List toList()(Code)



toSet
public Set toSet()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.