public void populate(ResultSet data) throws SQLException {
      int rowsFetched;
      Row currentRow;
      int numCols;
      int i;
      Map<String, Class<?>> map = getTypeMap();
      Object obj;
      int mRows;

      if (data == null) {
         throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString());
      }
      this.resultSet = data;

      // get the meta data for this ResultSet
      RSMD = data.getMetaData();

      // set up the metadata
      RowSetMD = new RowSetMetaDataImpl();
      initMetaData(RowSetMD, RSMD);

      // release the meta-data so that aren't tempted to use it.
      RSMD = null;
      numCols = RowSetMD.getColumnCount();
      mRows = this.getMaxRows();
      rowsFetched = 0;

      while ( data.next()) {

         currentRow = new Row(numCols);

         if ( rowsFetched > mRows && mRows > 0) {
            rowsetWarning.setNextWarning(new RowSetWarning("Populating rows "
                + "setting has exceeded max row setting"));
         }
         for ( i = 1; i <= numCols; i++) {
            /*
             * check if the user has set a map. If no map
             * is set then use plain getObject. This lets
             * us work with drivers that do not support
             * getObject with a map in fairly sensible way
             */
            if (map == null || map.isEmpty()) {
               obj = data.getObject(i);
            } else {
               obj = data.getObject(i, map);
            }
            /*
             * the following block checks for the various
             * types that we have to serialize in order to
             * store - right now only structs have been tested
             */
            if (obj instanceof Struct) {
               obj = new SerialStruct((Struct)obj, map);
            } else if (obj instanceof SQLData) {
               obj = new SerialStruct((SQLData)obj, map);
            } else if (obj instanceof Blob) {
               obj = new SerialBlob((Blob)obj);
            } else if (obj instanceof Clob) {
               obj = new SerialClob((Clob)obj);
            } else if (obj instanceof java.sql.Array) {
               if(map != null)
                  obj = new SerialArray((java.sql.Array)obj, map);
               else
                  obj = new SerialArray((java.sql.Array)obj);
            }

            currentRow.initColumnObject(i, obj);
         }
         rowsFetched++;
         rvh.add(currentRow);
      }

      numRows = rowsFetched ;
      // Also rowsFetched should be equal to rvh.size()

      // notify any listeners that the rowset has changed
      notifyRowSetChanged();


   }
Populates this <code>StreamingRowSetImpl</code> object with data from
the given <code>ResultSet</code> object.  This
method is an alternative to the method <code>execute</code>
for filling the rowset with data.  The method <code>populate</code>
does not require that the properties needed by the method
<code>execute</code>, such as the <code>command</code> property,
be set. This is true because the method <code>populate</code>
is given the <code>ResultSet</code> object from
which to get data and thus does not need to use the properties
required for setting up a connection and executing this
<code>StreamingRowSetImpl</code> object's command.
<P>
After populating this rowset with data, the method
<code>populate</code> sets the rowset's metadata and
then sends a <code>RowSetChangedEvent</code> object
to all registered listeners prior to returning.

@param data the <code>ResultSet</code> object containing the data
            to be read into this <code>StreamingRowSetImpl</code> object
@throws SQLException if an error occurs; or the max row setting is
         violated while populating the RowSet
@see #execute
src/main/java/org/replicadb/rowset/StreamingRowSetImpl.java