Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 5.1.0sp9 API Reference

## weblogic.db.jdbc
Class DataSet

    java.lang.Object
      |
      +--weblogic.db.jdbc.DataSet

Direct Known Subclasses:
  QueryDataSet, TableDataSet

public abstract class DataSet
extends java.lang.Object
implements WLSerializable

DataSet is the abstract parent class of TableDataSet and QueryDataSet. A DataSet manages record caching details.

Each DataSet is bound to a Schema, which holds metadata such as the name, datatype, and size of each record in the DataSet. Records in a DataSet are accessible by index position (0-based).

For implementation and usage, see the Developers Guide and tutorials.

Author:
  Copyright (c) 1995-1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1998-1999 by BEA Systems, Inc. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `Record`, `Schema`, `QueryDataSet`, `TableDataSet`, Serialized Form

Field Summary
`protected boolean` | `cached`
`protected boolean` | `resetable`
`protected java.sql.ResultSet` | `resultval`
`protected java.sql.Statement` | `stmt`

Constructor Summary
`DataSet()` Internal use only.

Method Summary
`Record` | `addRecord()` Adds a new Record to a DataSet.
`boolean` | `allRecordsRetrieved()` Determines whether all records for a DataSet have been retrieved.
`DataSet` | `clearRecords()` Clears all Records from a DataSet.
`void` | `close()` Closes all the resources associated with a DataSet.
`java.sql.Connection` | `connection()` Returns the Connection object of a DataSet.
`boolean` | `containsRecord(int pos)` Determines whether a Record exists at the specified position.
`void` | `destroy()` Internal use only.
`DataSet` | `fetchRecords()` Fetches all records.
`DataSet` | `fetchRecords(int maxrecs)` Fetches at most the specified number of records.
`DataSet` | `fetchRecords(int start, int maxrecs)` Fetches at most the specified number of records starting at the specified record.
`Record` | `getRecord(int pos)` Gets a Record at the specified 0-based index position in a DataSet.
`java.sql.ResultSet` | `getResultSet()` Gets the `java.sql.ResultSet` used to create a DataSet.
`abstract java.lang.String` | `getSelectString()` Gets the SelectStatement associated with a DataSet.
`void` | `initialize()` Internal use only.
`int` | `lastFetchSize()` Returns the number of records fetched in the previous fetch action.
`int[]` | `maxColumnWidths(boolean with_heading)` Calculates the maximum widths of the columns in a DataSet.
`void` | `readObject(WLObjectInput sis)` Internal use only.
`DataSet` | `releaseRecords()` Closes the DataSet and releases all Records from it but does not nullify them.
`Record` | `removeRecord(Record rec)` Removes the specified Record object from a DataSet.
`DataSet` | `reset()` Clears the current contents of a DataSet.
`abstract java.sql.ResultSet` | `resultSet()` Returns the `java.sql.ResultSet` associated with a DataSet.
`Schema` | `schema()` Returns the Schema object of a DataSet.
`int` | `size()` Returns the number of Records in a DataSet.
`java.lang.String` | `toString()` Returns the string representation of all the Records of a DataSet.
`void` | `writeObject(WLObjectOutput sos)` Internal use only.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### resetable

    protected boolean resetable

### cached

    protected boolean cached

### stmt

    protected transient java.sql.Statement stmt

### resultval

    protected transient java.sql.ResultSet resultval

Constructor Detail

### DataSet

    public DataSet()

  Internal use only.

Method Detail

### resultSet

    public abstract java.sql.ResultSet resultSet()
                                          throws java.sql.SQLException,
                                                 DataSetException

  Returns the `java.sql.ResultSet` associated with a DataSet.

  Returns:
    JDBC ResultSet
  Throws:
    java.sql.SQLException - if there is a SQL error
    DataSetException - if there is a data error

### getResultSet

    public java.sql.ResultSet getResultSet()

  Gets the `java.sql.ResultSet` used to create a DataSet.

  Returns:
    JDBC ResultSet

### connection

    public java.sql.Connection connection()

  Returns the Connection object of a DataSet. This may return null if the DataSet was instantiated with a `java.sql.ResultSet` object.

  Returns:
    Connection object

### schema

    public Schema schema()
                  throws java.sql.SQLException,
                         DataSetException

  Returns the Schema object of a DataSet.

  Returns:
    Schema object
  Throws:
    java.sql.SQLException - if there is a SQL error
    DataSetException - if there is a data error

### size

    public int size()

  Returns the number of Records in a DataSet.

  Returns:
    Number of Records

### allRecordsRetrieved

    public boolean allRecordsRetrieved()

  Determines whether all records for a DataSet have been retrieved.

  Returns:
    True if query is complete

### reset

    public DataSet reset()
                  throws DataSetException,
                         java.sql.SQLException

  Clears the current contents of a DataSet. This will cause a requery to the database on the next fetch action. This method cannot be called on QueryDataSets instantiated with an explicit `java.sql.ResultSet` argument.

  Returns:
    DataSet object
  Throws:
    java.sql.SQLException - if there is a SQL error
    DataSetException - if there is a data error

### clearRecords

    public DataSet clearRecords()

  Clears all Records from a DataSet.

  Returns:
    DataSet object

### releaseRecords

    public DataSet releaseRecords()
                           throws java.sql.SQLException,
                                  DataSetException

  Closes the DataSet and releases all Records from it but does not nullify them. This is so a DataSet can be reused to generate new records while any records still held by the application remain readable.

  Returns:
    DataSet object
  Throws:
    java.sql.SQLException - if there is a SQL error
    DataSetException - if there is a problem with the DataSet

### getRecord

    public Record getRecord(int pos)
                     throws DataSetException

  Gets a Record at the specified 0-based index position in a DataSet.

  Parameters:
    `pos` - 0-based index in the DataSet
  Returns:
    Record object
  Throws:
    DataSetException - if Record is not found at that position

### lastFetchSize

    public int lastFetchSize()

  Returns the number of records fetched in the previous fetch action.

  Returns:
    Number of records fetched

### fetchRecords

    public DataSet fetchRecords()
                         throws java.sql.SQLException,
                                DataSetException

  Fetches all records.

  Returns:
    DataSet object
  Throws:
    java.sql.SQLException - if the records cannot be retrieved
    DataSetException - if there is a problem with the DataSet

### fetchRecords

    public DataSet fetchRecords(int maxrecs)
                         throws java.sql.SQLException,
                                DataSetException

  Fetches at most the specified number of records.

  Parameters:
    `maxrecs` - Maximum number of records to fetch
  Returns:
    DataSet object
  Throws:
    java.sql.SQLException - if the records cannot be retrieved
    DataSetException - if there is a problem with the DataSet

### fetchRecords

    public DataSet fetchRecords(int start,
                                int maxrecs)
                         throws java.sql.SQLException,
                                DataSetException

  Fetches at most the specified number of records starting at the specified record.

  Parameters:
    `start` - Position of first record to fetch
    `maxrecs` - Maximum number of records to fetch
  Returns:
    DataSet object
  Throws:
    java.sql.SQLException - if the records cannot be retrieved
    DataSetException - if there is a problem with the DataSet

### close

    public void close()
               throws java.sql.SQLException,
                      DataSetException

  Closes all the resources associated with a DataSet.

  Throws:
    DataSetException - if there is an error with the DataSet
    java.sql.SQLException - if there is a SQL error

### addRecord

    public Record addRecord()
                     throws DataSetException,
                            java.sql.SQLException

  Adds a new Record to a DataSet.

  Returns:
    Record object
  Throws:
    DataSetException - if the Record cannot be added
    java.sql.SQLException - if there is a SQL error

### removeRecord

    public Record removeRecord(Record rec)
                        throws DataSetException

  Removes the specified Record object from a DataSet.

  Parameters:
    `rec` - Record to be removed
  Returns:
    Record removed
  Throws:
    DataSetException - if the Record is not present

### getSelectString

    public abstract java.lang.String getSelectString()

  Gets the SelectStatement associated with a DataSet.

  Returns:
    SelectStatement

### containsRecord

    public boolean containsRecord(int pos)

  Determines whether a Record exists at the specified position.

  Parameters:
    `pos` - Index into the DataSet
  Returns:
    True if Record exists

### toString

    public java.lang.String toString()

  Returns the string representation of all the Records of a DataSet.

  Returns:
    String value
  Overrides:
    toString in class java.lang.Object

### maxColumnWidths

    public int[] maxColumnWidths(boolean with_heading)
                          throws DataSetException,
                                 java.sql.SQLException

  Calculates the maximum widths of the columns in a DataSet.

  Parameters:
    `with_heading` - True if width of column headings should be included in calculation
  Returns:
    Maximum widths of all columns
  Throws:
    DataSetException - if there is an error in the DataSet
    java.sql.SQLException - if there is a SQL error

### initialize

    public void initialize()

  Internal use only.

### destroy

    public void destroy()

  Internal use only.

### readObject

    public void readObject(WLObjectInput sis)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException

  Internal use only.
  Specified by:
    readObject in interface WLSerializable

  Throws:
    java.io.IOException - if there is an error
    java.lang.ClassNotFoundException - if there is an error

### writeObject

    public void writeObject(WLObjectOutput sos)
                     throws java.io.IOException

  Internal use only.
  Specified by:
    writeObject in interface WLSerializable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://www.weblogic.com/docs51
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD