|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.rowset.internal.CachedRowSetReader
The facility called by the RIOptimisticProvider
object
internally to read data into it. The calling RowSet
object
must have implemented the RowSetInternal
interface
and have the standard CachedRowSetReader
object set as its
reader.
This implementation always reads all rows of the data source,
and it assumes that the command
property for the caller
is set with a query that is appropriate for execution by a
PreparedStatement
object.
Typically the SyncFactory
manages the RowSetReader
and
the RowSetWriter
implementations using SyncProvider
objects.
Standard JDBC RowSet implementations provide an object instance of this
reader by invoking the SyncProvider.getRowSetReader()
method.
SyncProvider
,
SyncFactory
,
SyncFactoryException
,
Serialized FormConstructor Summary | |
CachedRowSetReader()
|
Method Summary | |
java.sql.Connection |
connect(javax.sql.RowSetInternal caller)
Establishes a connection with the data source for the given RowSet object. |
protected boolean |
getCloseConnection()
Assists in determining whether the current connection was created by this CachedRowSet to ensure incorrect connections are not prematurely terminated. |
void |
readData(javax.sql.RowSetInternal caller)
Reads data from a data source and populates the given RowSet object with that data. |
boolean |
reset()
Checks to see if the writer associated with this reader needs to reset its state. |
void |
setStartPosition(int pos)
This sets the start position in the ResultSet from where to begin. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CachedRowSetReader()
Method Detail |
public void readData(javax.sql.RowSetInternal caller) throws java.sql.SQLException
RowSet
object with that data.
This method is called by the rowset internally when
the application invokes the method execute
to read a new set of rows.
After clearing the rowset of its contents, if any, and setting
the number of writer calls to 0
, this reader calls
its connect
method to make
a connection to the rowset's data source. Depending on which
of the rowset's properties have been set, the connect
method will use a DataSource
object or the
DriverManager
facility to make a connection to the
data source.
Once the connection to the data source is made, this reader
executes the query in the calling CachedRowSet
object's
command
property. Then it calls the rowset's
populate
method, which reads data from the
ResultSet
object produced by executing the rowset's
command. The rowset is then populated with this data.
This method's final act is to close the connection it made, thus leaving the rowset disconnected from its data source.
readData
in interface javax.sql.RowSetReader
caller
- a RowSet
object that has implemented
the RowSetInternal
interface and had
this CachedRowSetReader
object set as
its reader
java.sql.SQLException
- if there is a database access error, there is a
problem making the connection, or the command property has not
been setpublic boolean reset() throws java.sql.SQLException
true
if writer associated with this reader needs
to reset the values of its fields; false
otherwise
java.sql.SQLException
- if an access error occurspublic java.sql.Connection connect(javax.sql.RowSetInternal caller) throws java.sql.SQLException
RowSet
object. If the rowset's dataSourceName
property has been set, this method uses the JNDI API to retrieve the
DataSource
object that it can use to make the connection.
If the url, username, and password properties have been set, this
method uses the DriverManager.getConnection
method to
make the connection.
This method is used internally by the reader and writer associated with
the calling RowSet
object; an application never calls it
directly.
caller
- a RowSet
object that has implemented
the RowSetInternal
interface and had
this CachedRowSetReader
object set as
its reader
Connection
object that represents a connection
to the caller's data source
java.sql.SQLException
- if an access error occursprotected boolean getCloseConnection()
public void setStartPosition(int pos)
pos
- integer indicating the position in the ResultSet
to begin
populating from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |