Java Doc for Fetch.java in  » Scripting » jython » com » ziclix » python » sql » 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 » Scripting » jython » com.ziclix.python.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ziclix.python.sql.Fetch

Fetch
abstract public class Fetch (Code)

The responsibility of a Fetch instance is to manage the iteration of a ResultSet. Two different alogorithms are available: static or dynamic.

Static The static variety iterates the entire set immediately, creating the necessary Jython objects and storing them. It is able to immediately close the ResultSet so a call to close() is essentially a no-op from a database resource perspective (it does clear the results list however). This approach also allows for the correct rowcount to be determined since the entire result set has been iterated.

Dynamic The dynamic variety iterates the result set only as requested. This holds a bit truer to the intent of the API as the fetch*() methods actually fetch when instructed. This is especially useful for managing exeedingly large results, but is unable to determine the rowcount without having worked through the entire result set. The other disadvantage is the ResultSet remains open throughout the entire iteration. So the tradeoff is in open database resources versus JVM resources since the application can keep constant space if it doesn't require the entire result set be presented as one.


author:
   brian zimmer
version:
   $Revision: 2542 $


Field Summary
protected  PyObjectdescription
    
protected  introwcount
     The total number of rows in the result set.
protected  intrownumber
     The current row of the cursor (-1 if off either end).

Constructor Summary
protected  Fetch(DataHandler datahandler)
    

Method Summary
abstract public  voidadd(ResultSet resultSet)
     Create the results after a successful execution and manages the result set.
abstract public  voidadd(ResultSet resultSet, Set skipCols)
     Create the results after a successful execution and manages the result set.
abstract public  voidadd(CallableStatement callableStatement, Procedure procedure, PyObject params)
    
public  voidaddWarningListener(WarningListener listener)
    
public  voidclose()
     Cleanup any resources.
protected  PyObjectcreateDescription(ResultSetMetaData meta)
     Builds a tuple containing the meta-information about each column.
protected  PyObjectcreateDescription(Procedure procedure)
     Builds a tuple containing the meta-information about each column.
protected  PyTuplecreateResult(ResultSet set, Set skipCols, PyObject metaData)
     Creates the individual result row from the current ResultSet row.
protected  PyObjectcreateResults(CallableStatement callableStatement, Procedure procedure, PyObject params)
    
protected  PyListcreateResults(ResultSet set, Set skipCols, PyObject metaData)
     Creates the results of a query.
abstract public  PyObjectfetchall()
     Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g.
abstract public  PyObjectfetchmany(int size)
     Fetch the next set of rows of a query result, returning a sequence of sequences (e.g.
public  PyObjectfetchone()
     Fetch the next row of a query result set, returning a single sequence, or None when no more data is available.
protected  voidfireWarning(SQLWarning warning)
    
public  PyObjectgetDescription()
     The description of each column, in order, for the data in the result set.
public  intgetRowCount()
     The number of rows in the current result set.
public static  FetchnewFetch(DataHandler datahandler, boolean dynamic)
    
abstract public  PyObjectnextset()
     Move the result pointer to the next set if available.
public  booleanremoveWarningListener(WarningListener listener)
    
abstract public  voidscroll(int value, String mode)
     Scroll the cursor in the result set to a new position according to mode.

If mode is 'relative' (default), value is taken as offset to the current position in the result set, if set to 'absolute', value states an absolute target position.

An IndexError should be raised in case a scroll operation would leave the result set.


Field Detail
description
protected PyObject description(Code)
Field description



rowcount
protected int rowcount(Code)
The total number of rows in the result set.

Note: since JDBC provides no means to get this information without iterating the entire result set, only those fetches which build the result statically will have an accurate row count.




rownumber
protected int rownumber(Code)
The current row of the cursor (-1 if off either end).




Constructor Detail
Fetch
protected Fetch(DataHandler datahandler)(Code)
Constructor Fetch
Parameters:
  datahandler -




Method Detail
add
abstract public void add(ResultSet resultSet)(Code)
Create the results after a successful execution and manages the result set.
Parameters:
  resultSet -



add
abstract public void add(ResultSet resultSet, Set skipCols)(Code)
Create the results after a successful execution and manages the result set. Optionally takes a set of JDBC-indexed columns to automatically set to None primarily to support getTypeInfo() which sets a column type of a number but doesn't use the value so a driver is free to put anything it wants there.
Parameters:
  resultSet -
Parameters:
  skipCols - JDBC-indexed set of columns to be skipped



add
abstract public void add(CallableStatement callableStatement, Procedure procedure, PyObject params)(Code)
Method add
Parameters:
  callableStatement -
Parameters:
  procedure -
Parameters:
  params -



addWarningListener
public void addWarningListener(WarningListener listener)(Code)



close
public void close() throws SQLException(Code)
Cleanup any resources.



createDescription
protected PyObject createDescription(ResultSetMetaData meta) throws SQLException(Code)
Builds a tuple containing the meta-information about each column.

(name, type_code, display_size, internal_size, precision, scale, null_ok)

precision and scale are only available for numeric types




createDescription
protected PyObject createDescription(Procedure procedure) throws SQLException(Code)
Builds a tuple containing the meta-information about each column.

(name, type_code, display_size, internal_size, precision, scale, null_ok)

precision and scale are only available for numeric types




createResult
protected PyTuple createResult(ResultSet set, Set skipCols, PyObject metaData) throws SQLException(Code)
Creates the individual result row from the current ResultSet row.
Parameters:
  set - result set
Parameters:
  skipCols - set of JDBC-indexed columns to automatically set to None a tuple of the results
throws:
  SQLException -



createResults
protected PyObject createResults(CallableStatement callableStatement, Procedure procedure, PyObject params) throws SQLException(Code)
Method createResults
Parameters:
  callableStatement -
Parameters:
  procedure -
Parameters:
  params - PyObject
throws:
  SQLException -



createResults
protected PyList createResults(ResultSet set, Set skipCols, PyObject metaData) throws SQLException(Code)
Creates the results of a query. Iterates through the list and builds the tuple.
Parameters:
  set - result set
Parameters:
  skipCols - set of JDBC-indexed columns to automatically set to None a list of tuples of the results
throws:
  SQLException -



fetchall
abstract public PyObject fetchall()(Code)
Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation.

An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. a sequence of sequences from the result set, or None when no more data is available




fetchmany
abstract public PyObject fetchmany(int size)(Code)
Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available.

The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor's arraysize determines the number of rows to be fetched. The method should try to fetch as many rows as indicated by the size parameter. If this is not possible due to the specified number of rows not being available, fewer rows may be returned.

An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet.

Note there are performance considerations involved with the size parameter. For optimal performance, it is usually best to use the arraysize attribute. If the size parameter is used, then it is best for it to retain the same value from one fetchmany() call to the next. a sequence of sequences from the result set, or None when no more data is available




fetchone
public PyObject fetchone()(Code)
Fetch the next row of a query result set, returning a single sequence, or None when no more data is available.

An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. a single sequence from the result set, or None when no more data is available




fireWarning
protected void fireWarning(SQLWarning warning)(Code)



getDescription
public PyObject getDescription()(Code)
The description of each column, in order, for the data in the result set.



getRowCount
public int getRowCount()(Code)
The number of rows in the current result set.



newFetch
public static Fetch newFetch(DataHandler datahandler, boolean dynamic)(Code)
Method newFetch
Parameters:
  datahandler -
Parameters:
  dynamic - Fetch



nextset
abstract public PyObject nextset()(Code)
Move the result pointer to the next set if available. true if more sets exist, else None



removeWarningListener
public boolean removeWarningListener(WarningListener listener)(Code)



scroll
abstract public void scroll(int value, String mode)(Code)
Scroll the cursor in the result set to a new position according to mode.

If mode is 'relative' (default), value is taken as offset to the current position in the result set, if set to 'absolute', value states an absolute target position.

An IndexError should be raised in case a scroll operation would leave the result set. In this case, the cursor position is left undefined (ideal would be to not move the cursor at all).

Note: This method should use native scrollable cursors, if available, or revert to an emulation for forward-only scrollable cursors. The method may raise NotSupportedErrors to signal that a specific operation is not supported by the database (e.g. backward scrolling).
Parameters:
  value -
Parameters:
  mode -




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.