0001: /*
0002: * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
0003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0004: *
0005: * This code is free software; you can redistribute it and/or modify it
0006: * under the terms of the GNU General Public License version 2 only, as
0007: * published by the Free Software Foundation. Sun designates this
0008: * particular file as subject to the "Classpath" exception as provided
0009: * by Sun in the LICENSE file that accompanied this code.
0010: *
0011: * This code is distributed in the hope that it will be useful, but WITHOUT
0012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0014: * version 2 for more details (a copy is included in the LICENSE file that
0015: * accompanied this code).
0016: *
0017: * You should have received a copy of the GNU General Public License version
0018: * 2 along with this work; if not, write to the Free Software Foundation,
0019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0020: *
0021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0022: * CA 95054 USA or visit www.sun.com if you need additional information or
0023: * have any questions.
0024: */
0025:
0026: package com.sun.rowset;
0027:
0028: import java.sql.*;
0029: import javax.sql.*;
0030: import javax.naming.*;
0031: import java.io.*;
0032: import java.math.*;
0033: import java.util.*;
0034:
0035: import javax.sql.rowset.*;
0036:
0037: /**
0038: * The standard implementation of the <code>JoinRowSet</code>
0039: * interface providing an SQL <code>JOIN</code> between <code>RowSet</code>
0040: * objects.
0041: * <P>
0042: * The implementation provides an ANSI-style <code>JOIN</code> providing an
0043: * inner join between two tables. Any unmatched rows in either table of the
0044: * join are discarded.
0045: * <p>
0046: * Typically, a <code>JoinRowSet</code> implementation is leveraged by
0047: * <code>RowSet</code> instances that are in a disconnected environment and
0048: * thus do not have the luxury of an open connection to the data source to
0049: * establish logical relationships between themselves. In other words, it is
0050: * largely <code>CachedRowSet</code> objects and implementations derived from
0051: * the <code>CachedRowSet</code> interface that will use the <code>JoinRowSetImpl</code>
0052: * implementation.
0053: *
0054: * @author Amit Handa, Jonathan Bruce
0055: */
0056: public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
0057: /**
0058: * A <code>Vector</code> object that contains the <code>RowSet</code> objects
0059: * that have been added to this <code>JoinRowSet</code> object.
0060: */
0061: private Vector vecRowSetsInJOIN;
0062:
0063: /**
0064: * The <code>CachedRowSet</code> object that encapsulates this
0065: * <code>JoinRowSet</code> object.
0066: * When <code>RowSet</code> objects are added to this <code>JoinRowSet</code>
0067: * object, they are also added to <i>crsInternal</i> to form the same kind of
0068: * SQL <code>JOIN</code>. As a result, methods for making updates to this
0069: * <code>JoinRowSet</code> object can use <i>crsInternal</i> methods in their
0070: * implementations.
0071: */
0072: private CachedRowSetImpl crsInternal;
0073:
0074: /**
0075: * A <code>Vector</code> object containing the types of join that have been set
0076: * for this <code>JoinRowSet</code> object.
0077: * The last join type set forms the basis of succeeding joins.
0078: */
0079: private Vector vecJoinType;
0080:
0081: /**
0082: * A <code>Vector</code> object containing the names of all the tables entering
0083: * the join.
0084: */
0085: private Vector vecTableNames;
0086:
0087: /**
0088: * An <code>int</code> that indicates the column index of the match column.
0089: */
0090: private int iMatchKey;
0091:
0092: /**
0093: * A <code>String</code> object that stores the name of the match column.
0094: */
0095: private String strMatchKey;
0096:
0097: /**
0098: * An array of <code>boolean</code> values indicating the types of joins supported
0099: * by this <code>JoinRowSet</code> implementation.
0100: */
0101: boolean[] supportedJOINs;
0102:
0103: /**
0104: * The <code>WebRowSet</code> object that encapsulates this <code>JoinRowSet</code>
0105: * object. This <code>WebRowSet</code> object allows this <code>JoinRowSet</code>
0106: * object to leverage the properties and methods of a <code>WebRowSet</code>
0107: * object.
0108: */
0109: private WebRowSet wrs;
0110:
0111: /**
0112: * Constructor for <code>JoinRowSetImpl</code> class. Configures various internal data
0113: * structures to provide mechanisms required for <code>JoinRowSet</code> interface
0114: * implementation.
0115: *
0116: * @throws SQLException if an error occurs in instantiating an instance of
0117: * <code>JoinRowSetImpl</code>
0118: */
0119: public JoinRowSetImpl() throws SQLException {
0120:
0121: vecRowSetsInJOIN = new Vector();
0122: crsInternal = new CachedRowSetImpl();
0123: vecJoinType = new Vector();
0124: vecTableNames = new Vector();
0125: iMatchKey = -1;
0126: strMatchKey = null;
0127: supportedJOINs = new boolean[] { false, true, false, false,
0128: false };
0129:
0130: }
0131:
0132: /**
0133: * Adds the given <code>RowSet</code> object to this
0134: * <code>JoinRowSet</code> object. If this
0135: * rowset is the first to be added to the <code>JoinRowSet</code>
0136: * object, it forms the basis for the <code>JOIN</code>
0137: * relationships to be formed.
0138: * <p>
0139: * This method should be used when the given <code>RowSet</code> object
0140: * already has a match column set.
0141: *
0142: * @param rowset the <code>RowSet</code> object that implements the
0143: * <code>Joinable</code> interface and is to be added
0144: * to this <code>JoinRowSet</code> object
0145: * @throws SQLException if an empty <code>RowSet</code> is added to the to the
0146: * <code>JoinRowSet</code>; if a match column is not set; or if an
0147: * additional <code>RowSet</code> violates the active <code>JOIN</code>
0148: * @see CachedRowSet#setMatchColumn
0149: */
0150: public void addRowSet(Joinable rowset) throws SQLException {
0151: boolean boolColId, boolColName;
0152:
0153: boolColId = false;
0154: boolColName = false;
0155: CachedRowSetImpl cRowset;
0156:
0157: if (!(rowset instanceof RowSet)) {
0158: throw new SQLException(resBundle.handleGetObject(
0159: "joinrowsetimpl.notinstance").toString());
0160: }
0161:
0162: if (rowset instanceof JdbcRowSetImpl) {
0163: cRowset = new CachedRowSetImpl();
0164: cRowset.populate((RowSet) rowset);
0165: if (cRowset.size() == 0) {
0166: throw new SQLException(resBundle.handleGetObject(
0167: "joinrowsetimpl.emptyrowset").toString());
0168: }
0169:
0170: try {
0171: int matchColumnCount = 0;
0172: for (int i = 0; i < rowset.getMatchColumnIndexes().length; i++) {
0173: if (rowset.getMatchColumnIndexes()[i] != -1)
0174: ++matchColumnCount;
0175: else
0176: break;
0177: }
0178: int[] pCol = new int[matchColumnCount];
0179: for (int i = 0; i < matchColumnCount; i++)
0180: pCol[i] = rowset.getMatchColumnIndexes()[i];
0181: cRowset.setMatchColumn(pCol);
0182: } catch (SQLException sqle) {
0183:
0184: }
0185:
0186: } else {
0187: cRowset = (CachedRowSetImpl) rowset;
0188: if (cRowset.size() == 0) {
0189: throw new SQLException(resBundle.handleGetObject(
0190: "joinrowsetimpl.emptyrowset").toString());
0191: }
0192: }
0193:
0194: // Either column id or column name will be set
0195: // If both not set throw exception.
0196:
0197: try {
0198: iMatchKey = (cRowset.getMatchColumnIndexes())[0];
0199: } catch (SQLException sqle) {
0200: //if not set catch the exception but do nothing now.
0201: boolColId = true;
0202: }
0203:
0204: try {
0205: strMatchKey = (cRowset.getMatchColumnNames())[0];
0206: } catch (SQLException sqle) {
0207: //if not set catch the exception but do nothing now.
0208: boolColName = true;
0209: }
0210:
0211: if (boolColId && boolColName) {
0212: // neither setter methods have been used to set
0213: throw new SQLException(resBundle.handleGetObject(
0214: "joinrowsetimpl.matchnotset").toString());
0215: } else {
0216: //if(boolColId || boolColName)
0217: // either of the setter methods have been set.
0218: if (boolColId) {
0219: //
0220: ArrayList indices = new ArrayList();
0221: for (int i = 0; i < cRowset.getMatchColumnNames().length; i++) {
0222: if ((strMatchKey = (cRowset.getMatchColumnNames())[i]) != null) {
0223: iMatchKey = cRowset.findColumn(strMatchKey);
0224: indices.add(iMatchKey);
0225: } else
0226: break;
0227: }
0228: int[] indexes = new int[indices.size()];
0229: for (int i = 0; i < indices.size(); i++)
0230: indexes[i] = ((Integer) indices.get(i)).intValue();
0231: cRowset.setMatchColumn(indexes);
0232: // Set the match column here because join will be
0233: // based on columnId,
0234: // (nested for loop in initJOIN() checks for equality
0235: // based on columnIndex)
0236: } else {
0237: //do nothing, iMatchKey is set.
0238: }
0239: // Now both iMatchKey and strMatchKey have been set pointing
0240: // to the same column
0241: }
0242:
0243: // Till first rowset setJoinType may not be set because
0244: // default type is JoinRowSet.INNER_JOIN which should
0245: // be set and for subsequent additions of rowset, if not set
0246: // keep on adding join type as JoinRowSet.INNER_JOIN
0247: // to vecJoinType.
0248:
0249: initJOIN(cRowset);
0250: }
0251:
0252: /**
0253: * Adds the given <code>RowSet</code> object to the <code>JOIN</code> relation
0254: * and sets the designated column as the match column.
0255: * If the given <code>RowSet</code>
0256: * object is the first to be added to this <code>JoinRowSet</code>
0257: * object, it forms the basis of the <code>JOIN</code> relationship to be formed
0258: * when other <code>RowSet</code> objects are added .
0259: * <P>
0260: * This method should be used when the given <code>RowSet</code> object
0261: * does not already have a match column set.
0262: *
0263: * @param rowset a <code>RowSet</code> object to be added to
0264: * the <code>JOIN</code> relation; must implement the <code>Joinable</code>
0265: * interface
0266: * @param columnIdx an <code>int</code> giving the index of the column to be set as
0267: * the match column
0268: * @throws SQLException if (1) an empty <code>RowSet</code> object is added to this
0269: * <code>JoinRowSet</code> object, (2) a match column has not been set,
0270: * or (3) the <code>RowSet</code> object being added violates the active
0271: * <code>JOIN</code>
0272: * @see CachedRowSet#unsetMatchColumn
0273: */
0274: public void addRowSet(RowSet rowset, int columnIdx)
0275: throws SQLException {
0276: //passing the rowset as well as the columnIdx to form the joinrowset.
0277:
0278: ((CachedRowSetImpl) rowset).setMatchColumn(columnIdx);
0279:
0280: addRowSet((Joinable) rowset);
0281: }
0282:
0283: /**
0284: * Adds the given <code>RowSet</code> object to the <code>JOIN</code> relationship
0285: * and sets the designated column as the match column. If the given
0286: * <code>RowSet</code>
0287: * object is the first to be added to this <code>JoinRowSet</code>
0288: * object, it forms the basis of the <code>JOIN</code> relationship to be formed
0289: * when other <code>RowSet</code> objects are added .
0290: * <P>
0291: * This method should be used when the given <code>RowSet</code> object
0292: * does not already have a match column set.
0293: *
0294: * @param rowset a <code>RowSet</code> object to be added to
0295: * the <code>JOIN</code> relation
0296: * @param columnName a <code>String</code> object giving the name of the column
0297: * to be set as the match column; must implement the <code>Joinable</code>
0298: * interface
0299: * @throws SQLException if (1) an empty <code>RowSet</code> object is added to this
0300: * <code>JoinRowSet</code> object, (2) a match column has not been set,
0301: * or (3) the <code>RowSet</code> object being added violates the active
0302: * <code>JOIN</code>
0303: */
0304: public void addRowSet(RowSet rowset, String columnName)
0305: throws SQLException {
0306: //passing the rowset as well as the columnIdx to form the joinrowset.
0307: ((CachedRowSetImpl) rowset).setMatchColumn(columnName);
0308: addRowSet((Joinable) rowset);
0309: }
0310:
0311: /**
0312: * Adds the given <code>RowSet</code> objects to the <code>JOIN</code> relationship
0313: * and sets the designated columns as the match columns. If the first
0314: * <code>RowSet</code> object in the array of <code>RowSet</code> objects
0315: * is the first to be added to this <code>JoinRowSet</code>
0316: * object, it forms the basis of the <code>JOIN</code> relationship to be formed
0317: * when other <code>RowSet</code> objects are added.
0318: * <P>
0319: * The first <code>int</code>
0320: * in <i>columnIdx</i> is used to set the match column for the first
0321: * <code>RowSet</code> object in <i>rowset</i>, the second <code>int</code>
0322: * in <i>columnIdx</i> is used to set the match column for the second
0323: * <code>RowSet</code> object in <i>rowset</i>, and so on.
0324: * <P>
0325: * This method should be used when the given <code>RowSet</code> objects
0326: * do not already have match columns set.
0327: *
0328: * @param rowset an array of <code>RowSet</code> objects to be added to
0329: * the <code>JOIN</code> relation; each <code>RowSet</code> object must
0330: * implement the <code>Joinable</code> interface
0331: * @param columnIdx an array of <code>int</code> values designating the columns
0332: * to be set as the
0333: * match columns for the <code>RowSet</code> objects in <i>rowset</i>
0334: * @throws SQLException if the number of <code>RowSet</code> objects in
0335: * <i>rowset</i> is not equal to the number of <code>int</code> values
0336: * in <i>columnIdx</i>
0337: */
0338: public void addRowSet(RowSet[] rowset, int[] columnIdx)
0339: throws SQLException {
0340: //validate if length of rowset array is same as length of int array.
0341: if (rowset.length != columnIdx.length) {
0342: throw new SQLException(resBundle.handleGetObject(
0343: "joinrowsetimpl.numnotequal").toString());
0344: } else {
0345: for (int i = 0; i < rowset.length; i++) {
0346: ((CachedRowSetImpl) rowset[i])
0347: .setMatchColumn(columnIdx[i]);
0348: addRowSet((Joinable) rowset[i]);
0349: } //end for
0350: } //end if
0351:
0352: }
0353:
0354: /**
0355: * Adds the given <code>RowSet</code> objects to the <code>JOIN</code> relationship
0356: * and sets the designated columns as the match columns. If the first
0357: * <code>RowSet</code> object in the array of <code>RowSet</code> objects
0358: * is the first to be added to this <code>JoinRowSet</code>
0359: * object, it forms the basis of the <code>JOIN</code> relationship to be formed
0360: * when other <code>RowSet</code> objects are added.
0361: * <P>
0362: * The first <code>String</code> object
0363: * in <i>columnName</i> is used to set the match column for the first
0364: * <code>RowSet</code> object in <i>rowset</i>, the second <code>String</code>
0365: * object in <i>columnName</i> is used to set the match column for the second
0366: * <code>RowSet</code> object in <i>rowset</i>, and so on.
0367: * <P>
0368: * This method should be used when the given <code>RowSet</code> objects
0369: * do not already have match columns set.
0370: *
0371: * @param rowset an array of <code>RowSet</code> objects to be added to
0372: * the <code>JOIN</code> relation; each <code>RowSet</code> object must
0373: * implement the <code>Joinable</code> interface
0374: * @param columnName an array of <code>String</code> objects designating the columns
0375: * to be set as the
0376: * match columns for the <code>RowSet</code> objects in <i>rowset</i>
0377: * @throws SQLException if the number of <code>RowSet</code> objects in
0378: * <i>rowset</i> is not equal to the number of <code>String</code> objects
0379: * in <i>columnName</i>, an empty <code>JdbcRowSet</code> is added to the
0380: * <code>JoinRowSet</code>, if a match column is not set,
0381: * or one or the <code>RowSet</code> objects in <i>rowset</i> violates the
0382: * active <code>JOIN</code>
0383: */
0384: public void addRowSet(RowSet[] rowset, String[] columnName)
0385: throws SQLException {
0386: //validate if length of rowset array is same as length of int array.
0387:
0388: if (rowset.length != columnName.length) {
0389: throw new SQLException(resBundle.handleGetObject(
0390: "joinrowsetimpl.numnotequal").toString());
0391: } else {
0392: for (int i = 0; i < rowset.length; i++) {
0393: ((CachedRowSetImpl) rowset[i])
0394: .setMatchColumn(columnName[i]);
0395: addRowSet((Joinable) rowset[i]);
0396: } //end for
0397: } //end if
0398:
0399: }
0400:
0401: /**
0402: * Returns a Collection of the <code>RowSet</code> object instances
0403: * currently residing with the instance of the <code>JoinRowSet</code>
0404: * object instance. This should return the 'n' number of RowSet contained
0405: * within the JOIN and maintain any updates that have occoured while in
0406: * this union.
0407: *
0408: * @return A <code>Collection</code> of the added <code>RowSet</code>
0409: * object instances
0410: * @throws SQLException if an error occours generating a collection
0411: * of the originating RowSets contained within the JOIN.
0412: */
0413: public Collection getRowSets() throws SQLException {
0414: return vecRowSetsInJOIN;
0415: }
0416:
0417: /**
0418: * Returns a string array of the RowSet names currently residing
0419: * with the <code>JoinRowSet</code> object instance.
0420: *
0421: * @return a string array of the RowSet names
0422: * @throws SQLException if an error occours retrieving the RowSet names
0423: * @see CachedRowSet#setTableName
0424: */
0425: public String[] getRowSetNames() throws SQLException {
0426: Object[] arr = vecTableNames.toArray();
0427: String[] strArr = new String[arr.length];
0428:
0429: for (int i = 0; i < arr.length; i++) {
0430: strArr[i] = arr[i].toString();
0431: }
0432:
0433: return strArr;
0434: }
0435:
0436: /**
0437: * Creates a separate <code>CachedRowSet</code> object that contains the data
0438: * in this <code>JoinRowSet</code> object.
0439: * <P>
0440: * If any updates or modifications have been applied to this <code>JoinRowSet</code>
0441: * object, the <code>CachedRowSet</code> object returned by this method will
0442: * not be able to persist
0443: * the changes back to the originating rows and tables in the
0444: * data source because the data may be from different tables. The
0445: * <code>CachedRowSet</code> instance returned should not
0446: * contain modification data, such as whether a row has been updated or what the
0447: * original values are. Also, the <code>CachedRowSet</code> object should clear
0448: * its properties pertaining to
0449: * its originating SQL statement. An application should reset the
0450: * SQL statement using the <code>RowSet.setCommand</code> method.
0451: * <p>
0452: * To persist changes back to the data source, the <code>JoinRowSet</code> object
0453: * calls the method <code>acceptChanges</code>. Implementations
0454: * can leverage the internal data and update tracking in their
0455: * implementations to interact with the <code>SyncProvider</code> to persist any
0456: * changes.
0457: *
0458: * @return a <code>CachedRowSet</code> object containing the contents of this
0459: * <code>JoinRowSet</code> object
0460: * @throws SQLException if an error occurs assembling the <code>CachedRowSet</code>
0461: * object
0462: * @see javax.sql.RowSet
0463: * @see javax.sql.rowset.CachedRowSet
0464: * @see javax.sql.rowset.spi.SyncProvider
0465: */
0466: public CachedRowSet toCachedRowSet() throws SQLException {
0467: return crsInternal;
0468: }
0469:
0470: /**
0471: * Returns <code>true</code> if this <code>JoinRowSet</code> object supports
0472: * an SQL <code>CROSS_JOIN</code> and <code>false</code> if it does not.
0473: *
0474: * @return <code>true</code> if the CROSS_JOIN is supported; <code>false</code>
0475: * otherwise
0476: */
0477: public boolean supportsCrossJoin() {
0478: return supportedJOINs[JoinRowSet.CROSS_JOIN];
0479: }
0480:
0481: /**
0482: * Returns <code>true</code> if this <code>JoinRowSet</code> object supports
0483: * an SQL <code>INNER_JOIN</code> and <code>false</code> if it does not.
0484: *
0485: * @return true is the INNER_JOIN is supported; false otherwise
0486: */
0487: public boolean supportsInnerJoin() {
0488: return supportedJOINs[JoinRowSet.INNER_JOIN];
0489: }
0490:
0491: /**
0492: * Returns <code>true</code> if this <code>JoinRowSet</code> object supports
0493: * an SQL <code>LEFT_OUTER_JOIN</code> and <code>false</code> if it does not.
0494: *
0495: * @return true is the LEFT_OUTER_JOIN is supported; false otherwise
0496: */
0497: public boolean supportsLeftOuterJoin() {
0498: return supportedJOINs[JoinRowSet.LEFT_OUTER_JOIN];
0499: }
0500:
0501: /**
0502: * Returns <code>true</code> if this <code>JoinRowSet</code> object supports
0503: * an SQL <code>RIGHT_OUTER_JOIN</code> and <code>false</code> if it does not.
0504: *
0505: * @return true is the RIGHT_OUTER_JOIN is supported; false otherwise
0506: */
0507: public boolean supportsRightOuterJoin() {
0508: return supportedJOINs[JoinRowSet.RIGHT_OUTER_JOIN];
0509: }
0510:
0511: /**
0512: * Returns <code>true</code> if this <code>JoinRowSet</code> object supports
0513: * an SQL <code>FULL_JOIN</code> and <code>false</code> if it does not.
0514: *
0515: * @return true is the FULL_JOIN is supported; false otherwise
0516: */
0517: public boolean supportsFullJoin() {
0518: return supportedJOINs[JoinRowSet.FULL_JOIN];
0519:
0520: }
0521:
0522: /**
0523: * Sets the type of SQL <code>JOIN</code> that this <code>JoinRowSet</code>
0524: * object will use. This method
0525: * allows an application to adjust the type of <code>JOIN</code> imposed
0526: * on tables contained within this <code>JoinRowSet</code> object and to do it
0527: * on the fly. The last <code>JOIN</code> type set determines the type of
0528: * <code>JOIN</code> to be performed.
0529: * <P>
0530: * Implementations should throw an <code>SQLException</code> if they do
0531: * not support the given <code>JOIN</code> type.
0532: *
0533: * @param type one of the standard <code>JoinRowSet</code> constants
0534: * indicating the type of <code>JOIN</code>. Must be one of the
0535: * following:
0536: * <code>JoinRowSet.CROSS_JOIN</code>
0537: * <code>JoinRowSet.INNER_JOIN</code>
0538: * <code>JoinRowSet.LEFT_OUTER_JOIN</code>
0539: * <code>JoinRowSet.RIGHT_OUTER_JOIN</code>, or
0540: * <code>JoinRowSet.FULL_JOIN</code>
0541: * @throws SQLException if an unsupported <code>JOIN</code> type is set
0542: */
0543: public void setJoinType(int type) throws SQLException {
0544: // The join which governs the join of two rowsets is the last
0545: // join set, using setJoinType
0546:
0547: if (type >= JoinRowSet.CROSS_JOIN
0548: && type <= JoinRowSet.FULL_JOIN) {
0549: if (type != JoinRowSet.INNER_JOIN) {
0550: // This 'if' will be removed after all joins are implemented.
0551: throw new SQLException(resBundle.handleGetObject(
0552: "joinrowsetimpl.notsupported").toString());
0553: } else {
0554: Integer Intgr = new Integer(JoinRowSet.INNER_JOIN);
0555: vecJoinType.add(Intgr);
0556: }
0557: } else {
0558: throw new SQLException(resBundle.handleGetObject(
0559: "joinrowsetimpl.notdefined").toString());
0560: } //end if
0561: }
0562:
0563: /**
0564: * This checks for a match column for
0565: * whether it exists or not.
0566: *
0567: * @param <code>CachedRowSet</code> object whose match column needs to be checked.
0568: * @throws SQLException if MatchColumn is not set.
0569: */
0570: private boolean checkforMatchColumn(Joinable rs)
0571: throws SQLException {
0572: int[] i = rs.getMatchColumnIndexes();
0573: if (i.length <= 0) {
0574: return false;
0575: }
0576: return true;
0577: }
0578:
0579: /**
0580: * Internal initialization of <code>JoinRowSet</code>.
0581: */
0582: private void initJOIN(CachedRowSet rowset) throws SQLException {
0583: try {
0584:
0585: CachedRowSetImpl cRowset = (CachedRowSetImpl) rowset;
0586: // Create a new CachedRowSet object local to this function.
0587: CachedRowSetImpl crsTemp = new CachedRowSetImpl();
0588: RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
0589:
0590: /* The following 'if block' seems to be always going true.
0591: commenting this out for present
0592:
0593: if (!supportedJOINs[1]) {
0594: throw new SQLException(resBundle.handleGetObject("joinrowsetimpl.notsupported").toString());
0595: }
0596:
0597: */
0598:
0599: if (vecRowSetsInJOIN.isEmpty()) {
0600:
0601: // implies first cRowset to be added to the Join
0602: // simply add this as a CachedRowSet.
0603: // Also add it to the class variable of type vector
0604: // do not need to check "type" of Join but it should be set.
0605: crsInternal = (CachedRowSetImpl) rowset.createCopy();
0606: crsInternal.setMetaData((RowSetMetaDataImpl) cRowset
0607: .getMetaData());
0608: // metadata will also set the MatchColumn.
0609:
0610: vecRowSetsInJOIN.add(cRowset);
0611:
0612: } else {
0613: // At this point we are ready to add another rowset to 'this' object
0614: // Check the size of vecJoinType and vecRowSetsInJoin
0615:
0616: // If nothing is being set, internally call setJoinType()
0617: // to set to JoinRowSet.INNER_JOIN.
0618:
0619: // For two rowsets one (valid) entry should be there in vecJoinType
0620: // For three rowsets two (valid) entries should be there in vecJoinType
0621:
0622: // Maintain vecRowSetsInJoin = vecJoinType + 1
0623:
0624: if ((vecRowSetsInJOIN.size() - vecJoinType.size()) == 2) {
0625: // we are going to add next rowset and setJoinType has not been set
0626: // recently, so set it to setJoinType() to JoinRowSet.INNER_JOIN.
0627: // the default join type
0628:
0629: setJoinType(JoinRowSet.INNER_JOIN);
0630: } else if ((vecRowSetsInJOIN.size() - vecJoinType
0631: .size()) == 1) {
0632: // do nothing setjoinType() has been set by programmer
0633: }
0634:
0635: // Add the table names to the class variable of type vector.
0636: vecTableNames.add(crsInternal.getTableName());
0637: vecTableNames.add(cRowset.getTableName());
0638: // Now we have two rowsets crsInternal and cRowset which need
0639: // to be INNER JOIN'ED to form a new rowset
0640: // Compare table1.MatchColumn1.value1 == { table2.MatchColumn2.value1
0641: // ... upto table2.MatchColumn2.valueN }
0642: // ...
0643: // Compare table1.MatchColumn1.valueM == { table2.MatchColumn2.value1
0644: // ... upto table2.MatchColumn2.valueN }
0645: //
0646: // Assuming first rowset has M rows and second N rows.
0647:
0648: int rowCount2 = cRowset.size();
0649: int rowCount1 = crsInternal.size();
0650:
0651: // total columns in the new CachedRowSet will be sum of both -1
0652: // (common column)
0653: int matchColumnCount = 0;
0654: for (int i = 0; i < crsInternal.getMatchColumnIndexes().length; i++) {
0655: if (crsInternal.getMatchColumnIndexes()[i] != -1)
0656: ++matchColumnCount;
0657: else
0658: break;
0659: }
0660:
0661: rsmd.setColumnCount(crsInternal.getMetaData()
0662: .getColumnCount()
0663: + cRowset.getMetaData().getColumnCount()
0664: - matchColumnCount);
0665:
0666: crsTemp.setMetaData(rsmd);
0667: crsInternal.beforeFirst();
0668: cRowset.beforeFirst();
0669: for (int i = 1; i <= rowCount1; i++) {
0670: if (crsInternal.isAfterLast()) {
0671: break;
0672: }
0673: if (crsInternal.next()) {
0674: cRowset.beforeFirst();
0675: for (int j = 1; j <= rowCount2; j++) {
0676: if (cRowset.isAfterLast()) {
0677: break;
0678: }
0679: if (cRowset.next()) {
0680: boolean match = true;
0681: for (int k = 0; k < matchColumnCount; k++) {
0682: if (!crsInternal
0683: .getObject(
0684: crsInternal
0685: .getMatchColumnIndexes()[k])
0686: .equals(
0687: cRowset
0688: .getObject(cRowset
0689: .getMatchColumnIndexes()[k]))) {
0690: match = false;
0691: break;
0692: }
0693: }
0694: if (match) {
0695:
0696: int p;
0697: int colc = 0; // reset this variable everytime you loop
0698: // re create a JoinRowSet in crsTemp object
0699: crsTemp.moveToInsertRow();
0700:
0701: // create a new rowset crsTemp with data from first rowset
0702: for (p = 1; p <= crsInternal
0703: .getMetaData()
0704: .getColumnCount(); p++) {
0705:
0706: match = false;
0707: for (int k = 0; k < matchColumnCount; k++) {
0708: if (p == crsInternal
0709: .getMatchColumnIndexes()[k]) {
0710: match = true;
0711: break;
0712: }
0713: }
0714: if (!match) {
0715:
0716: crsTemp
0717: .updateObject(
0718: ++colc,
0719: crsInternal
0720: .getObject(p));
0721: // column type also needs to be passed.
0722:
0723: rsmd
0724: .setColumnName(
0725: colc,
0726: crsInternal
0727: .getMetaData()
0728: .getColumnName(
0729: p));
0730: rsmd
0731: .setTableName(
0732: colc,
0733: crsInternal
0734: .getTableName());
0735:
0736: rsmd
0737: .setColumnType(
0738: p,
0739: crsInternal
0740: .getMetaData()
0741: .getColumnType(
0742: p));
0743: rsmd
0744: .setAutoIncrement(
0745: p,
0746: crsInternal
0747: .getMetaData()
0748: .isAutoIncrement(
0749: p));
0750: rsmd
0751: .setCaseSensitive(
0752: p,
0753: crsInternal
0754: .getMetaData()
0755: .isCaseSensitive(
0756: p));
0757: rsmd
0758: .setCatalogName(
0759: p,
0760: crsInternal
0761: .getMetaData()
0762: .getCatalogName(
0763: p));
0764: rsmd
0765: .setColumnDisplaySize(
0766: p,
0767: crsInternal
0768: .getMetaData()
0769: .getColumnDisplaySize(
0770: p));
0771: rsmd
0772: .setColumnLabel(
0773: p,
0774: crsInternal
0775: .getMetaData()
0776: .getColumnLabel(
0777: p));
0778: rsmd
0779: .setColumnType(
0780: p,
0781: crsInternal
0782: .getMetaData()
0783: .getColumnType(
0784: p));
0785: rsmd
0786: .setColumnTypeName(
0787: p,
0788: crsInternal
0789: .getMetaData()
0790: .getColumnTypeName(
0791: p));
0792: rsmd
0793: .setCurrency(
0794: p,
0795: crsInternal
0796: .getMetaData()
0797: .isCurrency(
0798: p));
0799: rsmd
0800: .setNullable(
0801: p,
0802: crsInternal
0803: .getMetaData()
0804: .isNullable(
0805: p));
0806: rsmd
0807: .setPrecision(
0808: p,
0809: crsInternal
0810: .getMetaData()
0811: .getPrecision(
0812: p));
0813: rsmd
0814: .setScale(
0815: p,
0816: crsInternal
0817: .getMetaData()
0818: .getScale(
0819: p));
0820: rsmd
0821: .setSchemaName(
0822: p,
0823: crsInternal
0824: .getMetaData()
0825: .getSchemaName(
0826: p));
0827: rsmd
0828: .setSearchable(
0829: p,
0830: crsInternal
0831: .getMetaData()
0832: .isSearchable(
0833: p));
0834: rsmd
0835: .setSigned(
0836: p,
0837: crsInternal
0838: .getMetaData()
0839: .isSigned(
0840: p));
0841:
0842: } else {
0843: // will happen only once, for that merged column pass
0844: // the types as OBJECT, if types not equal
0845:
0846: crsTemp
0847: .updateObject(
0848: ++colc,
0849: crsInternal
0850: .getObject(p));
0851:
0852: rsmd
0853: .setColumnName(
0854: colc,
0855: crsInternal
0856: .getMetaData()
0857: .getColumnName(
0858: p));
0859: rsmd
0860: .setTableName(
0861: colc,
0862: crsInternal
0863: .getTableName()
0864: + "#"
0865: + cRowset
0866: .getTableName());
0867:
0868: rsmd
0869: .setColumnType(
0870: p,
0871: crsInternal
0872: .getMetaData()
0873: .getColumnType(
0874: p));
0875: rsmd
0876: .setAutoIncrement(
0877: p,
0878: crsInternal
0879: .getMetaData()
0880: .isAutoIncrement(
0881: p));
0882: rsmd
0883: .setCaseSensitive(
0884: p,
0885: crsInternal
0886: .getMetaData()
0887: .isCaseSensitive(
0888: p));
0889: rsmd
0890: .setCatalogName(
0891: p,
0892: crsInternal
0893: .getMetaData()
0894: .getCatalogName(
0895: p));
0896: rsmd
0897: .setColumnDisplaySize(
0898: p,
0899: crsInternal
0900: .getMetaData()
0901: .getColumnDisplaySize(
0902: p));
0903: rsmd
0904: .setColumnLabel(
0905: p,
0906: crsInternal
0907: .getMetaData()
0908: .getColumnLabel(
0909: p));
0910: rsmd
0911: .setColumnType(
0912: p,
0913: crsInternal
0914: .getMetaData()
0915: .getColumnType(
0916: p));
0917: rsmd
0918: .setColumnTypeName(
0919: p,
0920: crsInternal
0921: .getMetaData()
0922: .getColumnTypeName(
0923: p));
0924: rsmd
0925: .setCurrency(
0926: p,
0927: crsInternal
0928: .getMetaData()
0929: .isCurrency(
0930: p));
0931: rsmd
0932: .setNullable(
0933: p,
0934: crsInternal
0935: .getMetaData()
0936: .isNullable(
0937: p));
0938: rsmd
0939: .setPrecision(
0940: p,
0941: crsInternal
0942: .getMetaData()
0943: .getPrecision(
0944: p));
0945: rsmd
0946: .setScale(
0947: p,
0948: crsInternal
0949: .getMetaData()
0950: .getScale(
0951: p));
0952: rsmd
0953: .setSchemaName(
0954: p,
0955: crsInternal
0956: .getMetaData()
0957: .getSchemaName(
0958: p));
0959: rsmd
0960: .setSearchable(
0961: p,
0962: crsInternal
0963: .getMetaData()
0964: .isSearchable(
0965: p));
0966: rsmd
0967: .setSigned(
0968: p,
0969: crsInternal
0970: .getMetaData()
0971: .isSigned(
0972: p));
0973:
0974: //don't do ++colc in the above statement
0975: } //end if
0976: } //end for
0977:
0978: // append the rowset crsTemp, with data from second rowset
0979: for (int q = 1; q <= cRowset
0980: .getMetaData()
0981: .getColumnCount(); q++) {
0982:
0983: match = false;
0984: for (int k = 0; k < matchColumnCount; k++) {
0985: if (q == cRowset
0986: .getMatchColumnIndexes()[k]) {
0987: match = true;
0988: break;
0989: }
0990: }
0991: if (!match) {
0992:
0993: crsTemp
0994: .updateObject(
0995: ++colc,
0996: cRowset
0997: .getObject(q));
0998:
0999: rsmd
1000: .setColumnName(
1001: colc,
1002: cRowset
1003: .getMetaData()
1004: .getColumnName(
1005: q));
1006: rsmd
1007: .setTableName(
1008: colc,
1009: cRowset
1010: .getTableName());
1011:
1012: /**
1013: * This will happen for a special case scenario. The value of 'p'
1014: * will always be one more than the number of columns in the first
1015: * rowset in the join. So, for a value of 'q' which is the number of
1016: * columns in the second rowset that participates in the join.
1017: * So decrement value of 'p' by 1 else `p+q-1` will be out of range.
1018: **/
1019:
1020: //if((p+q-1) > ((crsInternal.getMetaData().getColumnCount()) +
1021: // (cRowset.getMetaData().getColumnCount()) - 1)) {
1022: // --p;
1023: //}
1024: rsmd.setColumnType(p + q
1025: - 1, cRowset
1026: .getMetaData()
1027: .getColumnType(q));
1028: rsmd
1029: .setAutoIncrement(
1030: p + q - 1,
1031: cRowset
1032: .getMetaData()
1033: .isAutoIncrement(
1034: q));
1035: rsmd
1036: .setCaseSensitive(
1037: p + q - 1,
1038: cRowset
1039: .getMetaData()
1040: .isCaseSensitive(
1041: q));
1042: rsmd.setCatalogName(p + q
1043: - 1, cRowset
1044: .getMetaData()
1045: .getCatalogName(q));
1046: rsmd
1047: .setColumnDisplaySize(
1048: p + q - 1,
1049: cRowset
1050: .getMetaData()
1051: .getColumnDisplaySize(
1052: q));
1053: rsmd.setColumnLabel(p + q
1054: - 1, cRowset
1055: .getMetaData()
1056: .getColumnLabel(q));
1057: rsmd.setColumnType(p + q
1058: - 1, cRowset
1059: .getMetaData()
1060: .getColumnType(q));
1061: rsmd.setColumnTypeName(p
1062: + q - 1, cRowset
1063: .getMetaData()
1064: .getColumnTypeName(
1065: q));
1066: rsmd
1067: .setCurrency(
1068: p + q - 1,
1069: cRowset
1070: .getMetaData()
1071: .isCurrency(
1072: q));
1073: rsmd
1074: .setNullable(
1075: p + q - 1,
1076: cRowset
1077: .getMetaData()
1078: .isNullable(
1079: q));
1080: rsmd
1081: .setPrecision(
1082: p + q - 1,
1083: cRowset
1084: .getMetaData()
1085: .getPrecision(
1086: q));
1087: rsmd
1088: .setScale(
1089: p + q - 1,
1090: cRowset
1091: .getMetaData()
1092: .getScale(
1093: q));
1094: rsmd.setSchemaName(p + q
1095: - 1, cRowset
1096: .getMetaData()
1097: .getSchemaName(q));
1098: rsmd.setSearchable(p + q
1099: - 1, cRowset
1100: .getMetaData()
1101: .isSearchable(q));
1102: rsmd
1103: .setSigned(
1104: p + q - 1,
1105: cRowset
1106: .getMetaData()
1107: .isSigned(
1108: q));
1109: } else {
1110: --p;
1111: }
1112: }
1113: crsTemp.insertRow();
1114: crsTemp.moveToCurrentRow();
1115:
1116: } else {
1117: // since not equa12
1118: // so do nothing
1119: } //end if
1120: // bool1 = cRowset.next();
1121: }
1122:
1123: } // end inner for
1124: //bool2 = crsInternal.next();
1125: }
1126:
1127: } //end outer for
1128: crsTemp.setMetaData(rsmd);
1129: crsTemp.setOriginal();
1130:
1131: // Now the join is done.
1132: // Make crsInternal = crsTemp, to be ready for next merge, if at all.
1133:
1134: int[] pCol = new int[matchColumnCount];
1135: for (int i = 0; i < matchColumnCount; i++)
1136: pCol[i] = crsInternal.getMatchColumnIndexes()[i];
1137:
1138: crsInternal = (CachedRowSetImpl) crsTemp.createCopy();
1139:
1140: // Because we add the first rowset as crsInternal to the
1141: // merged rowset, so pCol will point to the Match column.
1142: // until reset, am not sure we should set this or not(?)
1143: // if this is not set next inner join won't happen
1144: // if we explicitly do not set a set MatchColumn of
1145: // the new crsInternal.
1146:
1147: crsInternal.setMatchColumn(pCol);
1148: // Add the merged rowset to the class variable of type vector.
1149: crsInternal.setMetaData(rsmd);
1150: vecRowSetsInJOIN.add(cRowset);
1151: } //end if
1152: } catch (SQLException sqle) {
1153: // %%% Exception should not dump here:
1154: sqle.printStackTrace();
1155: throw new SQLException(resBundle.handleGetObject(
1156: "joinrowsetimpl.initerror").toString()
1157: + sqle);
1158: } catch (Exception e) {
1159: e.printStackTrace();
1160: throw new SQLException(resBundle.handleGetObject(
1161: "joinrowsetimpl.genericerr").toString()
1162: + e);
1163: }
1164: }
1165:
1166: /**
1167: * Return a SQL-like description of the <code>WHERE</code> clause being used
1168: * in a <code>JoinRowSet</code> object instance. An implementation can describe
1169: * the <code>WHERE</code> clause of the SQL <code>JOIN</code> by supplying a <code>SQL</code>
1170: * strings description of <code>JOIN</code> or provide a textual description to assist
1171: * applications using a <code>JoinRowSet</code>.
1172: *
1173: * @return whereClause a textual or SQL descripition of the logical
1174: * <code>WHERE</code> cluase used in the <code>JoinRowSet</code> instance
1175: * @throws SQLException if an error occurs in generating a representation
1176: * of the <code>WHERE</code> clause.
1177: */
1178: public String getWhereClause() throws SQLException {
1179:
1180: String strWhereClause = "Select ";
1181: String whereClause;
1182: String tabName = null;
1183: String strTabName = null;
1184: int sz, cols;
1185: int j;
1186: CachedRowSetImpl crs;
1187:
1188: // get all the column(s) names from each rowset.
1189: // append them with their tablenames i.e. tableName.columnName
1190: // Select tableName1.columnName1,..., tableNameX.columnNameY
1191: // from tableName1,...tableNameX where
1192: // tableName1.(rowset1.getMatchColumnName()) ==
1193: // tableName2.(rowset2.getMatchColumnName()) + "and" +
1194: // tableNameX.(rowsetX.getMatchColumnName()) ==
1195: // tableNameZ.(rowsetZ.getMatchColumnName()));
1196:
1197: tabName = new String();
1198: strTabName = new String();
1199: sz = vecRowSetsInJOIN.size();
1200: for (int i = 0; i < sz; i++) {
1201: crs = (CachedRowSetImpl) vecRowSetsInJOIN.get(i);
1202: cols = crs.getMetaData().getColumnCount();
1203: tabName = tabName.concat(crs.getTableName());
1204: strTabName = strTabName.concat(tabName + ", ");
1205: j = 1;
1206: while (j < cols) {
1207:
1208: strWhereClause = strWhereClause.concat(tabName + "."
1209: + crs.getMetaData().getColumnName(j++));
1210: strWhereClause = strWhereClause.concat(", ");
1211: } //end while
1212: } //end for
1213:
1214: // now remove the last ","
1215: strWhereClause = strWhereClause.substring(0, strWhereClause
1216: .lastIndexOf(","));
1217:
1218: // Add from clause
1219: strWhereClause = strWhereClause.concat(" from ");
1220:
1221: // Add the table names.
1222: strWhereClause = strWhereClause.concat(strTabName);
1223:
1224: //Remove the last ","
1225: strWhereClause = strWhereClause.substring(0, strWhereClause
1226: .lastIndexOf(","));
1227:
1228: // Add the where clause
1229: strWhereClause = strWhereClause.concat(" where ");
1230:
1231: // Get the match columns
1232: // rowset1.getMatchColumnName() == rowset2.getMatchColumnName()
1233: for (int i = 0; i < sz; i++) {
1234: strWhereClause = strWhereClause
1235: .concat(((CachedRowSetImpl) vecRowSetsInJOIN.get(i))
1236: .getMatchColumnNames()[0]);
1237: if (i % 2 != 0) {
1238: strWhereClause = strWhereClause.concat("=");
1239: } else {
1240: strWhereClause = strWhereClause.concat(" and");
1241: }
1242: strWhereClause = strWhereClause.concat(" ");
1243: }
1244:
1245: return strWhereClause;
1246: }
1247:
1248: /**
1249: * Moves the cursor down one row from its current position and
1250: * returns <code>true</code> if the new cursor position is a
1251: * valid row.
1252: * The cursor for a new <code>ResultSet</code> object is initially
1253: * positioned before the first row. The first call to the method
1254: * <code>next</code> moves the cursor to the first row, making it
1255: * the current row; the second call makes the second row the
1256: * current row, and so on.
1257: *
1258: * <P>If an input stream from the previous row is open, it is
1259: * implicitly closed. The <code>ResultSet</code> object's warning
1260: * chain is cleared when a new row is read.
1261: *
1262: * @return <code>true</code> if the new current row is valid;
1263: * <code>false</code> if there are no more rows
1264: * @throws SQLException if an error occurs or
1265: * the cursor is not positioned in the rowset, before
1266: * the first row, or after the last row
1267: */
1268: public boolean next() throws SQLException {
1269: return crsInternal.next();
1270: }
1271:
1272: /**
1273: * Releases the current contents of this rowset, discarding outstanding
1274: * updates. The rowset contains no rows after the method
1275: * <code>release</code> is called. This method sends a
1276: * <code>RowSetChangedEvent</code> object to all registered listeners prior
1277: * to returning.
1278: *
1279: * @throws SQLException if an error occurs
1280: */
1281: public void close() throws SQLException {
1282: crsInternal.close();
1283: }
1284:
1285: /**
1286: * Reports whether the last column read was SQL <code>NULL</code>.
1287: * Note that you must first call the method <code>getXXX</code>
1288: * on a column to try to read its value and then call the method
1289: * <code>wasNull</code> to determine whether the value was
1290: * SQL <code>NULL</code>.
1291: *
1292: * @return <code>true</code> if the value in the last column read
1293: * was SQL <code>NULL</code>; <code>false</code> otherwise
1294: * @throws SQLException if an error occurs
1295: */
1296: public boolean wasNull() throws SQLException {
1297: return crsInternal.wasNull();
1298: }
1299:
1300: /**
1301: * Retrieves the value of the designated column in the current row
1302: * of this <code>JoinRowSetImpl</code> object as a
1303: * <code>String</code> object.
1304: *
1305: * @param columnIndex the first column is <code>1</code>, the second
1306: * is <code>2</code>, and so on; must be <code>1</code> or larger
1307: * and equal to or less than the number of columns in the rowset
1308: * @return the column value; if the value is SQL <code>NULL</code>, the
1309: * result is <code>null</code>
1310: * @throws SQLException if the given column index is out of bounds or
1311: * the cursor is not on a valid row
1312: */
1313: public String getString(int columnIndex) throws SQLException {
1314: return crsInternal.getString(columnIndex);
1315: }
1316:
1317: /**
1318: * Retrieves the value of the designated column in the current row
1319: * of this <code>JoinRowSetImpl</code> object as a
1320: * <code>boolean</code> value.
1321: *
1322: * @param columnIndex the first column is <code>1</code>, the second
1323: * is <code>2</code>, and so on; must be <code>1</code> or larger
1324: * and equal to or less than the number of columns in the rowset
1325: * @return the column value; if the value is SQL <code>NULL</code>, the
1326: * result is <code>false</code>
1327: * @throws SQLException if the given column index is out of bounds,
1328: * the cursor is not on a valid row, or this method fails
1329: */
1330: public boolean getBoolean(int columnIndex) throws SQLException {
1331: return crsInternal.getBoolean(columnIndex);
1332: }
1333:
1334: /**
1335: * Retrieves the value of the designated column in the current row
1336: * of this <code>JoinRowSetImpl</code> object as a
1337: * <code>byte</code> value.
1338: *
1339: * @param columnIndex the first column is <code>1</code>, the second
1340: * is <code>2</code>, and so on; must be <code>1</code> or larger
1341: * and equal to or less than the number of columns in the rowset
1342: * @return the column value; if the value is SQL <code>NULL</code>, the
1343: * result is <code>0</code>
1344: * @throws SQLException if the given column index is out of bounds,
1345: * the cursor is not on a valid row, or this method fails
1346: */
1347: public byte getByte(int columnIndex) throws SQLException {
1348: return crsInternal.getByte(columnIndex);
1349: }
1350:
1351: /**
1352: * Retrieves the value of the designated column in the current row
1353: * of this <code>JoinRowSetImpl</code> object as a
1354: * <code>short</code> value.
1355: *
1356: * @param columnIndex the first column is <code>1</code>, the second
1357: * is <code>2</code>, and so on; must be <code>1</code> or larger
1358: * and equal to or less than the number of columns in the rowset
1359: * @return the column value; if the value is SQL <code>NULL</code>, the
1360: * result is <code>0</code>
1361: * @throws SQLException if the given column index is out of bounds,
1362: * the cursor is not on a valid row, or this method fails
1363: */
1364: public short getShort(int columnIndex) throws SQLException {
1365: return crsInternal.getShort(columnIndex);
1366: }
1367:
1368: /**
1369: * Retrieves the value of the designated column in the current row
1370: * of this <code>JoinRowSetImpl</code> object as a
1371: * <code>short</code> value.
1372: *
1373: * @param columnIndex the first column is <code>1</code>, the second
1374: * is <code>2</code>, and so on; must be <code>1</code> or larger
1375: * and equal to or less than the number of columns in the rowset
1376: * @return the column value; if the value is SQL <code>NULL</code>, the
1377: * result is <code>0</code>
1378: * @throws SQLException if the given column index is out of bounds,
1379: * the cursor is not on a valid row, or this method fails
1380: */
1381: public int getInt(int columnIndex) throws SQLException {
1382: return crsInternal.getInt(columnIndex);
1383: }
1384:
1385: /**
1386: * Retrieves the value of the designated column in the current row
1387: * of this <code>JoinRowSetImpl</code> object as a
1388: * <code>long</code> value.
1389: *
1390: * @param columnIndex the first column is <code>1</code>, the second
1391: * is <code>2</code>, and so on; must be <code>1</code> or larger
1392: * and equal to or less than the number of columns in the rowset
1393: * @return the column value; if the value is SQL <code>NULL</code>, the
1394: * result is <code>0</code>
1395: * @throws SQLException if the given column index is out of bounds,
1396: * the cursor is not on a valid row, or this method fails
1397: */
1398: public long getLong(int columnIndex) throws SQLException {
1399: return crsInternal.getLong(columnIndex);
1400: }
1401:
1402: /**
1403: * Retrieves the value of the designated column in the current row
1404: * of this <code>JoinRowSetImpl</code> object as a
1405: * <code>float</code> value.
1406: *
1407: * @param columnIndex the first column is <code>1</code>, the second
1408: * is <code>2</code>, and so on; must be <code>1</code> or larger
1409: * and equal to or less than the number of columns in the rowset
1410: * @return the column value; if the value is SQL <code>NULL</code>, the
1411: * result is <code>0</code>
1412: * @throws SQLException if the given column index is out of bounds,
1413: * the cursor is not on a valid row, or this method fails
1414: */
1415: public float getFloat(int columnIndex) throws SQLException {
1416: return crsInternal.getFloat(columnIndex);
1417: }
1418:
1419: /**
1420: * Retrieves the value of the designated column in the current row
1421: * of this <code>JoinRowSetImpl</code> object as a
1422: * <code>double</code> value.
1423: *
1424: * @param columnIndex the first column is <code>1</code>, the second
1425: * is <code>2</code>, and so on; must be <code>1</code> or larger
1426: * and equal to or less than the number of columns in the rowset
1427: * @return the column value; if the value is SQL <code>NULL</code>, the
1428: * result is <code>0</code>
1429: * @throws SQLException if the given column index is out of bounds,
1430: * the cursor is not on a valid row, or this method fails
1431: */
1432: public double getDouble(int columnIndex) throws SQLException {
1433: return crsInternal.getDouble(columnIndex);
1434: }
1435:
1436: /**
1437: * Retrieves the value of the designated column in the current row
1438: * of this <code>JoinRowSetImpl</code> object as a
1439: * <code>java.math.BigDecimal</code> object.
1440: * <P>
1441: * This method is deprecated; use the version of <code>getBigDecimal</code>
1442: * that does not take a scale parameter and returns a value with full
1443: * precision.
1444: *
1445: * @param columnIndex the first column is <code>1</code>, the second
1446: * is <code>2</code>, and so on; must be <code>1</code> or larger
1447: * and equal to or less than the number of columns in the rowset
1448: * @param scale the number of digits to the right of the decimal point in the
1449: * value returned
1450: * @return the column value with the specified number of digits to the right
1451: * of the decimal point; if the value is SQL <code>NULL</code>, the
1452: * result is <code>null</code>
1453: * @throws SQLException if the given column index is out of bounds,
1454: * the cursor is not on a valid row, or this method fails
1455: * @deprecated
1456: */
1457: public BigDecimal getBigDecimal(int columnIndex, int scale)
1458: throws SQLException {
1459: return crsInternal.getBigDecimal(columnIndex);
1460: }
1461:
1462: /**
1463: * Retrieves the value of the designated column in the current row
1464: * of this <code>JoinRowSetImpl</code> object as a
1465: * <code>byte array</code> value.
1466: *
1467: * @param columnIndex the first column is <code>1</code>, the second
1468: * is <code>2</code>, and so on; must be <code>1</code> or larger
1469: * and equal to or less than the number of columns in the rowset
1470: * @return the column value; if the value is SQL <code>NULL</code>, the
1471: * result is <code>null</code>
1472: * @throws SQLException if the given column index is out of bounds,
1473: * the cursor is not on a valid row, or the the value to be
1474: * retrieved is not binary
1475: */
1476: public byte[] getBytes(int columnIndex) throws SQLException {
1477: return crsInternal.getBytes(columnIndex);
1478: }
1479:
1480: /**
1481: * Retrieves the value of the designated column in the current row
1482: * of this <code>JoinRowSetImpl</code> object as a
1483: * <code>java.sql.Date</code> object.
1484: *
1485: * @param columnIndex the first column is <code>1</code>, the second
1486: * is <code>2</code>, and so on; must be <code>1</code> or larger
1487: * and equal to or less than the number of columns in the rowset
1488: * @return the column value; if the value is SQL <code>NULL</code>, the
1489: * result is <code>null</code>
1490: * @throws SQLException if the given column index is out of bounds,
1491: * the cursor is not on a valid row, or this method fails
1492: */
1493: public java.sql.Date getDate(int columnIndex) throws SQLException {
1494: return crsInternal.getDate(columnIndex);
1495: }
1496:
1497: /**
1498: * Retrieves the value of the designated column in the current row
1499: * of this <code>JoinRowSetImpl</code> object as a
1500: * <code>java.sql.Time</code> object.
1501: *
1502: * @param columnIndex the first column is <code>1</code>, the second
1503: * is <code>2</code>, and so on; must be <code>1</code> or larger
1504: * and equal to or less than the number of columns in the rowset
1505: * @return the column value; if the value is SQL <code>NULL</code>, the
1506: * result is <code>null</code>
1507: * @throws SQLException if the given column index is out of bounds,
1508: * the cursor is not on a valid row, or this method fails
1509: */
1510: public java.sql.Time getTime(int columnIndex) throws SQLException {
1511: return crsInternal.getTime(columnIndex);
1512: }
1513:
1514: /**
1515: * Retrieves the value of the designated column in the current row
1516: * of this <code>JoinRowSetImpl</code> object as a
1517: * <code>java.sql.Timestamp</code> object.
1518: *
1519: * @param columnIndex the first column is <code>1</code>, the second
1520: * is <code>2</code>, and so on; must be <code>1</code> or larger
1521: * and equal to or less than the number of columns in the rowset
1522: * @return the column value; if the value is SQL <code>NULL</code>, the
1523: * result is <code>null</code>
1524: * @throws SQLException if the given column index is out of bounds,
1525: * the cursor is not on a valid row, or this method fails
1526: */
1527: public java.sql.Timestamp getTimestamp(int columnIndex)
1528: throws SQLException {
1529: return crsInternal.getTimestamp(columnIndex);
1530: }
1531:
1532: /**
1533: * Retrieves the value of the designated column in the current row
1534: * of this <code>JoinRowSetImpl</code> object as a
1535: * <code>java.sql.Timestamp</code> object.
1536: *
1537: * @param columnIndex the first column is <code>1</code>, the second
1538: * is <code>2</code>, and so on; must be <code>1</code> or larger
1539: * and equal to or less than the number of columns in the rowset
1540: * @return the column value; if the value is SQL <code>NULL</code>, the
1541: * result is <code>null</code>
1542: * @throws SQLException if the given column index is out of bounds,
1543: * the cursor is not on a valid row, or this method fails
1544: */
1545: public java.io.InputStream getAsciiStream(int columnIndex)
1546: throws SQLException {
1547: return crsInternal.getAsciiStream(columnIndex);
1548: }
1549:
1550: /**
1551: * A column value can be retrieved as a stream of Unicode characters
1552: * and then read in chunks from the stream. This method is particularly
1553: * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
1554: * do any necessary conversion from the database format into Unicode.
1555: *
1556: * <P><B>Note:</B> All the data in the returned stream must be
1557: * read prior to getting the value of any other column. The next
1558: * call to a get method implicitly closes the stream. . Also, a
1559: * stream may return 0 for available() whether there is data
1560: * available or not.
1561: *
1562: * @param columnIndex the first column is <code>1</code>, the second
1563: * is <code>2</code>, and so on; must be <code>1</code> or larger
1564: * and equal to or less than the number of columns in this rowset
1565: * @return a Java input stream that delivers the database column value
1566: * as a stream of two byte Unicode characters. If the value is SQL NULL
1567: * then the result is null.
1568: * @throws SQLException if an error occurs
1569: * @deprecated
1570: */
1571: public java.io.InputStream getUnicodeStream(int columnIndex)
1572: throws SQLException {
1573: return crsInternal.getUnicodeStream(columnIndex);
1574: }
1575:
1576: /**
1577: * A column value can be retrieved as a stream of uninterpreted bytes
1578: * and then read in chunks from the stream. This method is particularly
1579: * suitable for retrieving large LONGVARBINARY values.
1580: *
1581: * <P><B>Note:</B> All the data in the returned stream must be
1582: * read prior to getting the value of any other column. The next
1583: * call to a get method implicitly closes the stream. Also, a
1584: * stream may return 0 for available() whether there is data
1585: * available or not.
1586: *
1587: * @param columnIndex the first column is <code>1</code>, the second
1588: * is <code>2</code>, and so on; must be <code>1</code> or larger
1589: * and equal to or less than the number of columns in the rowset
1590: * @return a Java input stream that delivers the database column value
1591: * as a stream of uninterpreted bytes. If the value is SQL NULL
1592: * then the result is null.
1593: * @throws SQLException if an error occurs
1594: */
1595: public java.io.InputStream getBinaryStream(int columnIndex)
1596: throws SQLException {
1597: return crsInternal.getBinaryStream(columnIndex);
1598: }
1599:
1600: // ColumnName methods
1601:
1602: /**
1603: * Retrieves the value stored in the designated column
1604: * of the current row as a <code>String</code> object.
1605: *
1606: * @param columnName a <code>String</code> object giving the SQL name of
1607: * a column in this <code>JoinRowSetImpl</code> object
1608: * @return the column value; if the value is SQL <code>NULL</code>,
1609: * the result is <code>null</code>
1610: * @throws SQLException if the given column name does not match one of
1611: * this rowset's column names or the cursor is not on one of
1612: * this rowset's rows or its insert row
1613: */
1614: public String getString(String columnName) throws SQLException {
1615: return crsInternal.getString(columnName);
1616: }
1617:
1618: /**
1619: * Retrieves the value stored in the designated column
1620: * of the current row as a <code>boolean</code> value.
1621: *
1622: * @param columnName a <code>String</code> object giving the SQL name of
1623: * a column in this <code>JoinRowSetImpl</code> object
1624: * @return the column value; if the value is SQL <code>NULL</code>,
1625: * the result is <code>false</code>
1626: * @throws SQLException if the given column name does not match one of
1627: * this rowset's column names or the cursor is not on one of
1628: * this rowset's rows or its insert row
1629: */
1630: public boolean getBoolean(String columnName) throws SQLException {
1631: return crsInternal.getBoolean(columnName);
1632: }
1633:
1634: /**
1635: * Retrieves the value stored in the designated column
1636: * of the current row as a <code>byte</code> value.
1637: *
1638: * @param columnName a <code>String</code> object giving the SQL name of
1639: * a column in this <code>JoinRowSetImpl</code> object
1640: * @return the column value; if the value is SQL <code>NULL</code>,
1641: * the result is <code>0</code>
1642: * @throws SQLException if the given column name does not match one of
1643: * this rowset's column names or the cursor is not on one of
1644: * this rowset's rows or its insert row
1645: */
1646: public byte getByte(String columnName) throws SQLException {
1647: return crsInternal.getByte(columnName);
1648: }
1649:
1650: /**
1651: * Retrieves the value stored in the designated column
1652: * of the current row as a <code>short</code> value.
1653: *
1654: * @param columnName a <code>String</code> object giving the SQL name of
1655: * a column in this <code>JoinRowSetImpl</code> object
1656: * @return the column value; if the value is SQL <code>NULL</code>,
1657: * the result is <code>0</code>
1658: * @throws SQLException if the given column name does not match one of
1659: * this rowset's column names or the cursor is not on one of
1660: * this rowset's rows or its insert row
1661: */
1662: public short getShort(String columnName) throws SQLException {
1663: return crsInternal.getShort(columnName);
1664: }
1665:
1666: /**
1667: * Retrieves the value stored in the designated column
1668: * of the current row as an <code>int</code> value.
1669: *
1670: * @param columnName a <code>String</code> object giving the SQL name of
1671: * a column in this <code>JoinRowSetImpl</code> object
1672: * @return the column value; if the value is SQL <code>NULL</code>,
1673: * the result is <code>0</code>
1674: * @throws SQLException if the given column name does not match one of
1675: * this rowset's column names or the cursor is not on one of
1676: * this rowset's rows or its insert row
1677: */
1678: public int getInt(String columnName) throws SQLException {
1679: return crsInternal.getInt(columnName);
1680: }
1681:
1682: /**
1683: * Retrieves the value stored in the designated column
1684: * of the current row as a <code>long</code> value.
1685: *
1686: * @param columnName a <code>String</code> object giving the SQL name of
1687: * a column in this <code>JoinRowSetImpl</code> object
1688: * @return the column value; if the value is SQL <code>NULL</code>,
1689: * the result is <code>0</code>
1690: * @throws SQLException if the given column name does not match one of
1691: * this rowset's column names or the cursor is not on one of
1692: * this rowset's rows or its insert row
1693: */
1694: public long getLong(String columnName) throws SQLException {
1695: return crsInternal.getLong(columnName);
1696: }
1697:
1698: /**
1699: * Retrieves the value stored in the designated column
1700: * of the current row as a <code>float</code> value.
1701: *
1702: * @param columnName a <code>String</code> object giving the SQL name of
1703: * a column in this <code>JoinRowSetImpl</code> object
1704: * @return the column value; if the value is SQL <code>NULL</code>,
1705: * the result is <code>0</code>
1706: * @throws SQLException if the given column name does not match one of
1707: * this rowset's column names or the cursor is not on one of
1708: * this rowset's rows or its insert row
1709: */
1710: public float getFloat(String columnName) throws SQLException {
1711: return crsInternal.getFloat(columnName);
1712: }
1713:
1714: /**
1715: * Retrieves the value stored in the designated column
1716: * of the current row as a <code>double</code> value.
1717: *
1718: * @param columnName a <code>String</code> object giving the SQL name of
1719: * a column in this <code>JoinRowSetImpl</code> object
1720: * @return the column value; if the value is SQL <code>NULL</code>,
1721: * the result is <code>0</code>
1722: * @throws SQLException if the given column name does not match one of
1723: * this rowset's column names or the cursor is not on one of
1724: * this rowset's rows or its insert row
1725: */
1726: public double getDouble(String columnName) throws SQLException {
1727: return crsInternal.getDouble(columnName);
1728: }
1729:
1730: /**
1731: * Retrieves the value stored in the designated column
1732: * of the current row as a <code>java.math.BigDecimal</code> object.
1733: *
1734: * @param columnName a <code>String</code> object giving the SQL name of
1735: * a column in this <code>JoinRowSetImpl</code> object
1736: * @param scale the number of digits to the right of the decimal point
1737: * @return the column value; if the value is SQL <code>NULL</code>,
1738: * the result is <code>null</code>
1739: * @throws SQLException if the given column name does not match one of
1740: * this rowset's column names or the cursor is not on one of
1741: * this rowset's rows or its insert row
1742: * @deprecated use the method <code>getBigDecimal(String columnName)</code>
1743: * instead
1744: */
1745: public BigDecimal getBigDecimal(String columnName, int scale)
1746: throws SQLException {
1747: return crsInternal.getBigDecimal(columnName);
1748: }
1749:
1750: /**
1751: * Retrieves the value stored in the designated column
1752: * of the current row as a byte array.
1753: * The bytes represent the raw values returned by the driver.
1754: *
1755: * @param columnName a <code>String</code> object giving the SQL name of
1756: * a column in this <code>JoinRowSetImpl</code> object
1757: * @return the column value; if the value is SQL <code>NULL</code>,
1758: * the result is <code>null</code>
1759: * @throws SQLException if the given column name does not match one of
1760: * this rowset's column names or the cursor is not on one of
1761: * this rowset's rows or its insert row
1762: */
1763: public byte[] getBytes(String columnName) throws SQLException {
1764: return crsInternal.getBytes(columnName);
1765: }
1766:
1767: /**
1768: * Retrieves the value stored in the designated column
1769: * of the current row as a <code>java.sql.Date</code> object.
1770: *
1771: * @param columnName a <code>String</code> object giving the SQL name of
1772: * a column in this <code>JoinRowSetImpl</code> object
1773: * @return the column value; if the value is SQL <code>NULL</code>,
1774: * the result is <code>null</code>
1775: * @throws SQLException if the given column name does not match one of
1776: * this rowset's column names or the cursor is not on one of
1777: * this rowset's rows or its insert row
1778: */
1779: public java.sql.Date getDate(String columnName) throws SQLException {
1780: return crsInternal.getDate(columnName);
1781: }
1782:
1783: /**
1784: * Retrieves the value stored in the designated column
1785: * of the current row as a <code>java.sql.Time</code> object.
1786: *
1787: * @param columnName a <code>String</code> object giving the SQL name of
1788: * a column in this <code>JoinRowSetImpl</code> object
1789: * @return the column value; if the value is SQL <code>NULL</code>,
1790: * the result is <code>null</code>
1791: * @throws SQLException if the given column name does not match one of
1792: * this rowset's column names or the cursor is not on one of
1793: * this rowset's rows or its insert row
1794: */
1795: public java.sql.Time getTime(String columnName) throws SQLException {
1796: return crsInternal.getTime(columnName);
1797: }
1798:
1799: /**
1800: * Retrieves the value stored in the designated column
1801: * of the current row as a <code>java.sql.Timestamp</code> object.
1802: *
1803: * @param columnName a <code>String</code> object giving the SQL name of
1804: * a column in this <code>JoinRowSetImpl</code> object
1805: * @return the column value; if the value is SQL <code>NULL</code>,
1806: * the result is <code>null</code>
1807: * @throws SQLException if the given column name does not match one of
1808: * this rowset's column names or the cursor is not on one of
1809: * this rowset's rows or its insert row
1810: */
1811: public java.sql.Timestamp getTimestamp(String columnName)
1812: throws SQLException {
1813: return crsInternal.getTimestamp(columnName);
1814: }
1815:
1816: /**
1817: * This method is not supported, and it will throw an
1818: * <code>UnsupportedOperationException</code> if it is called.
1819: * <P>
1820: * A column value can be retrieved as a stream of ASCII characters
1821: * and then read in chunks from the stream. This method is particularly
1822: * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
1823: * do any necessary conversion from the database format into ASCII format.
1824: *
1825: * <P><B>Note:</B> All the data in the returned stream must
1826: * be read prior to getting the value of any other column. The
1827: * next call to a <code>getXXX</code> method implicitly closes the stream.
1828: *
1829: * @param columnName a <code>String</code> object giving the SQL name of
1830: * a column in this <code>JoinRowSetImpl</code> object
1831: * @return a Java input stream that delivers the database column value
1832: * as a stream of one-byte ASCII characters. If the value is SQL
1833: * <code>NULL</code>, the result is <code>null</code>.
1834: * @throws UnsupportedOperationException if this method is called
1835: */
1836: public java.io.InputStream getAsciiStream(String columnName)
1837: throws SQLException {
1838: return crsInternal.getAsciiStream(columnName);
1839: }
1840:
1841: /**
1842: * Retrieves the value stored in the designated column
1843: * of the current row as a <code>java.io.InputStream</code> object.
1844: * A column value can be retrieved as a stream of Unicode characters
1845: * and then read in chunks from the stream. This method is particularly
1846: * suitable for retrieving large <code>LONGVARCHAR</code> values.
1847: * The JDBC driver will do any necessary conversion from the database
1848: * format into Unicode.
1849: *
1850: * <P><B>Note:</B> All the data in the returned stream must
1851: * be read prior to getting the value of any other column. The
1852: * next call to a <code>getXXX</code> method implicitly closes the stream.
1853: *
1854: * @param columnName a <code>String</code> object giving the SQL name of
1855: * a column in this <code>JoinRowSetImpl</code> object
1856: * @return a Java input stream that delivers the database column value
1857: * as a stream of two-byte Unicode characters. If the value is
1858: * SQL <code>NULL</code>, the result is <code>null</code>.
1859: * @throws SQLException if the given column name does not match one of
1860: * this rowset's column names or the cursor is not on one of
1861: * this rowset's rows or its insert row
1862: * @deprecated use the method <code>getCharacterStream</code> instead
1863: */
1864: public java.io.InputStream getUnicodeStream(String columnName)
1865: throws SQLException {
1866: return crsInternal.getUnicodeStream(columnName);
1867: }
1868:
1869: /**
1870: * Retrieves the value stored in the designated column
1871: * of the current row as a <code>java.io.InputStream</code> object.
1872: * A column value can be retrieved as a stream of uninterpreted bytes
1873: * and then read in chunks from the stream. This method is particularly
1874: * suitable for retrieving large <code>LONGVARBINARY</code> values.
1875: *
1876: * <P><B>Note:</B> All the data in the returned stream must
1877: * be read prior to getting the value of any other column. The
1878: * next call to a get method implicitly closes the stream.
1879: *
1880: * @param columnName a <code>String</code> object giving the SQL name of
1881: * a column in this <code>JoinRowSetImpl</code> object
1882: * @return a Java input stream that delivers the database column value
1883: * as a stream of uninterpreted bytes. If the value is SQL
1884: * <code>NULL</code>, the result is <code>null</code>.
1885: * @throws SQLException if the given column name does not match one of
1886: * this rowset's column names or the cursor is not on one of
1887: * this rowset's rows or its insert row
1888: */
1889: public java.io.InputStream getBinaryStream(String columnName)
1890: throws SQLException {
1891: return crsInternal.getBinaryStream(columnName);
1892: }
1893:
1894: /* The first warning reported by calls on this <code>JoinRowSetImpl</code>
1895: * object is returned. Subsequent <code>JoinRowSetImpl</code> warnings will
1896: * be chained to this <code>SQLWarning</code>.
1897: *
1898: * <P>The warning chain is automatically cleared each time a new
1899: * row is read.
1900: *
1901: * <P><B>Note:</B> This warning chain only covers warnings caused
1902: * by <code>ResultSet</code> methods. Any warning caused by statement
1903: * methods (such as reading OUT parameters) will be chained on the
1904: * <code>Statement</code> object.
1905: *
1906: * @return the first SQLWarning or null
1907: * @throws UnsupportedOperationException if this method is called
1908: */
1909: public SQLWarning getWarnings() {
1910: return crsInternal.getWarnings();
1911: }
1912:
1913: /**
1914: * Throws an <code>UnsupportedOperationException</code> if called.
1915: * <P>
1916: * After a call to this method, the <code>getWarnings</code> method
1917: * returns <code>null</code> until a new warning is reported for this
1918: * <code>JoinRowSetImpl</code> object.
1919: *
1920: * @throws UnsupportedOperationException if this method is called
1921: */
1922: public void clearWarnings() {
1923: crsInternal.clearWarnings();
1924: }
1925:
1926: /**
1927: * Retrieves the name of the SQL cursor used by this
1928: * <code>JoinRowSetImpl</code> object.
1929: *
1930: * <P>In SQL, a result table is retrieved through a cursor that is
1931: * named. The current row of a result can be updated or deleted
1932: * using a positioned update/delete statement that references the
1933: * cursor name. To insure that the cursor has the proper isolation
1934: * level to support an update operation, the cursor's <code>SELECT</code>
1935: * statement should be of the form 'select for update'. If the 'for update'
1936: * clause is omitted, positioned updates may fail.
1937: *
1938: * <P>JDBC supports this SQL feature by providing the name of the
1939: * SQL cursor used by a <code>ResultSet</code> object. The current row
1940: * of a result set is also the current row of this SQL cursor.
1941: *
1942: * <P><B>Note:</B> If positioned updates are not supported, an
1943: * <code>SQLException</code> is thrown.
1944: *
1945: * @return the SQL cursor name for this <code>JoinRowSetImpl</code> object's
1946: * cursor
1947: * @throws SQLException if an error occurs
1948: */
1949: public String getCursorName() throws SQLException {
1950: return crsInternal.getCursorName();
1951: }
1952:
1953: /**
1954: * Retrieves the <code>ResultSetMetaData</code> object that contains
1955: * information about this <code>CachedRowsSet</code> object. The
1956: * information includes the number of columns, the data type for each
1957: * column, and other properties for each column.
1958: *
1959: * @return the <code>ResultSetMetaData</code> object that describes this
1960: * <code>JoinRowSetImpl</code> object's columns
1961: * @throws SQLException if an error occurs
1962: */
1963: public ResultSetMetaData getMetaData() throws SQLException {
1964: return crsInternal.getMetaData();
1965: }
1966:
1967: /**
1968: * Retrieves the value of the designated column in the current row
1969: * of this <code>JoinRowSetImpl</code> object as an
1970: * <code>Object</code> value.
1971: * <P>
1972: * The type of the <code>Object</code> will be the default
1973: * Java object type corresponding to the column's SQL type,
1974: * following the mapping for built-in types specified in the JDBC
1975: * specification.
1976: * <P>
1977: * This method may also be used to read datatabase-specific
1978: * abstract data types.
1979: * <P>
1980: * This implementation of the method <code>getObject</code> extends its
1981: * behavior so that it gets the attributes of an SQL structured type as
1982: * as an array of <code>Object</code> values. This method also custom
1983: * maps SQL user-defined types to classes in the Java programming language.
1984: * When the specified column contains
1985: * a structured or distinct value, the behavior of this method is as
1986: * if it were a call to the method <code>getObject(columnIndex,
1987: * this.getStatement().getConnection().getTypeMap())</code>.
1988: *
1989: * @param columnIndex the first column is <code>1</code>, the second
1990: * is <code>2</code>, and so on; must be <code>1</code> or larger
1991: * and equal to or less than the number of columns in the rowset
1992: * @return a <code>java.lang.Object</code> holding the column value;
1993: * if the value is SQL <code>NULL</code>, the result is <code>null</code>
1994: * @throws SQLException if the given column index is out of bounds,
1995: * the cursor is not on a valid row, or there is a problem getting
1996: * the <code>Class</code> object for a custom mapping
1997: * @since 1.2
1998: */
1999: public Object getObject(int columnIndex) throws SQLException {
2000: return crsInternal.getObject(columnIndex);
2001: }
2002:
2003: /**
2004: * Retrieves the value of the designated column in the current row
2005: * of this <code>JoinRowSetImpl</code> object as an
2006: * <code>Object</code> value.
2007: * <P>
2008: * The type of the <code>Object</code> will be the default
2009: * Java object type corresponding to the column's SQL type,
2010: * following the mapping for built-in types specified in the JDBC
2011: * specification.
2012: * <P>
2013: * This method may also be used to read datatabase-specific
2014: * abstract data types.
2015: * <P>
2016: * This implementation of the method <code>getObject</code> extends its
2017: * behavior so that it gets the attributes of an SQL structured type as
2018: * as an array of <code>Object</code> values. This method also custom
2019: * maps SQL user-defined types to classes
2020: * in the Java programming language. When the specified column contains
2021: * a structured or distinct value, the behavior of this method is as
2022: * if it were a call to the method <code>getObject(columnIndex,
2023: * this.getStatement().getConnection().getTypeMap())</code>.
2024: *
2025: * @param columnIndex the first column is <code>1</code>, the second
2026: * is <code>2</code>, and so on; must be <code>1</code> or larger
2027: * and equal to or less than the number of columns in the rowset
2028: * @param map a <code>java.util.Map</code> object showing the mapping
2029: * from SQL type names to classes in the Java programming
2030: * language
2031: * @return a <code>java.lang.Object</code> holding the column value;
2032: * if the value is SQL <code>NULL</code>, the result is
2033: * <code>null</code>
2034: * @throws SQLException if (1) the given column name does not match
2035: * one of this rowset's column names, (2) the cursor is not
2036: * on a valid row, or (3) there is a problem getting
2037: * the <code>Class</code> object for a custom mapping
2038: */
2039: public Object getObject(int columnIndex,
2040: java.util.Map<String, Class<?>> map) throws SQLException {
2041: return crsInternal.getObject(columnIndex, map);
2042: }
2043:
2044: /**
2045: * Retrieves the value of the designated column in the current row
2046: * of this <code>JoinRowSetImpl</code> object as an
2047: * <code>Object</code> value.
2048: * <P>
2049: * The type of the <code>Object</code> will be the default
2050: * Java object type corresponding to the column's SQL type,
2051: * following the mapping for built-in types specified in the JDBC
2052: * specification.
2053: * <P>
2054: * This method may also be used to read datatabase-specific
2055: * abstract data types.
2056: * <P>
2057: * This implementation of the method <code>getObject</code> extends its
2058: * behavior so that it gets the attributes of an SQL structured type as
2059: * as an array of <code>Object</code> values. This method also custom
2060: * maps SQL user-defined types to classes
2061: * in the Java programming language. When the specified column contains
2062: * a structured or distinct value, the behavior of this method is as
2063: * if it were a call to the method <code>getObject(columnIndex,
2064: * this.getStatement().getConnection().getTypeMap())</code>.
2065: *
2066: * @param columnName a <code>String</code> object that must match the
2067: * SQL name of a column in this rowset, ignoring case
2068: * @return a <code>java.lang.Object</code> holding the column value;
2069: * if the value is SQL <code>NULL</code>, the result is
2070: * <code>null</code>
2071: * @throws SQLException if (1) the given column name does not match
2072: * one of this rowset's column names, (2) the cursor is not
2073: * on a valid row, or (3) there is a problem getting
2074: * the <code>Class</code> object for a custom mapping
2075: */
2076: public Object getObject(String columnName) throws SQLException {
2077: return crsInternal.getObject(columnName);
2078: }
2079:
2080: /**
2081: * Retrieves the value of the designated column in this
2082: * <code>JoinRowSetImpl</code> object as an <code>Object</code> in
2083: * the Java programming lanugage, using the given
2084: * <code>java.util.Map</code> object to custom map the value if
2085: * appropriate.
2086: *
2087: * @param columnName a <code>String</code> object that must match the
2088: * SQL name of a column in this rowset, ignoring case
2089: * @param map a <code>java.util.Map</code> object showing the mapping
2090: * from SQL type names to classes in the Java programming
2091: * language
2092: * @return an <code>Object</code> representing the SQL value
2093: * @throws SQLException if the given column index is out of bounds or
2094: * the cursor is not on one of this rowset's rows or its
2095: * insert row
2096: */
2097: public Object getObject(String columnName,
2098: java.util.Map<String, Class<?>> map) throws SQLException {
2099: return crsInternal.getObject(columnName, map);
2100: }
2101:
2102: /**
2103: * Retrieves the value stored in the designated column
2104: * of the current row as a <code>java.io.Reader</code> object.
2105: *
2106: * <P><B>Note:</B> All the data in the returned stream must
2107: * be read prior to getting the value of any other column. The
2108: * next call to a <code>getXXX</code> method implicitly closes the stream.
2109: *
2110: * @param columnIndex the first column is <code>1</code>, the second
2111: * is <code>2</code>, and so on; must be <code>1</code> or larger
2112: * and equal to or less than the number of columns in the rowset
2113: * @return a Java character stream that delivers the database column value
2114: * as a <code>java.io.Reader</code> object. If the value is
2115: * SQL <code>NULL</code>, the result is <code>null</code>.
2116: * @throws SQLException if the given column index is out of bounds,
2117: * the cursor is not on a valid row, or there is a type mismatch
2118: */
2119: public java.io.Reader getCharacterStream(int columnIndex)
2120: throws SQLException {
2121: return crsInternal.getCharacterStream(columnIndex);
2122: }
2123:
2124: /**
2125: * Retrieves the value stored in the designated column
2126: * of the current row as a <code>java.io.Reader</code> object.
2127: *
2128: * <P><B>Note:</B> All the data in the returned stream must
2129: * be read prior to getting the value of any other column. The
2130: * next call to a <code>getXXX</code> method implicitly closes the stream.
2131: *
2132: * @param columnName a <code>String</code> object giving the SQL name of
2133: * a column in this <code>JoinRowSetImpl</code> object
2134: * @return a Java input stream that delivers the database column value
2135: * as a stream of two-byte Unicode characters. If the value is
2136: * SQL <code>NULL</code>, the result is <code>null</code>.
2137: * @throws SQLException if the given column index is out of bounds,
2138: * the cursor is not on a valid row, or there is a type mismatch
2139: */
2140: public java.io.Reader getCharacterStream(String columnName)
2141: throws SQLException {
2142: return crsInternal.getCharacterStream(columnName);
2143: }
2144:
2145: /**
2146: * Retrieves the value of the designated column in the current row
2147: * of this <code>JoinRowSetImpl</code> object as a
2148: * <code>java.math.BigDecimal</code> object.
2149: *
2150: * @param columnIndex the first column is <code>1</code>, the second
2151: * is <code>2</code>, and so on; must be <code>1</code> or larger
2152: * and equal to or less than the number of columns in the rowset
2153: * @return a <code>java.math.BigDecimal</code> value with full precision;
2154: * if the value is SQL <code>NULL</code>, the result is <code>null</code>
2155: * @throws SQLException if the given column index is out of bounds,
2156: * the cursor is not on a valid row, or this method fails
2157: */
2158: public BigDecimal getBigDecimal(int columnIndex)
2159: throws SQLException {
2160: return crsInternal.getBigDecimal(columnIndex);
2161: }
2162:
2163: /**
2164: * Retrieves the value of the designated column in the current row
2165: * of this <code>JoinRowSetImpl</code> object as a
2166: * <code>java.math.BigDecimal</code> object.
2167: *
2168: * @param columnName a <code>String</code> object that must match the
2169: * SQL name of a column in this rowset, ignoring case
2170: * @return a <code>java.math.BigDecimal</code> value with full precision;
2171: * if the value is SQL <code>NULL</code>, the result is <code>null</code>
2172: * @throws SQLException if the given column index is out of bounds,
2173: * the cursor is not on a valid row, or this method fails
2174: */
2175: public BigDecimal getBigDecimal(String columnName)
2176: throws SQLException {
2177: return crsInternal.getBigDecimal(columnName);
2178: }
2179:
2180: /**
2181: * Returns the number of rows in this <code>JoinRowSetImpl</code> object.
2182: *
2183: * @return number of rows in the rowset
2184: */
2185: public int size() {
2186: return crsInternal.size();
2187: }
2188:
2189: /**
2190: * Indicates whether the cursor is before the first row in this
2191: * <code>JoinRowSetImpl</code> object.
2192: *
2193: * @return <code>true</code> if the cursor is before the first row;
2194: * <code>false</code> otherwise or if the rowset contains no rows
2195: * @throws SQLException if an error occurs
2196: */
2197: public boolean isBeforeFirst() throws SQLException {
2198: return crsInternal.isBeforeFirst();
2199: }
2200:
2201: /**
2202: * Indicates whether the cursor is after the last row in this
2203: * <code>JoinRowSetImpl</code> object.
2204: *
2205: * @return <code>true</code> if the cursor is after the last row;
2206: * <code>false</code> otherwise or if the rowset contains no rows
2207: * @throws SQLException if an error occurs
2208: */
2209: public boolean isAfterLast() throws SQLException {
2210: return crsInternal.isAfterLast();
2211: }
2212:
2213: /**
2214: * Indicates whether the cursor is on the first row in this
2215: * <code>JoinRowSetImpl</code> object.
2216: *
2217: * @return <code>true</code> if the cursor is on the first row;
2218: * <code>false</code> otherwise or if the rowset contains no rows
2219: * @throws SQLException if an error occurs
2220: */
2221: public boolean isFirst() throws SQLException {
2222: return crsInternal.isFirst();
2223: }
2224:
2225: /**
2226: * Indicates whether the cursor is on the last row in this
2227: * <code>JoinRowSetImpl</code> object.
2228: * <P>
2229: * Note: Calling the method <code>isLast</code> may be expensive
2230: * because the JDBC driver might need to fetch ahead one row in order
2231: * to determine whether the current row is the last row in this rowset.
2232: *
2233: * @return <code>true</code> if the cursor is on the last row;
2234: * <code>false</code> otherwise or if this rowset contains no rows
2235: * @throws SQLException if an error occurs
2236: */
2237: public boolean isLast() throws SQLException {
2238: return crsInternal.isLast();
2239: }
2240:
2241: /**
2242: * Moves this <code>JoinRowSetImpl</code> object's cursor to the front of
2243: * the rowset, just before the first row. This method has no effect if
2244: * this rowset contains no rows.
2245: *
2246: * @throws SQLException if an error occurs or the type of this rowset
2247: * is <code>ResultSet.TYPE_FORWARD_ONLY</code>
2248: */
2249: public void beforeFirst() throws SQLException {
2250: crsInternal.beforeFirst();
2251: }
2252:
2253: /**
2254: * Moves this <code>JoinRowSetImpl</code> object's cursor to the end of
2255: * the rowset, just after the last row. This method has no effect if
2256: * this rowset contains no rows.
2257: *
2258: * @throws SQLException if an error occurs
2259: */
2260: public void afterLast() throws SQLException {
2261: crsInternal.afterLast();
2262: }
2263:
2264: /**
2265: * Moves this <code>JoinRowSetImpl</code> object's cursor to the first row
2266: * and returns <code>true</code> if the operation was successful. This
2267: * method also notifies registered listeners that the cursor has moved.
2268: *
2269: * @return <code>true</code> if the cursor is on a valid row;
2270: * <code>false</code> otherwise or if there are no rows in this
2271: * <code>JoinRowSetImpl</code> object
2272: * @throws SQLException if the type of this rowset
2273: * is <code>ResultSet.TYPE_FORWARD_ONLY</code>
2274: */
2275: public boolean first() throws SQLException {
2276: return crsInternal.first();
2277: }
2278:
2279: /**
2280: * Moves this <code>JoinRowSetImpl</code> object's cursor to the last row
2281: * and returns <code>true</code> if the operation was successful. This
2282: * method also notifies registered listeners that the cursor has moved.
2283: *
2284: * @return <code>true</code> if the cursor is on a valid row;
2285: * <code>false</code> otherwise or if there are no rows in this
2286: * <code>JoinRowSetImpl</code> object
2287: * @throws SQLException if the type of this rowset
2288: * is <code>ResultSet.TYPE_FORWARD_ONLY</code>
2289: */
2290: public boolean last() throws SQLException {
2291: return crsInternal.last();
2292: }
2293:
2294: /**
2295: * Returns the number of the current row in this <code>JoinRowSetImpl</code>
2296: * object. The first row is number 1, the second number 2, and so on.
2297: *
2298: * @return the number of the current row; <code>0</code> if there is no
2299: * current row
2300: * @throws SQLException if an error occurs
2301: */
2302: public int getRow() throws SQLException {
2303: return crsInternal.getRow();
2304: }
2305:
2306: /**
2307: * Moves this <code>JoinRowSetImpl</code> object's cursor to the row number
2308: * specified.
2309: *
2310: * <p>If the number is positive, the cursor moves to an absolute row with
2311: * respect to the beginning of the rowset. The first row is row 1, the second
2312: * is row 2, and so on. For example, the following command, in which
2313: * <code>crs</code> is a <code>JoinRowSetImpl</code> object, moves the cursor
2314: * to the fourth row, starting from the beginning of the rowset.
2315: * <PRE><code>
2316: *
2317: * crs.absolute(4);
2318: *
2319: * </code> </PRE>
2320: * <P>
2321: * If the number is negative, the cursor moves to an absolute row position
2322: * with respect to the end of the rowset. For example, calling
2323: * <code>absolute(-1)</code> positions the cursor on the last row,
2324: * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
2325: * If the <code>JoinRowSetImpl</code> object <code>crs</code> has five rows,
2326: * the following command moves the cursor to the fourth-to-last row, which
2327: * in the case of a rowset with five rows, is also the second row, counting
2328: * from the beginning.
2329: * <PRE><code>
2330: *
2331: * crs.absolute(-4);
2332: *
2333: * </code> </PRE>
2334: *
2335: * If the number specified is larger than the number of rows, the cursor
2336: * will move to the position after the last row. If the number specified
2337: * would move the cursor one or more rows before the first row, the cursor
2338: * moves to the position before the first row.
2339: * <P>
2340: * Note: Calling <code>absolute(1)</code> is the same as calling the
2341: * method <code>first()</code>. Calling <code>absolute(-1)</code> is the
2342: * same as calling <code>last()</code>.
2343: *
2344: * @param row a positive number to indicate the row, starting row numbering from
2345: * the first row, which is <code>1</code>; a negative number to indicate
2346: * the row, starting row numbering from the last row, which is
2347: * <code>-1</code>; must not be <code>0</code>
2348: * @return <code>true</code> if the cursor is on the rowset; <code>false</code>
2349: * otherwise
2350: * @throws SQLException if the given cursor position is <code>0</code> or the
2351: * type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
2352: */
2353: public boolean absolute(int row) throws SQLException {
2354: return crsInternal.absolute(row);
2355: }
2356:
2357: /**
2358: * Moves the cursor the specified number of rows from the current
2359: * position, with a positive number moving it forward and a
2360: * negative number moving it backward.
2361: * <P>
2362: * If the number is positive, the cursor moves the specified number of
2363: * rows toward the end of the rowset, starting at the current row.
2364: * For example, the following command, in which
2365: * <code>crs</code> is a <code>JoinRowSetImpl</code> object with 100 rows,
2366: * moves the cursor forward four rows from the current row. If the
2367: * current row is 50, the cursor would move to row 54.
2368: * <PRE><code>
2369: *
2370: * crs.relative(4);
2371: *
2372: * </code> </PRE>
2373: * <P>
2374: * If the number is negative, the cursor moves back toward the beginning
2375: * the specified number of rows, starting at the current row.
2376: * For example, calling the method
2377: * <code>absolute(-1)</code> positions the cursor on the last row,
2378: * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
2379: * If the <code>JoinRowSetImpl</code> object <code>crs</code> has five rows,
2380: * the following command moves the cursor to the fourth-to-last row, which
2381: * in the case of a rowset with five rows, is also the second row
2382: * from the beginning.
2383: * <PRE><code>
2384: *
2385: * crs.absolute(-4);
2386: *
2387: * </code> </PRE>
2388: *
2389: * If the number specified is larger than the number of rows, the cursor
2390: * will move to the position after the last row. If the number specified
2391: * would move the cursor one or more rows before the first row, the cursor
2392: * moves to the position before the first row. In both cases, this method
2393: * throws an <code>SQLException</code>.
2394: * <P>
2395: * Note: Calling <code>absolute(1)</code> is the same as calling the
2396: * method <code>first()</code>. Calling <code>absolute(-1)</code> is the
2397: * same as calling <code>last()</code>. Calling <code>relative(0)</code>
2398: * is valid, but it does not change the cursor position.
2399: *
2400: * @param rows an <code>int</code> indicating the number of rows to move
2401: * the cursor, starting at the current row; a positive number
2402: * moves the cursor forward; a negative number moves the cursor
2403: * backward; must not move the cursor past the valid
2404: * rows
2405: * @return <code>true</code> if the cursor is on a row in this
2406: * <code>JoinRowSetImpl</code> object; <code>false</code>
2407: * otherwise
2408: * @throws SQLException if there are no rows in this rowset, the cursor is
2409: * positioned either before the first row or after the last row, or
2410: * the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code>
2411: */
2412: public boolean relative(int rows) throws SQLException {
2413: return crsInternal.relative(rows);
2414: }
2415:
2416: /**
2417: * Moves this <code>JoinRowSetImpl</code> object's cursor to the
2418: * previous row and returns <code>true</code> if the cursor is on
2419: * a valid row or <code>false</code> if it is not.
2420: * This method also notifies all listeners registered with this
2421: * <code>JoinRowSetImpl</code> object that its cursor has moved.
2422: * <P>
2423: * Note: calling the method <code>previous()</code> is not the same
2424: * as calling the method <code>relative(-1)</code>. This is true
2425: * because it is possible to call <code>previous()</code> from the insert
2426: * row, from after the last row, or from the current row, whereas
2427: * <code>relative</code> may only be called from the current row.
2428: * <P>
2429: * The method <code>previous</code> may used in a <code>while</code>
2430: * loop to iterate through a rowset starting after the last row
2431: * and moving toward the beginning. The loop ends when <code>previous</code>
2432: * returns <code>false</code>, meaning that there are no more rows.
2433: * For example, the following code fragment retrieves all the data in
2434: * the <code>JoinRowSetImpl</code> object <code>crs</code>, which has
2435: * three columns. Note that the cursor must initially be positioned
2436: * after the last row so that the first call to the method
2437: * <code>previous</code> places the cursor on the last line.
2438: * <PRE> <code>
2439: *
2440: * crs.afterLast();
2441: * while (previous()) {
2442: * String name = crs.getString(1);
2443: * int age = crs.getInt(2);
2444: * short ssn = crs.getShort(3);
2445: * System.out.println(name + " " + age + " " + ssn);
2446: * }
2447: *
2448: * </code> </PRE>
2449: * This method throws an <code>SQLException</code> if the cursor is not
2450: * on a row in the rowset, before the first row, or after the last row.
2451: *
2452: * @return <code>true</code> if the cursor is on a valid row;
2453: * <code>false</code> if it is before the first row or after the
2454: * last row
2455: * @throws SQLException if the cursor is not on a valid position or the
2456: * type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
2457: */
2458: public boolean previous() throws SQLException {
2459: return crsInternal.previous();
2460: }
2461:
2462: /**
2463: * Returns the index of the column whose name is <i>columnName</i>.
2464: *
2465: * @param columnName a <code>String</code> object giving the name of the
2466: * column for which the index will be returned; the name must
2467: * match the SQL name of a column in this <code>JoinRowSet</code>
2468: * object, ignoring case
2469: * @throws SQLException if the given column name does not match one of the
2470: * column names for this <code>JoinRowSet</code> object
2471: */
2472: public int findColumn(String columnName) throws SQLException {
2473: return crsInternal.findColumn(columnName);
2474: }
2475:
2476: /**
2477: * Indicates whether the current row of this <code>JoinRowSetImpl</code>
2478: * object has been updated. The value returned
2479: * depends on whether this rowset can detect updates: <code>false</code>
2480: * will always be returned if it does not detect updates.
2481: *
2482: * @return <code>true</code> if the row has been visibly updated
2483: * by the owner or another and updates are detected;
2484: * <code>false</code> otherwise
2485: * @throws SQLException if the cursor is on the insert row or not
2486: * on a valid row
2487: *
2488: * @see DatabaseMetaData#updatesAreDetected
2489: */
2490: public boolean rowUpdated() throws SQLException {
2491: return crsInternal.rowUpdated();
2492: }
2493:
2494: /**
2495: * Indicates whether the designated column of the current row of
2496: * this <code>JoinRowSetImpl</code> object has been updated. The
2497: * value returned depends on whether this rowset can detcted updates:
2498: * <code>false</code> will always be returned if it does not detect updates.
2499: *
2500: * @return <code>true</code> if the column updated
2501: * <code>false</code> otherwse
2502: * @throws SQLException if the cursor is on the insert row or not
2503: * on a valid row
2504: * @see DatabaseMetaData#updatesAreDetected
2505: */
2506: public boolean columnUpdated(int indexColumn) throws SQLException {
2507: return crsInternal.columnUpdated(indexColumn);
2508: }
2509:
2510: /**
2511: * Indicates whether the current row has been inserted. The value returned
2512: * depends on whether or not the rowset can detect visible inserts.
2513: *
2514: * @return <code>true</code> if a row has been inserted and inserts are detected;
2515: * <code>false</code> otherwise
2516: * @throws SQLException if the cursor is on the insert row or not
2517: * not on a valid row
2518: *
2519: * @see DatabaseMetaData#insertsAreDetected
2520: */
2521: public boolean rowInserted() throws SQLException {
2522: return crsInternal.rowInserted();
2523: }
2524:
2525: /**
2526: * Indicates whether the current row has been deleted. A deleted row
2527: * may leave a visible "hole" in a rowset. This method can be used to
2528: * detect such holes if the rowset can detect deletions. This method
2529: * will always return <code>false</code> if this rowset cannot detect
2530: * deletions.
2531: *
2532: * @return <code>true</code> if (1)the current row is blank, indicating that
2533: * the row has been deleted, and (2)deletions are detected;
2534: * <code>false</code> otherwise
2535: * @throws SQLException if the cursor is on a valid row in this rowset
2536: * @see DatabaseMetaData#deletesAreDetected
2537: */
2538: public boolean rowDeleted() throws SQLException {
2539: return crsInternal.rowDeleted();
2540: }
2541:
2542: /**
2543: * Sets the designated nullable column in the current row or the
2544: * insert row of this <code>JoinRowSetImpl</code> object with
2545: * <code>null</code> value.
2546: * <P>
2547: * This method updates a column value in the current row or the insert
2548: * row of this rowset; however, another method must be called to complete
2549: * the update process. If the cursor is on a row in the rowset, the
2550: * method {@link #updateRow} must be called to mark the row as updated
2551: * and to notify listeners that the row has changed.
2552: * If the cursor is on the insert row, the method {@link #insertRow}
2553: * must be called to insert the new row into this rowset and to notify
2554: * listeners that a row has changed.
2555: * <P>
2556: * In order to propagate updates in this rowset to the underlying
2557: * data source, an application must call the method acceptChanges
2558: * after it calls either <code>updateRow</code> or <code>insertRow</code>.
2559: *
2560: * @param columnIndex the first column is <code>1</code>, the second
2561: * is <code>2</code>, and so on; must be <code>1</code> or larger
2562: * and equal to or less than the number of columns in this rowset
2563: * @throws SQLException if (1) the given column index is out of bounds,
2564: * (2) the cursor is not on one of this rowset's rows or its
2565: * insert row, or (3) this rowset is
2566: * <code>ResultSet.CONCUR_READ_ONLY</code>
2567: */
2568: public void updateNull(int columnIndex) throws SQLException {
2569: crsInternal.updateNull(columnIndex);
2570: }
2571:
2572: /**
2573: * Sets the designated column in either the current row or the insert
2574: * row of this <code>JoinRowSetImpl</code> object with the given
2575: * <code>boolean</code> value.
2576: * <P>
2577: * This method updates a column value in the current row or the insert
2578: * row of this rowset, but it does not update the database.
2579: * If the cursor is on a row in the rowset, the
2580: * method {@link #updateRow} must be called to update the database.
2581: * If the cursor is on the insert row, the method {@link #insertRow}
2582: * must be called, which will insert the new row into both this rowset
2583: * and the database. Both of these methods must be called before the
2584: * cursor moves to another row.
2585: *
2586: * @param columnIndex the first column is <code>1</code>, the second
2587: * is <code>2</code>, and so on; must be <code>1</code> or larger
2588: * and equal to or less than the number of columns in this rowset
2589: * @param x the new column value
2590: * @throws SQLException if (1) the given column index is out of bounds,
2591: * (2) the cursor is not on one of this rowset's rows or its
2592: * insert row, or (3) this rowset is
2593: * <code>ResultSet.CONCUR_READ_ONLY</code>
2594: */
2595: public void updateBoolean(int columnIndex, boolean x)
2596: throws SQLException {
2597: crsInternal.updateBoolean(columnIndex, x);
2598: }
2599:
2600: /**
2601: * Sets the designated column in either the current row or the insert
2602: * row of this <code>JoinRowSetImpl</code> object with the given
2603: * <code>byte</code> value.
2604: * <P>
2605: * This method updates a column value in the current row or the insert
2606: * row of this rowset, but it does not update the database.
2607: * If the cursor is on a row in the rowset, the
2608: * method {@link #updateRow} must be called to update the database.
2609: * If the cursor is on the insert row, the method {@link #insertRow}
2610: * must be called, which will insert the new row into both this rowset
2611: * and the database. Both of these methods must be called before the
2612: * cursor moves to another row.
2613: *
2614: * @param columnIndex the first column is <code>1</code>, the second
2615: * is <code>2</code>, and so on; must be <code>1</code> or larger
2616: * and equal to or less than the number of columns in this rowset
2617: * @param x the new column value
2618: * @throws SQLException if (1) the given column index is out of bounds,
2619: * (2) the cursor is not on one of this rowset's rows or its
2620: * insert row, or (3) this rowset is
2621: * <code>ResultSet.CONCUR_READ_ONLY</code>
2622: */
2623: public void updateByte(int columnIndex, byte x) throws SQLException {
2624: crsInternal.updateByte(columnIndex, x);
2625: }
2626:
2627: /**
2628: * Sets the designated column in either the current row or the insert
2629: * row of this <code>JoinRowSetImpl</code> object with the given
2630: * <code>short</code> value.
2631: * <P>
2632: * This method updates a column value in the current row or the insert
2633: * row of this rowset, but it does not update the database.
2634: * If the cursor is on a row in the rowset, the
2635: * method {@link #updateRow} must be called to update the database.
2636: * If the cursor is on the insert row, the method {@link #insertRow}
2637: * must be called, which will insert the new row into both this rowset
2638: * and the database. Both of these methods must be called before the
2639: * cursor moves to another row.
2640: *
2641: * @param columnIndex the first column is <code>1</code>, the second
2642: * is <code>2</code>, and so on; must be <code>1</code> or larger
2643: * and equal to or less than the number of columns in this rowset
2644: * @param x the new column value
2645: * @throws SQLException if (1) the given column index is out of bounds,
2646: * (2) the cursor is not on one of this rowset's rows or its
2647: * insert row, or (3) this rowset is
2648: * <code>ResultSet.CONCUR_READ_ONLY</code>
2649: */
2650: public void updateShort(int columnIndex, short x)
2651: throws SQLException {
2652: crsInternal.updateShort(columnIndex, x);
2653: }
2654:
2655: /**
2656: * Sets the designated column in either the current row or the insert
2657: * row of this <code>JoinRowSetImpl</code> object with the given
2658: * <code>int</code> value.
2659: * <P>
2660: * This method updates a column value in the current row or the insert
2661: * row of this rowset, but it does not update the database.
2662: * If the cursor is on a row in the rowset, the
2663: * method {@link #updateRow} must be called to update the database.
2664: * If the cursor is on the insert row, the method {@link #insertRow}
2665: * must be called, which will insert the new row into both this rowset
2666: * and the database. Both of these methods must be called before the
2667: * cursor moves to another row.
2668: *
2669: * @param columnIndex the first column is <code>1</code>, the second
2670: * is <code>2</code>, and so on; must be <code>1</code> or larger
2671: * and equal to or less than the number of columns in this rowset
2672: * @param x the new column value
2673: * @throws SQLException if (1) the given column index is out of bounds,
2674: * (2) the cursor is not on one of this rowset's rows or its
2675: * insert row, or (3) this rowset is
2676: * <code>ResultSet.CONCUR_READ_ONLY</code>
2677: */
2678: public void updateInt(int columnIndex, int x) throws SQLException {
2679: crsInternal.updateInt(columnIndex, x);
2680: }
2681:
2682: /**
2683: * Sets the designated column in either the current row or the insert
2684: * row of this <code>JoinRowSetImpl</code> object with the given
2685: * <code>long</code> value.
2686: * <P>
2687: * This method updates a column value in the current row or the insert
2688: * row of this rowset, but it does not update the database.
2689: * If the cursor is on a row in the rowset, the
2690: * method {@link #updateRow} must be called to update the database.
2691: * If the cursor is on the insert row, the method {@link #insertRow}
2692: * must be called, which will insert the new row into both this rowset
2693: * and the database. Both of these methods must be called before the
2694: * cursor moves to another row.
2695: *
2696: * @param columnIndex the first column is <code>1</code>, the second
2697: * is <code>2</code>, and so on; must be <code>1</code> or larger
2698: * and equal to or less than the number of columns in this rowset
2699: * @param x the new column value
2700: * @throws SQLException if (1) the given column index is out of bounds,
2701: * (2) the cursor is not on one of this rowset's rows or its
2702: * insert row, or (3) this rowset is
2703: * <code>ResultSet.CONCUR_READ_ONLY</code>
2704: */
2705: public void updateLong(int columnIndex, long x) throws SQLException {
2706: crsInternal.updateLong(columnIndex, x);
2707: }
2708:
2709: /**
2710: * Sets the designated column in either the current row or the insert
2711: * row of this <code>JoinRowSetImpl</code> object with the given
2712: * <code>float</code> value.
2713: * <P>
2714: * This method updates a column value in the current row or the insert
2715: * row of this rowset, but it does not update the database.
2716: * If the cursor is on a row in the rowset, the
2717: * method {@link #updateRow} must be called to update the database.
2718: * If the cursor is on the insert row, the method {@link #insertRow}
2719: * must be called, which will insert the new row into both this rowset
2720: * and the database. Both of these methods must be called before the
2721: * cursor moves to another row.
2722: *
2723: * @param columnIndex the first column is <code>1</code>, the second
2724: * is <code>2</code>, and so on; must be <code>1</code> or larger
2725: * and equal to or less than the number of columns in this rowset
2726: * @param x the new column value
2727: * @throws SQLException if (1) the given column index is out of bounds,
2728: * (2) the cursor is not on one of this rowset's rows or its
2729: * insert row, or (3) this rowset is
2730: * <code>ResultSet.CONCUR_READ_ONLY</code>
2731: */
2732: public void updateFloat(int columnIndex, float x)
2733: throws SQLException {
2734: crsInternal.updateFloat(columnIndex, x);
2735: }
2736:
2737: /**
2738: * Sets the designated column in either the current row or the insert
2739: * row of this <code>JoinRowSetImpl</code> object with the given
2740: * <code>double</code> value.
2741: *
2742: * This method updates a column value in either the current row or
2743: * the insert row of this rowset, but it does not update the
2744: * database. If the cursor is on a row in the rowset, the
2745: * method {@link #updateRow} must be called to update the database.
2746: * If the cursor is on the insert row, the method {@link #insertRow}
2747: * must be called, which will insert the new row into both this rowset
2748: * and the database. Both of these methods must be called before the
2749: * cursor moves to another row.
2750: *
2751: * @param columnIndex the first column is <code>1</code>, the second
2752: * is <code>2</code>, and so on; must be <code>1</code> or larger
2753: * and equal to or less than the number of columns in this rowset
2754: * @param x the new column value
2755: * @throws SQLException if (1) the given column index is out of bounds,
2756: * (2) the cursor is not on one of this rowset's rows or its
2757: * insert row, or (3) this rowset is
2758: * <code>ResultSet.CONCUR_READ_ONLY</code>
2759: */
2760: public void updateDouble(int columnIndex, double x)
2761: throws SQLException {
2762: crsInternal.updateDouble(columnIndex, x);
2763: }
2764:
2765: /**
2766: * Sets the designated column in either the current row or the insert
2767: * row of this <code>JoinRowSetImpl</code> object with the given
2768: * <code>java.math.BigDecimal</code> object.
2769: * <P>
2770: * This method updates a column value in the current row or the insert
2771: * row of this rowset, but it does not update the database.
2772: * If the cursor is on a row in the rowset, the
2773: * method {@link #updateRow} must be called to update the database.
2774: * If the cursor is on the insert row, the method {@link #insertRow}
2775: * must be called, which will insert the new row into both this rowset
2776: * and the database. Both of these methods must be called before the
2777: * cursor moves to another row.
2778: *
2779: * @param columnIndex the first column is <code>1</code>, the second
2780: * is <code>2</code>, and so on; must be <code>1</code> or larger
2781: * and equal to or less than the number of columns in this rowset
2782: * @param x the new column value
2783: * @throws SQLException if (1) the given column index is out of bounds,
2784: * (2) the cursor is not on one of this rowset's rows or its
2785: * insert row, or (3) this rowset is
2786: * <code>ResultSet.CONCUR_READ_ONLY</code>
2787: */
2788: public void updateBigDecimal(int columnIndex, BigDecimal x)
2789: throws SQLException {
2790: crsInternal.updateBigDecimal(columnIndex, x);
2791: }
2792:
2793: /**
2794: * Sets the designated column in either the current row or the insert
2795: * row of this <code>JoinRowSetImpl</code> object with the given
2796: * <code>String</code> object.
2797: * <P>
2798: * This method updates a column value in either the current row or
2799: * the insert row of this rowset, but it does not update the
2800: * database. If the cursor is on a row in the rowset, the
2801: * method {@link #updateRow} must be called to mark the row as updated.
2802: * If the cursor is on the insert row, the method {@link #insertRow}
2803: * must be called to insert the new row into this rowset and mark it
2804: * as inserted. Both of these methods must be called before the
2805: * cursor moves to another row.
2806: * <P>
2807: * The method <code>acceptChanges</code> must be called if the
2808: * updated values are to be written back to the underlying database.
2809: *
2810: * @param columnIndex the first column is <code>1</code>, the second
2811: * is <code>2</code>, and so on; must be <code>1</code> or larger
2812: * and equal to or less than the number of columns in this rowset
2813: * @param x the new column value
2814: * @throws SQLException if (1) the given column index is out of bounds,
2815: * (2) the cursor is not on one of this rowset's rows or its
2816: * insert row, or (3) this rowset is
2817: * <code>ResultSet.CONCUR_READ_ONLY</code>
2818: */
2819: public void updateString(int columnIndex, String x)
2820: throws SQLException {
2821: crsInternal.updateString(columnIndex, x);
2822: }
2823:
2824: /**
2825: * Sets the designated column in either the current row or the insert
2826: * row of this <code>JoinRowSetImpl</code> object with the given
2827: * <code>byte</code> array.
2828: *
2829: * This method updates a column value in either the current row or
2830: * the insert row of this rowset, but it does not update the
2831: * database. If the cursor is on a row in the rowset, the
2832: * method {@link #updateRow} must be called to update the database.
2833: * If the cursor is on the insert row, the method {@link #insertRow}
2834: * must be called, which will insert the new row into both this rowset
2835: * and the database. Both of these methods must be called before the
2836: * cursor moves to another row.
2837: *
2838: * @param columnIndex the first column is <code>1</code>, the second
2839: * is <code>2</code>, and so on; must be <code>1</code> or larger
2840: * and equal to or less than the number of columns in this rowset
2841: * @param x the new column value
2842: * @throws SQLException if (1) the given column index is out of bounds,
2843: * (2) the cursor is not on one of this rowset's rows or its
2844: * insert row, or (3) this rowset is
2845: * <code>ResultSet.CONCUR_READ_ONLY</code>
2846: */
2847: public void updateBytes(int columnIndex, byte x[])
2848: throws SQLException {
2849: crsInternal.updateBytes(columnIndex, x);
2850: }
2851:
2852: /**
2853: * Sets the designated column in either the current row or the insert
2854: * row of this <code>JoinRowSetImpl</code> object with the given
2855: * <code>Date</code> object.
2856: *
2857: * This method updates a column value in either the current row or
2858: * the insert row of this rowset, but it does not update the
2859: * database. If the cursor is on a row in the rowset, the
2860: * method {@link #updateRow} must be called to update the database.
2861: * If the cursor is on the insert row, the method {@link #insertRow}
2862: * must be called, which will insert the new row into both this rowset
2863: * and the database. Both of these methods must be called before the
2864: * cursor moves to another row.
2865: *
2866: * @param columnIndex the first column is <code>1</code>, the second
2867: * is <code>2</code>, and so on; must be <code>1</code> or larger
2868: * and equal to or less than the number of columns in this rowset
2869: * @param x the new column value
2870: * @throws SQLException if (1) the given column index is out of bounds,
2871: * (2) the cursor is not on one of this rowset's rows or its
2872: * insert row, (3) the type of the designated column is not
2873: * an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or
2874: * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
2875: */
2876: public void updateDate(int columnIndex, java.sql.Date x)
2877: throws SQLException {
2878: crsInternal.updateDate(columnIndex, x);
2879: }
2880:
2881: /**
2882: * Sets the designated column in either the current row or the insert
2883: * row of this <code>JoinRowSetImpl</code> object with the given
2884: * <code>Time</code> object.
2885: *
2886: * This method updates a column value in either the current row or
2887: * the insert row of this rowset, but it does not update the
2888: * database. If the cursor is on a row in the rowset, the
2889: * method {@link #updateRow} must be called to update the database.
2890: * If the cursor is on the insert row, the method {@link #insertRow}
2891: * must be called, which will insert the new row into both this rowset
2892: * and the database. Both of these methods must be called before the
2893: * cursor moves to another row.
2894: *
2895: * @param columnIndex the first column is <code>1</code>, the second
2896: * is <code>2</code>, and so on; must be <code>1</code> or larger
2897: * and equal to or less than the number of columns in this rowset
2898: * @param x the new column value
2899: * @throws SQLException if (1) the given column index is out of bounds,
2900: * (2) the cursor is not on one of this rowset's rows or its
2901: * insert row, (3) the type of the designated column is not
2902: * an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or
2903: * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
2904: */
2905: public void updateTime(int columnIndex, java.sql.Time x)
2906: throws SQLException {
2907: crsInternal.updateTime(columnIndex, x);
2908: }
2909:
2910: /**
2911: * Sets the designated column in either the current row or the insert
2912: * row of this <code>JoinRowSetImpl</code> object with the given
2913: * <code>Timestamp</code> object.
2914: *
2915: * This method updates a column value in either the current row or
2916: * the insert row of this rowset, but it does not update the
2917: * database. If the cursor is on a row in the rowset, the
2918: * method {@link #updateRow} must be called to update the database.
2919: * If the cursor is on the insert row, the method {@link #insertRow}
2920: * must be called, which will insert the new row into both this rowset
2921: * and the database. Both of these methods must be called before the
2922: * cursor moves to another row.
2923: *
2924: * @param columnIndex the first column is <code>1</code>, the second
2925: * is <code>2</code>, and so on; must be <code>1</code> or larger
2926: * and equal to or less than the number of columns in this rowset
2927: * @param x the new column value
2928: * @throws SQLException if (1) the given column index is out of bounds,
2929: * (2) the cursor is not on one of this rowset's rows or its
2930: * insert row, (3) the type of the designated column is not
2931: * an SQL <code>DATE</code>, <code>TIME</code>, or
2932: * <code>TIMESTAMP</code>, or (4) this rowset is
2933: * <code>ResultSet.CONCUR_READ_ONLY</code>
2934: */
2935: public void updateTimestamp(int columnIndex, java.sql.Timestamp x)
2936: throws SQLException {
2937: crsInternal.updateTimestamp(columnIndex, x);
2938: }
2939:
2940: /*
2941: * Sets the designated column in either the current row or the insert
2942: * row of this <code>JoinRowSetImpl</code> object with the given
2943: * ASCII stream value.
2944: * <P>
2945: * This method updates a column value in either the current row or
2946: * the insert row of this rowset, but it does not update the
2947: * database. If the cursor is on a row in the rowset, the
2948: * method {@link #updateRow} must be called to update the database.
2949: * If the cursor is on the insert row, the method {@link #insertRow}
2950: * must be called, which will insert the new row into both this rowset
2951: * and the database. Both of these methods must be called before the
2952: * cursor moves to another row.
2953: *
2954: * @param columnIndex the first column is <code>1</code>, the second
2955: * is <code>2</code>, and so on; must be <code>1</code> or larger
2956: * and equal to or less than the number of columns in this rowset
2957: * @param x the new column value
2958: * @param length the number of one-byte ASCII characters in the stream
2959: * @throws UnsupportedOperationException if this method is invoked
2960: */
2961: public void updateAsciiStream(int columnIndex,
2962: java.io.InputStream x, int length) throws SQLException {
2963: crsInternal.updateAsciiStream(columnIndex, x, length);
2964: }
2965:
2966: /**
2967: * Sets the designated column in either the current row or the insert
2968: * row of this <code>JoinRowSetImpl</code> object with the given
2969: * <code>java.io.InputStream</code> object.
2970: * <P>
2971: * This method updates a column value in either the current row or
2972: * the insert row of this rowset, but it does not update the
2973: * database. If the cursor is on a row in the rowset, the
2974: * method {@link #updateRow} must be called to update the database.
2975: * If the cursor is on the insert row, the method {@link #insertRow}
2976: * must be called, which will insert the new row into both this rowset
2977: * and the database. Both of these methods must be called before the
2978: * cursor moves to another row.
2979: *
2980: * @param columnIndex the first column is <code>1</code>, the second
2981: * is <code>2</code>, and so on; must be <code>1</code> or larger
2982: * and equal to or less than the number of columns in this rowset
2983: * @param x the new column value; must be a <code>java.io.InputStream</code>
2984: * containing <code>BINARY</code>, <code>VARBINARY</code>, or
2985: * <code>LONGVARBINARY</code> data
2986: * @param length the length of the stream in bytes
2987: * @throws SQLException if (1) the given column index is out of bounds,
2988: * (2) the cursor is not on one of this rowset's rows or its
2989: * insert row, (3) the data in the stream is not binary, or
2990: * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
2991: */
2992: public void updateBinaryStream(int columnIndex,
2993: java.io.InputStream x, int length) throws SQLException {
2994: crsInternal.updateBinaryStream(columnIndex, x, length);
2995: }
2996:
2997: /**
2998: * Sets the designated column in either the current row or the insert
2999: * row of this <code>JoinRowSetImpl</code> object with the given
3000: * <code>java.io.Reader</code> object.
3001: * <P>
3002: * This method updates a column value in either the current row or
3003: * the insert row of this rowset, but it does not update the
3004: * database. If the cursor is on a row in the rowset, the
3005: * method {@link #updateRow} must be called to update the database.
3006: * If the cursor is on the insert row, the method {@link #insertRow}
3007: * must be called, which will insert the new row into both this rowset
3008: * and the database. Both of these methods must be called before the
3009: * cursor moves to another row.
3010: *
3011: * @param columnIndex the first column is <code>1</code>, the second
3012: * is <code>2</code>, and so on; must be <code>1</code> or larger
3013: * and equal to or less than the number of columns in this rowset
3014: * @param x the new column value; must be a <code>java.io.Reader</code>
3015: * containing <code>BINARY</code>, <code>VARBINARY</code>,
3016: * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
3017: * or <code>LONGVARCHAR</code> data
3018: * @param length the length of the stream in characters
3019: * @throws SQLException if (1) the given column index is out of bounds,
3020: * (2) the cursor is not on one of this rowset's rows or its
3021: * insert row, (3) the data in the stream is not a binary or
3022: * character type, or (4) this rowset is
3023: * <code>ResultSet.CONCUR_READ_ONLY</code>
3024: */
3025: public void updateCharacterStream(int columnIndex,
3026: java.io.Reader x, int length) throws SQLException {
3027: crsInternal.updateCharacterStream(columnIndex, x, length);
3028: }
3029:
3030: /**
3031: * Sets the designated column in either the current row or the insert
3032: * row of this <code>JoinRowSetImpl</code> object with the given
3033: * <code>Object</code> value. The <code>scale</code> parameter indicates
3034: * the number of digits to the right of the decimal point and is ignored
3035: * if the new column value is not a type that will be mapped to an SQL
3036: * <code>DECIMAL</code> or <code>NUMERIC</code> value.
3037: * <P>
3038: * This method updates a column value in either the current row or
3039: * the insert row of this rowset, but it does not update the
3040: * database. If the cursor is on a row in the rowset, the
3041: * method {@link #updateRow} must be called to update the database.
3042: * If the cursor is on the insert row, the method {@link #insertRow}
3043: * must be called, which will insert the new row into both this rowset
3044: * and the database. Both of these methods must be called before the
3045: * cursor moves to another row.
3046: *
3047: * @param columnIndex the first column is <code>1</code>, the second
3048: * is <code>2</code>, and so on; must be <code>1</code> or larger
3049: * and equal to or less than the number of columns in this rowset
3050: * @param x the new column value
3051: * @param scale the number of digits to the right of the decimal point (for
3052: * <code>DECIMAL</code> and <code>NUMERIC</code> types only)
3053: * @throws SQLException if (1) the given column index is out of bounds,
3054: * (2) the cursor is not on one of this rowset's rows or its
3055: * insert row, or (3) this rowset is
3056: * <code>ResultSet.CONCUR_READ_ONLY</code>
3057: */
3058: public void updateObject(int columnIndex, Object x, int scale)
3059: throws SQLException {
3060: crsInternal.updateObject(columnIndex, x, scale);
3061: }
3062:
3063: /**
3064: * Sets the designated column in either the current row or the insert
3065: * row of this <code>JoinRowSetImpl</code> object with the given
3066: * <code>Object</code> value.
3067: * <P>
3068: * This method updates a column value in either the current row or
3069: * the insert row of this rowset, but it does not update the
3070: * database. If the cursor is on a row in the rowset, the
3071: * method {@link #updateRow} must be called to update the database.
3072: * If the cursor is on the insert row, the method {@link #insertRow}
3073: * must be called, which will insert the new row into both this rowset
3074: * and the database. Both of these methods must be called before the
3075: * cursor moves to another row.
3076: *
3077: * @param columnIndex the first column is <code>1</code>, the second
3078: * is <code>2</code>, and so on; must be <code>1</code> or larger
3079: * and equal to or less than the number of columns in this rowset
3080: * @param x the new column value
3081: * @throws SQLException if (1) the given column index is out of bounds,
3082: * (2) the cursor is not on one of this rowset's rows or its
3083: * insert row, or (3) this rowset is
3084: * <code>ResultSet.CONCUR_READ_ONLY</code>
3085: */
3086: public void updateObject(int columnIndex, Object x)
3087: throws SQLException {
3088: crsInternal.updateObject(columnIndex, x);
3089: }
3090:
3091: // columnName updates
3092:
3093: /**
3094: * Sets the designated nullable column in the current row or the
3095: * insert row of this <code>JoinRowSetImpl</code> object with
3096: * <code>null</code> value.
3097: * <P>
3098: * This method updates a column value in the current row or the insert
3099: * row of this rowset, but it does not update the database.
3100: * If the cursor is on a row in the rowset, the
3101: * method {@link #updateRow} must be called to update the database.
3102: * If the cursor is on the insert row, the method {@link #insertRow}
3103: * must be called, which will insert the new row into both this rowset
3104: * and the database.
3105: *
3106: * @param columnName a <code>String</code> object that must match the
3107: * SQL name of a column in this rowset, ignoring case
3108: * @throws SQLException if (1) the given column name does not match the
3109: * name of a column in this rowset, (2) the cursor is not on
3110: * one of this rowset's rows or its insert row, or (3) this
3111: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3112: */
3113: public void updateNull(String columnName) throws SQLException {
3114: crsInternal.updateNull(columnName);
3115: }
3116:
3117: /**
3118: * Sets the designated column in either the current row or the insert
3119: * row of this <code>JoinRowSetImpl</code> object with the given
3120: * <code>boolean</code> value.
3121: * <P>
3122: * This method updates a column value in the current row or the insert
3123: * row of this rowset, but it does not update the database.
3124: * If the cursor is on a row in the rowset, the
3125: * method {@link #updateRow} must be called to update the database.
3126: * If the cursor is on the insert row, the method {@link #insertRow}
3127: * must be called, which will insert the new row into both this rowset
3128: * and the database. Both of these methods must be called before the
3129: * cursor moves to another row.
3130: *
3131: * @param columnName a <code>String</code> object that must match the
3132: * SQL name of a column in this rowset, ignoring case
3133: * @param x the new column value
3134: * @throws SQLException if (1) the given column name does not match the
3135: * name of a column in this rowset, (2) the cursor is not on
3136: * one of this rowset's rows or its insert row, or (3) this
3137: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3138: */
3139: public void updateBoolean(String columnName, boolean x)
3140: throws SQLException {
3141: crsInternal.updateBoolean(columnName, x);
3142: }
3143:
3144: /**
3145: * Sets the designated column in either the current row or the insert
3146: * row of this <code>JoinRowSetImpl</code> object with the given
3147: * <code>byte</code> value.
3148: * <P>
3149: * This method updates a column value in the current row or the insert
3150: * row of this rowset, but it does not update the database.
3151: * If the cursor is on a row in the rowset, the
3152: * method {@link #updateRow} must be called to update the database.
3153: * If the cursor is on the insert row, the method {@link #insertRow}
3154: * must be called, which will insert the new row into both this rowset
3155: * and the database. Both of these methods must be called before the
3156: * cursor moves to another row.
3157: *
3158: * @param columnName a <code>String</code> object that must match the
3159: * SQL name of a column in this rowset, ignoring case
3160: * @param x the new column value
3161: * @throws SQLException if (1) the given column name does not match the
3162: * name of a column in this rowset, (2) the cursor is not on
3163: * one of this rowset's rows or its insert row, or (3) this
3164: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3165: */
3166: public void updateByte(String columnName, byte x)
3167: throws SQLException {
3168: crsInternal.updateByte(columnName, x);
3169: }
3170:
3171: /**
3172: * Sets the designated column in either the current row or the insert
3173: * row of this <code>JoinRowSetImpl</code> object with the given
3174: * <code>short</code> value.
3175: * <P>
3176: * This method updates a column value in the current row or the insert
3177: * row of this rowset, but it does not update the database.
3178: * If the cursor is on a row in the rowset, the
3179: * method {@link #updateRow} must be called to update the database.
3180: * If the cursor is on the insert row, the method {@link #insertRow}
3181: * must be called, which will insert the new row into both this rowset
3182: * and the database. Both of these methods must be called before the
3183: * cursor moves to another row.
3184: *
3185: * @param columnName a <code>String</code> object that must match the
3186: * SQL name of a column in this rowset, ignoring case
3187: * @param x the new column value
3188: * @throws SQLException if (1) the given column name does not match the
3189: * name of a column in this rowset, (2) the cursor is not on
3190: * one of this rowset's rows or its insert row, or (3) this
3191: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3192: */
3193: public void updateShort(String columnName, short x)
3194: throws SQLException {
3195: crsInternal.updateShort(columnName, x);
3196: }
3197:
3198: /**
3199: * Sets the designated column in either the current row or the insert
3200: * row of this <code>JoinRowSetImpl</code> object with the given
3201: * <code>int</code> value.
3202: * <P>
3203: * This method updates a column value in the current row or the insert
3204: * row of this rowset, but it does not update the database.
3205: * If the cursor is on a row in the rowset, the
3206: * method {@link #updateRow} must be called to update the database.
3207: * If the cursor is on the insert row, the method {@link #insertRow}
3208: * must be called, which will insert the new row into both this rowset
3209: * and the database. Both of these methods must be called before the
3210: * cursor moves to another row.
3211: *
3212: * @param columnName a <code>String</code> object that must match the
3213: * SQL name of a column in this rowset, ignoring case
3214: * @param x the new column value
3215: * @throws SQLException if (1) the given column name does not match the
3216: * name of a column in this rowset, (2) the cursor is not on
3217: * one of this rowset's rows or its insert row, or (3) this
3218: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3219: */
3220: public void updateInt(String columnName, int x) throws SQLException {
3221: crsInternal.updateInt(columnName, x);
3222: }
3223:
3224: /**
3225: * Sets the designated column in either the current row or the insert
3226: * row of this <code>JoinRowSetImpl</code> object with the given
3227: * <code>long</code> value.
3228: * <P>
3229: * This method updates a column value in the current row or the insert
3230: * row of this rowset, but it does not update the database.
3231: * If the cursor is on a row in the rowset, the
3232: * method {@link #updateRow} must be called to update the database.
3233: * If the cursor is on the insert row, the method {@link #insertRow}
3234: * must be called, which will insert the new row into both this rowset
3235: * and the database. Both of these methods must be called before the
3236: * cursor moves to another row.
3237: *
3238: * @param columnName a <code>String</code> object that must match the
3239: * SQL name of a column in this rowset, ignoring case
3240: * @param x the new column value
3241: * @throws SQLException if (1) the given column name does not match the
3242: * name of a column in this rowset, (2) the cursor is not on
3243: * one of this rowset's rows or its insert row, or (3) this
3244: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3245: */
3246: public void updateLong(String columnName, long x)
3247: throws SQLException {
3248: crsInternal.updateLong(columnName, x);
3249: }
3250:
3251: /**
3252: * Sets the designated column in either the current row or the insert
3253: * row of this <code>JoinRowSetImpl</code> object with the given
3254: * <code>float</code> value.
3255: * <P>
3256: * This method updates a column value in the current row or the insert
3257: * row of this rowset, but it does not update the database.
3258: * If the cursor is on a row in the rowset, the
3259: * method {@link #updateRow} must be called to update the database.
3260: * If the cursor is on the insert row, the method {@link #insertRow}
3261: * must be called, which will insert the new row into both this rowset
3262: * and the database. Both of these methods must be called before the
3263: * cursor moves to another row.
3264: *
3265: * @param columnName a <code>String</code> object that must match the
3266: * SQL name of a column in this rowset, ignoring case
3267: * @param x the new column value
3268: * @throws SQLException if (1) the given column name does not match the
3269: * name of a column in this rowset, (2) the cursor is not on
3270: * one of this rowset's rows or its insert row, or (3) this
3271: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3272: */
3273: public void updateFloat(String columnName, float x)
3274: throws SQLException {
3275: crsInternal.updateFloat(columnName, x);
3276: }
3277:
3278: /**
3279: * Sets the designated column in either the current row or the insert
3280: * row of this <code>JoinRowSetImpl</code> object with the given
3281: * <code>double</code> value.
3282: *
3283: * This method updates a column value in either the current row or
3284: * the insert row of this rowset, but it does not update the
3285: * database. If the cursor is on a row in the rowset, the
3286: * method {@link #updateRow} must be called to update the database.
3287: * If the cursor is on the insert row, the method {@link #insertRow}
3288: * must be called, which will insert the new row into both this rowset
3289: * and the database. Both of these methods must be called before the
3290: * cursor moves to another row.
3291: *
3292: * @param columnName a <code>String</code> object that must match the
3293: * SQL name of a column in this rowset, ignoring case
3294: * @param x the new column value
3295: * @throws SQLException if (1) the given column name does not match the
3296: * name of a column in this rowset, (2) the cursor is not on
3297: * one of this rowset's rows or its insert row, or (3) this
3298: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3299: */
3300: public void updateDouble(String columnName, double x)
3301: throws SQLException {
3302: crsInternal.updateDouble(columnName, x);
3303: }
3304:
3305: /**
3306: * Sets the designated column in either the current row or the insert
3307: * row of this <code>JoinRowSetImpl</code> object with the given
3308: * <code>java.math.BigDecimal</code> object.
3309: * <P>
3310: * This method updates a column value in the current row or the insert
3311: * row of this rowset, but it does not update the database.
3312: * If the cursor is on a row in the rowset, the
3313: * method {@link #updateRow} must be called to update the database.
3314: * If the cursor is on the insert row, the method {@link #insertRow}
3315: * must be called, which will insert the new row into both this rowset
3316: * and the database. Both of these methods must be called before the
3317: * cursor moves to another row.
3318: *
3319: * @param columnName a <code>String</code> object that must match the
3320: * SQL name of a column in this rowset, ignoring case
3321: * @param x the new column value
3322: * @throws SQLException if (1) the given column name does not match the
3323: * name of a column in this rowset, (2) the cursor is not on
3324: * one of this rowset's rows or its insert row, or (3) this
3325: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3326: */
3327: public void updateBigDecimal(String columnName, BigDecimal x)
3328: throws SQLException {
3329: crsInternal.updateBigDecimal(columnName, x);
3330: }
3331:
3332: /**
3333: * Sets the designated column in either the current row or the insert
3334: * row of this <code>JoinRowSetImpl</code> object with the given
3335: * <code>String</code> object.
3336: *
3337: * This method updates a column value in either the current row or
3338: * the insert row of this rowset, but it does not update the
3339: * database. If the cursor is on a row in the rowset, the
3340: * method {@link #updateRow} must be called to update the database.
3341: * If the cursor is on the insert row, the method {@link #insertRow}
3342: * must be called, which will insert the new row into both this rowset
3343: * and the database. Both of these methods must be called before the
3344: * cursor moves to another row.
3345: *
3346: * @param columnName a <code>String</code> object that must match the
3347: * SQL name of a column in this rowset, ignoring case
3348: * @param x the new column value
3349: * @throws SQLException if (1) the given column name does not match the
3350: * name of a column in this rowset, (2) the cursor is not on
3351: * one of this rowset's rows or its insert row, or (3) this
3352: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3353: */
3354: public void updateString(String columnName, String x)
3355: throws SQLException {
3356: crsInternal.updateString(columnName, x);
3357: }
3358:
3359: /**
3360: * Sets the designated column in either the current row or the insert
3361: * row of this <code>JoinRowSetImpl</code> object with the given
3362: * <code>byte</code> array.
3363: *
3364: * This method updates a column value in either the current row or
3365: * the insert row of this rowset, but it does not update the
3366: * database. If the cursor is on a row in the rowset, the
3367: * method {@link #updateRow} must be called to update the database.
3368: * If the cursor is on the insert row, the method {@link #insertRow}
3369: * must be called, which will insert the new row into both this rowset
3370: * and the database. Both of these methods must be called before the
3371: * cursor moves to another row.
3372: *
3373: * @param columnName a <code>String</code> object that must match the
3374: * SQL name of a column in this rowset, ignoring case
3375: * @param x the new column value
3376: * @throws SQLException if (1) the given column name does not match the
3377: * name of a column in this rowset, (2) the cursor is not on
3378: * one of this rowset's rows or its insert row, or (3) this
3379: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3380: */
3381: public void updateBytes(String columnName, byte x[])
3382: throws SQLException {
3383: crsInternal.updateBytes(columnName, x);
3384: }
3385:
3386: /**
3387: * Sets the designated column in either the current row or the insert
3388: * row of this <code>JoinRowSetImpl</code> object with the given
3389: * <code>Date</code> object.
3390: *
3391: * This method updates a column value in either the current row or
3392: * the insert row of this rowset, but it does not update the
3393: * database. If the cursor is on a row in the rowset, the
3394: * method {@link #updateRow} must be called to update the database.
3395: * If the cursor is on the insert row, the method {@link #insertRow}
3396: * must be called, which will insert the new row into both this rowset
3397: * and the database. Both of these methods must be called before the
3398: * cursor moves to another row.
3399: *
3400: * @param columnName a <code>String</code> object that must match the
3401: * SQL name of a column in this rowset, ignoring case
3402: * @param x the new column value
3403: * @throws SQLException if (1) the given column name does not match the
3404: * name of a column in this rowset, (2) the cursor is not on
3405: * one of this rowset's rows or its insert row, (3) the type
3406: * of the designated column is not an SQL <code>DATE</code> or
3407: * <code>TIMESTAMP</code>, or (4) this rowset is
3408: * <code>ResultSet.CONCUR_READ_ONLY</code>
3409: */
3410: public void updateDate(String columnName, java.sql.Date x)
3411: throws SQLException {
3412: crsInternal.updateDate(columnName, x);
3413: }
3414:
3415: /**
3416: * Sets the designated column in either the current row or the insert
3417: * row of this <code>JoinRowSetImpl</code> object with the given
3418: * <code>Time</code> object.
3419: *
3420: * This method updates a column value in either the current row or
3421: * the insert row of this rowset, but it does not update the
3422: * database. If the cursor is on a row in the rowset, the
3423: * method {@link #updateRow} must be called to update the database.
3424: * If the cursor is on the insert row, the method {@link #insertRow}
3425: * must be called, which will insert the new row into both this rowset
3426: * and the database. Both of these methods must be called before the
3427: * cursor moves to another row.
3428: *
3429: * @param columnName a <code>String</code> object that must match the
3430: * SQL name of a column in this rowset, ignoring case
3431: * @param x the new column value
3432: * @throws SQLException if (1) the given column name does not match the
3433: * name of a column in this rowset, (2) the cursor is not on
3434: * one of this rowset's rows or its insert row, (3) the type
3435: * of the designated column is not an SQL <code>TIME</code> or
3436: * <code>TIMESTAMP</code>, or (4) this rowset is
3437: * <code>ResultSet.CONCUR_READ_ONLY</code>
3438: */
3439: public void updateTime(String columnName, java.sql.Time x)
3440: throws SQLException {
3441: crsInternal.updateTime(columnName, x);
3442: }
3443:
3444: /**
3445: * Sets the designated column in either the current row or the insert
3446: * row of this <code>JoinRowSetImpl</code> object with the given
3447: * <code>Timestamp</code> object.
3448: *
3449: * This method updates a column value in either the current row or
3450: * the insert row of this rowset, but it does not update the
3451: * database. If the cursor is on a row in the rowset, the
3452: * method {@link #updateRow} must be called to update the database.
3453: * If the cursor is on the insert row, the method {@link #insertRow}
3454: * must be called, which will insert the new row into both this rowset
3455: * and the database. Both of these methods must be called before the
3456: * cursor moves to another row.
3457: *
3458: * @param columnName a <code>String</code> object that must match the
3459: * SQL name of a column in this rowset, ignoring case
3460: * @param x the new column value
3461: * @throws SQLException if the given column index is out of bounds or
3462: * the cursor is not on one of this rowset's rows or its
3463: * insert row
3464: * @throws SQLException if (1) the given column name does not match the
3465: * name of a column in this rowset, (2) the cursor is not on
3466: * one of this rowset's rows or its insert row, (3) the type
3467: * of the designated column is not an SQL <code>DATE</code>,
3468: * <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this
3469: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3470: */
3471: public void updateTimestamp(String columnName, java.sql.Timestamp x)
3472: throws SQLException {
3473: crsInternal.updateTimestamp(columnName, x);
3474: }
3475:
3476: /**
3477: * Unsupported; throws an <code>UnsupportedOperationException</code>
3478: * if called.
3479: * <P>
3480: * Sets the designated column in either the current row or the insert
3481: * row of this <code>JoinRowSetImpl</code> object with the given
3482: * ASCII stream value.
3483: * <P>
3484: * This method updates a column value in either the current row or
3485: * the insert row of this rowset, but it does not update the
3486: * database. If the cursor is on a row in the rowset, the
3487: * method {@link #updateRow} must be called to update the database.
3488: * If the cursor is on the insert row, the method {@link #insertRow}
3489: * must be called, which will insert the new row into both this rowset
3490: * and the database. Both of these methods must be called before the
3491: * cursor moves to another row.
3492: *
3493: * @param columnName a <code>String</code> object that must match the
3494: * SQL name of a column in this rowset, ignoring case
3495: * @param x the new column value
3496: * @param length the number of one-byte ASCII characters in the stream
3497: * @throws UnsupportedOperationException if this method is invoked
3498: */
3499: public void updateAsciiStream(String columnName,
3500: java.io.InputStream x, int length) throws SQLException {
3501: crsInternal.updateAsciiStream(columnName, x, length);
3502: }
3503:
3504: /**
3505: * Sets the designated column in either the current row or the insert
3506: * row of this <code>JoinRowSetImpl</code> object with the given
3507: * <code>java.io.InputStream</code> object.
3508: * <P>
3509: * This method updates a column value in either the current row or
3510: * the insert row of this rowset, but it does not update the
3511: * database. If the cursor is on a row in the rowset, the
3512: * method {@link #updateRow} must be called to update the database.
3513: * If the cursor is on the insert row, the method {@link #insertRow}
3514: * must be called, which will insert the new row into both this rowset
3515: * and the database. Both of these methods must be called before the
3516: * cursor moves to another row.
3517: *
3518: * @param columnName a <code>String</code> object that must match the
3519: * SQL name of a column in this rowset, ignoring case
3520: * @param x the new column value; must be a <code>java.io.InputStream</code>
3521: * containing <code>BINARY</code>, <code>VARBINARY</code>, or
3522: * <code>LONGVARBINARY</code> data
3523: * @param length the length of the stream in bytes
3524: * @throws SQLException if (1) the given column name does not match the
3525: * name of a column in this rowset, (2) the cursor is not on
3526: * one of this rowset's rows or its insert row, (3) the data
3527: * in the stream is not binary, or (4) this rowset is
3528: * <code>ResultSet.CONCUR_READ_ONLY</code>
3529: */
3530: public void updateBinaryStream(String columnName,
3531: java.io.InputStream x, int length) throws SQLException {
3532: crsInternal.updateBinaryStream(columnName, x, length);
3533: }
3534:
3535: /**
3536: * Sets the designated column in either the current row or the insert
3537: * row of this <code>JoinRowSetImpl</code> object with the given
3538: * <code>java.io.Reader</code> object.
3539: * <P>
3540: * This method updates a column value in either the current row or
3541: * the insert row of this rowset, but it does not update the
3542: * database. If the cursor is on a row in the rowset, the
3543: * method {@link #updateRow} must be called to update the database.
3544: * If the cursor is on the insert row, the method {@link #insertRow}
3545: * must be called, which will insert the new row into both this rowset
3546: * and the database. Both of these methods must be called before the
3547: * cursor moves to another row.
3548: *
3549: * @param columnName a <code>String</code> object that must match the
3550: * SQL name of a column in this rowset, ignoring case
3551: * @param x the new column value; must be a <code>java.io.Reader</code>
3552: * containing <code>BINARY</code>, <code>VARBINARY</code>,
3553: * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
3554: * or <code>LONGVARCHAR</code> data
3555: * @param length the length of the stream in characters
3556: * @throws SQLException if (1) the given column name does not match the
3557: * name of a column in this rowset, (2) the cursor is not on
3558: * one of this rowset's rows or its insert row, (3) the data
3559: * in the stream is not a binary or character type, or (4) this
3560: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3561: */
3562: public void updateCharacterStream(String columnName,
3563: java.io.Reader x, int length) throws SQLException {
3564: crsInternal.updateCharacterStream(columnName, x, length);
3565: }
3566:
3567: /**
3568: * Sets the designated column in either the current row or the insert
3569: * row of this <code>JoinRowSetImpl</code> object with the given
3570: * <code>Object</code> value. The <code>scale</code> parameter
3571: * indicates the number of digits to the right of the decimal point
3572: * and is ignored if the new column value is not a type that will be
3573: * mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value.
3574: * <P>
3575: * This method updates a column value in either the current row or
3576: * the insert row of this rowset, but it does not update the
3577: * database. If the cursor is on a row in the rowset, the
3578: * method {@link #updateRow} must be called to update the database.
3579: * If the cursor is on the insert row, the method {@link #insertRow}
3580: * must be called, which will insert the new row into both this rowset
3581: * and the database. Both of these methods must be called before the
3582: * cursor moves to another row.
3583: *
3584: * @param columnName a <code>String</code> object that must match the
3585: * SQL name of a column in this rowset, ignoring case
3586: * @param x the new column value
3587: * @param scale the number of digits to the right of the decimal point (for
3588: * <code>DECIMAL</code> and <code>NUMERIC</code> types only)
3589: * @throws SQLException if the given column index is out of bounds or
3590: * the cursor is not on one of this rowset's rows or its
3591: * insert row
3592: * @throws SQLException if (1) the given column name does not match the
3593: * name of a column in this rowset, (2) the cursor is not on
3594: * one of this rowset's rows or its insert row, or (3) this
3595: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3596: */
3597: public void updateObject(String columnName, Object x, int scale)
3598: throws SQLException {
3599: crsInternal.updateObject(columnName, x, scale);
3600: }
3601:
3602: /**
3603: * Sets the designated column in either the current row or the insert
3604: * row of this <code>JoinRowSetImpl</code> object with the given
3605: * <code>Object</code> value.
3606: * <P>
3607: * This method updates a column value in either the current row or
3608: * the insert row of this rowset, but it does not update the
3609: * database. If the cursor is on a row in the rowset, the
3610: * method {@link #updateRow} must be called to update the database.
3611: * If the cursor is on the insert row, the method {@link #insertRow}
3612: * must be called, which will insert the new row into both this rowset
3613: * and the database. Both of these methods must be called before the
3614: * cursor moves to another row.
3615: *
3616: * @param columnName a <code>String</code> object that must match the
3617: * SQL name of a column in this rowset, ignoring case
3618: * @param x the new column value
3619: * @throws SQLException if (1) the given column name does not match the
3620: * name of a column in this rowset, (2) the cursor is not on
3621: * one of this rowset's rows or its insert row, or (3) this
3622: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3623: */
3624: public void updateObject(String columnName, Object x)
3625: throws SQLException {
3626: crsInternal.updateObject(columnName, x);
3627: }
3628:
3629: /**
3630: * Inserts the contents of this <code>JoinRowSetImpl</code> object's insert
3631: * row into this rowset immediately following the current row.
3632: * If the current row is the
3633: * position after the last row or before the first row, the new row will
3634: * be inserted at the end of the rowset. This method also notifies
3635: * listeners registered with this rowset that the row has changed.
3636: * <P>
3637: * The cursor must be on the insert row when this method is called.
3638: *
3639: * @throws SQLException if (1) the cursor is not on the insert row,
3640: * (2) one or more of the non-nullable columns in the insert
3641: * row has not been given a value, or (3) this rowset is
3642: * <code>ResultSet.CONCUR_READ_ONLY</code>
3643: */
3644: public void insertRow() throws SQLException {
3645: crsInternal.insertRow();
3646: }
3647:
3648: /**
3649: * Marks the current row of this <code>JoinRowSetImpl</code> object as
3650: * updated and notifies listeners registered with this rowset that the
3651: * row has changed.
3652: * <P>
3653: * This method cannot be called when the cursor is on the insert row, and
3654: * it should be called before the cursor moves to another row. If it is
3655: * called after the cursor moves to another row, this method has no effect,
3656: * and the updates made before the cursor moved will be lost.
3657: *
3658: * @throws SQLException if the cursor is on the insert row or this
3659: * rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
3660: */
3661: public void updateRow() throws SQLException {
3662: crsInternal.updateRow();
3663: }
3664:
3665: /**
3666: * Deletes the current row from this <code>JoinRowSetImpl</code> object and
3667: * notifies listeners registered with this rowset that a row has changed.
3668: * This method cannot be called when the cursor is on the insert row.
3669: * <P>
3670: * This method marks the current row as deleted, but it does not delete
3671: * the row from the underlying data source. The method
3672: * <code>acceptChanges</code> must be called to delete the row in
3673: * the data source.
3674: *
3675: * @throws SQLException if (1) this method is called when the cursor
3676: * is on the insert row, before the first row, or after the
3677: * last row or (2) this rowset is
3678: * <code>ResultSet.CONCUR_READ_ONLY</code>
3679: */
3680: public void deleteRow() throws SQLException {
3681: crsInternal.deleteRow();
3682: }
3683:
3684: /**
3685: * Sets the current row with its original value and marks the row as
3686: * not updated, thus undoing any changes made to the row since the
3687: * last call to the methods <code>updateRow</code> or <code>deleteRow</code>.
3688: * This method should be called only when the cursor is on a row in
3689: * this rowset.
3690: *
3691: * @throws SQLException if the cursor is on the insert row, before the
3692: * first row, or after the last row
3693: */
3694: public void refreshRow() throws SQLException {
3695: crsInternal.refreshRow();
3696: }
3697:
3698: /**
3699: * Rolls back any updates made to the current row of this
3700: * <code>JoinRowSetImpl</code> object and notifies listeners that
3701: * a row has changed. To have an effect, this method
3702: * must be called after an <code>updateXXX</code> method has been
3703: * called and before the method <code>updateRow</code> has been called.
3704: * If no updates have been made or the method <code>updateRow</code>
3705: * has already been called, this method has no effect.
3706: * <P>
3707: * After <code>updateRow</code> is called it is the
3708: * <code>cancelRowUpdates</code> has no affect on the newly
3709: * inserted values. The method <code>cancelRowInsert</code> can
3710: * be used to remove any rows inserted into the RowSet.
3711: *
3712: * @throws SQLException if the cursor is on the insert row, before the
3713: * first row, or after the last row
3714: */
3715: public void cancelRowUpdates() throws SQLException {
3716: crsInternal.cancelRowUpdates();
3717: }
3718:
3719: /**
3720: * Moves the cursor for this <code>JoinRowSetImpl</code> object
3721: * to the insert row. The current row in the rowset is remembered
3722: * while the cursor is on the insert row.
3723: * <P>
3724: * The insert row is a special row associated with an updatable
3725: * rowset. It is essentially a buffer where a new row may
3726: * be constructed by calling the appropriate <code>updateXXX</code>
3727: * methods to assign a value to each column in the row. A complete
3728: * row must be constructed; that is, every column that is not nullable
3729: * must be assigned a value. In order for the new row to become part
3730: * of this rowset, the method <code>insertRow</code> must be called
3731: * before the cursor is moved back to the rowset.
3732: * <P>
3733: * Only certain methods may be invoked while the cursor is on the insert
3734: * row; many methods throw an exception if they are called while the
3735: * cursor is there. In addition to the <code>updateXXX</code>
3736: * and <code>insertRow</code> methods, only the <code>getXXX</code> methods
3737: * may be called when the cursor is on the insert row. A <code>getXXX</code>
3738: * method should be called on a column only after an <code>updateXXX</code>
3739: * method has been called on that column; otherwise, the value returned is
3740: * undetermined.
3741: *
3742: * @throws SQLException if this <code>JoinRowSetImpl</code> object is
3743: * <code>ResultSet.CONCUR_READ_ONLY</code>
3744: */
3745: public void moveToInsertRow() throws SQLException {
3746: crsInternal.moveToInsertRow();
3747: }
3748:
3749: /**
3750: * Moves the cursor for this <code>JoinRowSetImpl</code> object to
3751: * the current row. The current row is the row the cursor was on
3752: * when the method <code>moveToInsertRow</code> was called.
3753: * <P>
3754: * Calling this method has no effect unless it is called while the
3755: * cursor is on the insert row.
3756: *
3757: * @throws SQLException if an error occurs
3758: */
3759: public void moveToCurrentRow() throws SQLException {
3760: crsInternal.moveToCurrentRow();
3761: }
3762:
3763: /**
3764: * Returns <code>null</code>.
3765: *
3766: * @return <code>null</code>
3767: * @throws SQLException if an error occurs
3768: */
3769: public Statement getStatement() throws SQLException {
3770: return crsInternal.getStatement();
3771: }
3772:
3773: /**
3774: * Retrieves the value of the designated column in this
3775: * <code>JoinRowSetImpl</code> object as a <code>Ref</code> object
3776: * in the Java programming lanugage.
3777: *
3778: * @param columnIndex the first column is <code>1</code>, the second
3779: * is <code>2</code>, and so on; must be <code>1</code> or larger
3780: * and equal to or less than the number of columns in this rowset
3781: * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
3782: * @throws SQLException if (1) the given column index is out of bounds,
3783: * (2) the cursor is not on one of this rowset's rows or its
3784: * insert row, or (3) the designated column does not store an
3785: * SQL <code>REF</code> value
3786: */
3787: public Ref getRef(int columnIndex) throws SQLException {
3788: return crsInternal.getRef(columnIndex);
3789: }
3790:
3791: /**
3792: * Retrieves the value of the designated column in this
3793: * <code>JoinRowSetImpl</code> object as a <code>Blob</code> object
3794: * in the Java programming lanugage.
3795: *
3796: * @param columnIndex the first column is <code>1</code>, the second
3797: * is <code>2</code>, and so on; must be <code>1</code> or larger
3798: * and equal to or less than the number of columns in this rowset
3799: * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
3800: * @throws SQLException if (1) the given column index is out of bounds,
3801: * (2) the cursor is not on one of this rowset's rows or its
3802: * insert row, or (3) the designated column does not store an
3803: * SQL <code>BLOB</code> value
3804: */
3805: public Blob getBlob(int columnIndex) throws SQLException {
3806: return crsInternal.getBlob(columnIndex);
3807: }
3808:
3809: /**
3810: * Retrieves the value of the designated column in this
3811: * <code>JoinRowSetImpl</code> object as a <code>Clob</code> object
3812: * in the Java programming lanugage.
3813: *
3814: * @param columnIndex the first column is <code>1</code>, the second
3815: * is <code>2</code>, and so on; must be <code>1</code> or larger
3816: * and equal to or less than the number of columns in this rowset
3817: * @return a <code>Clob</code> object representing an SQL <code>CLOB</code> value
3818: * @throws SQLException if (1) the given column index is out of bounds,
3819: * (2) the cursor is not on one of this rowset's rows or its
3820: * insert row, or (3) the designated column does not store an
3821: * SQL <code>CLOB</code> value
3822: */
3823: public Clob getClob(int columnIndex) throws SQLException {
3824: return crsInternal.getClob(columnIndex);
3825: }
3826:
3827: /**
3828: * Retrieves the value of the designated column in this
3829: * <code>JoinRowSetImpl</code> object as an <code>Array</code> object
3830: * in the Java programming lanugage.
3831: *
3832: * @param columnIndex the first column is <code>1</code>, the second
3833: * is <code>2</code>, and so on; must be <code>1</code> or larger
3834: * and equal to or less than the number of columns in this rowset
3835: * @return an <code>Array</code> object representing an SQL
3836: * <code>ARRAY</code> value
3837: * @throws SQLException if (1) the given column index is out of bounds,
3838: * (2) the cursor is not on one of this rowset's rows or its
3839: * insert row, or (3) the designated column does not store an
3840: * SQL <code>ARRAY</code> value
3841: */
3842: public Array getArray(int columnIndex) throws SQLException {
3843: return crsInternal.getArray(columnIndex);
3844: }
3845:
3846: // ColumnName
3847:
3848: /**
3849: * Retrieves the value of the designated column in this
3850: * <code>JoinRowSetImpl</code> object as a <code>Ref</code> object
3851: * in the Java programming lanugage.
3852: *
3853: * @param columnName a <code>String</code> object that must match the
3854: * SQL name of a column in this rowset, ignoring case
3855: * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
3856: * @throws SQLException if (1) the given column name is not the name
3857: * of a column in this rowset, (2) the cursor is not on one of
3858: * this rowset's rows or its insert row, or (3) the column value
3859: * is not an SQL <code>REF</code> value
3860: */
3861: public Ref getRef(String columnName) throws SQLException {
3862: return crsInternal.getRef(columnName);
3863: }
3864:
3865: /**
3866: * Retrieves the value of the designated column in this
3867: * <code>JoinRowSetImpl</code> object as a <code>Blob</code> object
3868: * in the Java programming lanugage.
3869: *
3870: * @param columnName a <code>String</code> object that must match the
3871: * SQL name of a column in this rowset, ignoring case
3872: * @return a <code>Blob</code> object representing an SQL
3873: * <code>BLOB</code> value
3874: * @throws SQLException if (1) the given column name is not the name of
3875: * a column in this rowset, (2) the cursor is not on one of
3876: * this rowset's rows or its insert row, or (3) the designated
3877: * column does not store an SQL <code>BLOB</code> value
3878: */
3879: public Blob getBlob(String columnName) throws SQLException {
3880: return crsInternal.getBlob(columnName);
3881: }
3882:
3883: /**
3884: * Retrieves the value of the designated column in this
3885: * <code>JoinRowSetImpl</code> object as a <code>Clob</code> object
3886: * in the Java programming lanugage.
3887: *
3888: * @param columnName a <code>String</code> object that must match the
3889: * SQL name of a column in this rowset, ignoring case
3890: * @return a <code>Clob</code> object representing an SQL
3891: * <code>CLOB</code> value
3892: * @throws SQLException if (1) the given column name is not the name of
3893: * a column in this rowset, (2) the cursor is not on one of
3894: * this rowset's rows or its insert row, or (3) the designated
3895: * column does not store an SQL <code>CLOB</code> value
3896: */
3897: public Clob getClob(String columnName) throws SQLException {
3898: return crsInternal.getClob(columnName);
3899: }
3900:
3901: /**
3902: * Retrieves the value of the designated column in this
3903: * <code>JoinRowSetImpl</code> object as an <code>Array</code> object
3904: * in the Java programming lanugage.
3905: *
3906: * @param columnName a <code>String</code> object that must match the
3907: * SQL name of a column in this rowset, ignoring case
3908: * @return an <code>Array</code> object representing an SQL
3909: * <code>ARRAY</code> value
3910: * @throws SQLException if (1) the given column name is not the name of
3911: * a column in this rowset, (2) the cursor is not on one of
3912: * this rowset's rows or its insert row, or (3) the designated
3913: * column does not store an SQL <code>ARRAY</code> value
3914: */
3915: public Array getArray(String columnName) throws SQLException {
3916: return crsInternal.getArray(columnName);
3917: }
3918:
3919: /**
3920: * Retrieves the value of the designated column in the current row
3921: * of this <code>JoinRowSetImpl</code> object as a <code>java.sql.Date</code>
3922: * object, using the given <code>Calendar</code> object to construct an
3923: * appropriate millisecond value for the date.
3924: *
3925: * @param columnIndex the first column is <code>1</code>, the second
3926: * is <code>2</code>, and so on; must be <code>1</code> or larger
3927: * and equal to or less than the number of columns in the rowset
3928: * @param cal the <code>java.util.Calendar</code> object to use in
3929: * constructing the date
3930: * @return the column value; if the value is SQL <code>NULL</code>,
3931: * the result is <code>null</code>
3932: * @throws SQLException if (1) the given column name is not the name of
3933: * a column in this rowset, (2) the cursor is not on one of
3934: * this rowset's rows or its insert row, or (3) the designated
3935: * column does not store an SQL <code>DATE</code> or
3936: * <code>TIMESTAMP</code> value
3937: */
3938: public java.sql.Date getDate(int columnIndex, Calendar cal)
3939: throws SQLException {
3940: return crsInternal.getDate(columnIndex, cal);
3941: }
3942:
3943: /**
3944: * Retrieves the value of the designated column in the current row
3945: * of this <code>JoinRowSetImpl</code> object as a <code>java.sql.Date</code>
3946: * object, using the given <code>Calendar</code> object to construct an
3947: * appropriate millisecond value for the date.
3948: *
3949: * @param columnName a <code>String</code> object that must match the
3950: * SQL name of a column in this rowset, ignoring case
3951: * @param cal the <code>java.util.Calendar</code> object to use in
3952: * constructing the date
3953: * @return the column value; if the value is SQL <code>NULL</code>,
3954: * the result is <code>null</code>
3955: * @throws SQLException if (1) the given column name is not the name of
3956: * a column in this rowset, (2) the cursor is not on one of
3957: * this rowset's rows or its insert row, or (3) the designated
3958: * column does not store an SQL <code>DATE</code> or
3959: * <code>TIMESTAMP</code> value
3960: */
3961: public java.sql.Date getDate(String columnName, Calendar cal)
3962: throws SQLException {
3963: return crsInternal.getDate(columnName, cal);
3964: }
3965:
3966: /**
3967: * Retrieves the value of the designated column in the current row
3968: * of this <code>JoinRowSetImpl</code> object as a <code>java.sql.Time</code>
3969: * object, using the given <code>Calendar</code> object to construct an
3970: * appropriate millisecond value for the date.
3971: *
3972: * @param columnIndex the first column is <code>1</code>, the second
3973: * is <code>2</code>, and so on; must be <code>1</code> or larger
3974: * and equal to or less than the number of columns in the rowset
3975: * @param cal the <code>java.util.Calendar</code> object to use in
3976: * constructing the date
3977: * @return the column value; if the value is SQL <code>NULL</code>,
3978: * the result is <code>null</code>
3979: * @throws SQLException if (1) the given column name is not the name of
3980: * a column in this rowset, (2) the cursor is not on one of
3981: * this rowset's rows or its insert row, or (3) the designated
3982: * column does not store an SQL <code>TIME</code> or
3983: * <code>TIMESTAMP</code> value
3984: */
3985: public java.sql.Time getTime(int columnIndex, Calendar cal)
3986: throws SQLException {
3987: return crsInternal.getTime(columnIndex, cal);
3988: }
3989:
3990: /**
3991: * Retrieves the value of the designated column in the current row
3992: * of this <code>JoinRowSetImpl</code> object as a <code>java.sql.Time</code>
3993: * object, using the given <code>Calendar</code> object to construct an
3994: * appropriate millisecond value for the date.
3995: *
3996: * @param columnName a <code>String</code> object that must match the
3997: * SQL name of a column in this rowset, ignoring case
3998: * @param cal the <code>java.util.Calendar</code> object to use in
3999: * constructing the date
4000: * @return the column value; if the value is SQL <code>NULL</code>,
4001: * the result is <code>null</code>
4002: * @throws SQLException if (1) the given column name is not the name of
4003: * a column in this rowset, (2) the cursor is not on one of
4004: * this rowset's rows or its insert row, or (3) the designated
4005: * column does not store an SQL <code>TIME</code> or
4006: * <code>TIMESTAMP</code> value
4007: */
4008: public java.sql.Time getTime(String columnName, Calendar cal)
4009: throws SQLException {
4010: return crsInternal.getTime(columnName, cal);
4011: }
4012:
4013: /**
4014: * Retrieves the value of the designated column in the current row
4015: * of this <code>JoinRowSetImpl</code> object as a <code>java.sql.Timestamp</code>
4016: * object, using the given <code>Calendar</code> object to construct an
4017: * appropriate millisecond value for the date.
4018: *
4019: * @param columnIndex the first column is <code>1</code>, the second
4020: * is <code>2</code>, and so on; must be <code>1</code> or larger
4021: * and equal to or less than the number of columns in the rowset
4022: * @param cal the <code>java.util.Calendar</code> object to use in
4023: * constructing the date
4024: * @return the column value; if the value is SQL <code>NULL</code>,
4025: * the result is <code>null</code>
4026: * @throws SQLException if (1) the given column name is not the name of
4027: * a column in this rowset, (2) the cursor is not on one of
4028: * this rowset's rows or its insert row, or (3) the designated
4029: * column does not store an SQL <code>TIME</code> or
4030: * <code>TIMESTAMP</code> value
4031: */
4032: public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal)
4033: throws SQLException {
4034: return crsInternal.getTimestamp(columnIndex, cal);
4035: }
4036:
4037: /**
4038: * Retrieves the value of the designated column in the current row
4039: * of this <code>JoinRowSetImpl</code> object as a
4040: * <code>java.sql.Timestamp</code> object, using the given
4041: * <code>Calendar</code> object to construct an appropriate
4042: * millisecond value for the date.
4043: *
4044: * @param columnName a <code>String</code> object that must match the
4045: * SQL name of a column in this rowset, ignoring case
4046: * @param cal the <code>java.util.Calendar</code> object to use in
4047: * constructing the date
4048: * @return the column value; if the value is SQL <code>NULL</code>,
4049: * the result is <code>null</code>
4050: * @throws SQLException if (1) the given column name is not the name of
4051: * a column in this rowset, (2) the cursor is not on one of
4052: * this rowset's rows or its insert row, or (3) the designated
4053: * column does not store an SQL <code>DATE</code>,
4054: * <code>TIME</code>, or <code>TIMESTAMP</code> value
4055: */
4056: public java.sql.Timestamp getTimestamp(String columnName,
4057: Calendar cal) throws SQLException {
4058: return crsInternal.getTimestamp(columnName, cal);
4059: }
4060:
4061: /**
4062: * Sets the metadata for this <code>JoinRowSetImpl</code> object
4063: * with the given <code>RowSetMetaData</code> object.
4064: *
4065: * @param md a <code>RowSetMetaData</code> object instance containing
4066: * metadata about the columsn in the rowset
4067: * @throws SQLException if invalid meta data is supplied to the
4068: * rowset
4069: */
4070: public void setMetaData(RowSetMetaData md) throws SQLException {
4071: crsInternal.setMetaData(md);
4072: }
4073:
4074: public ResultSet getOriginal() throws SQLException {
4075: return crsInternal.getOriginal();
4076: }
4077:
4078: /**
4079: * Returns a result set containing the original value of the rowset.
4080: * The cursor is positioned before the first row in the result set.
4081: * Only rows contained in the result set returned by getOriginal()
4082: * are said to have an original value.
4083: *
4084: * @return the original result set of the rowset
4085: * @throws SQLException if an error occurs produce the
4086: * <code>ResultSet</code> object
4087: */
4088: public ResultSet getOriginalRow() throws SQLException {
4089: return crsInternal.getOriginalRow();
4090: }
4091:
4092: /**
4093: * Returns a result set containing the original value of the current
4094: * row only.
4095: *
4096: * @return the original result set of the row
4097: * @throws SQLException if there is no current row
4098: * @see #setOriginalRow
4099: */
4100: public void setOriginalRow() throws SQLException {
4101: crsInternal.setOriginalRow();
4102: }
4103:
4104: /**
4105: * Returns the columns that make a key to uniquely identify a
4106: * row in this <code>JoinRowSetImpl</code> object.
4107: *
4108: * @return an array of column number that constites a primary
4109: * key for this rowset. This array should be empty
4110: * if no columns is representitive of a primary key
4111: * @throws SQLException if the rowset is empty or no columns
4112: * are designated as primary keys
4113: * @see #setKeyColumns
4114: */
4115: public int[] getKeyColumns() throws SQLException {
4116: return crsInternal.getKeyColumns();
4117: }
4118:
4119: /**
4120: * Sets this <code>JoinRowSetImpl</code> object's
4121: * <code>keyCols</code> field with the given array of column
4122: * numbers, which forms a key for uniquely identifying a row
4123: * in this rowset.
4124: *
4125: * @param cols an array of <code>int</code> indicating the
4126: * columns that form a primary key for this
4127: * <code>JoinRowSetImpl</code> object; every
4128: * element in the array must be greater than
4129: * <code>0</code> and less than or equal to the number
4130: * of columns in this rowset
4131: * @throws SQLException if any of the numbers in the
4132: * given array is not valid for this rowset
4133: * @see #getKeyColumns
4134: */
4135: public void setKeyColumns(int[] cols) throws SQLException {
4136: crsInternal.setKeyColumns(cols);
4137: }
4138:
4139: /**
4140: * Sets the designated column in either the current row or the insert
4141: * row of this <code>JoinRowSetImpl</code> object with the given
4142: * <code>Ref</code> value.
4143: * <P>
4144: * This method updates a column value in the current row or the insert
4145: * row of this rowset, but it does not update the database.
4146: * If the cursor is on a row in the rowset, the
4147: * method {@link #updateRow} must be called to update the database.
4148: * If the cursor is on the insert row, the method {@link #insertRow}
4149: * must be called, which will insert the new row into both this rowset
4150: * and the database. Either of these methods must be called before the
4151: * cursor moves to another row.
4152: *
4153: * @param columnIndex the first column is <code>1</code>, the second
4154: * is <code>2</code>, and so on; must be <code>1</code> or larger
4155: * and equal to or less than the number of columns in this rowset
4156: * @param ref the <code>java.sql.Ref</code> object that will be set as
4157: * the new column value
4158: * @throws SQLException if (1) the given column index is out of bounds,
4159: * (2) the cursor is not on one of this rowset's rows or its
4160: * insert row, or (3) this rowset is
4161: * <code>ResultSet.CONCUR_READ_ONLY</code>
4162: */
4163: public void updateRef(int columnIndex, java.sql.Ref ref)
4164: throws SQLException {
4165: crsInternal.updateRef(columnIndex, ref);
4166: }
4167:
4168: /**
4169: * Sets the designated column in either the current row or the insert
4170: * row of this <code>JoinRowSetImpl</code> object with the given
4171: * <code>Ref</code> value.
4172: * <P>
4173: * This method updates a column value in the current row or the insert
4174: * row of this rowset, but it does not update the database.
4175: * If the cursor is on a row in the rowset, the
4176: * method {@link #updateRow} must be called to update the database.
4177: * If the cursor is on the insert row, the method {@link #insertRow}
4178: * must be called, which will insert the new row into both this rowset
4179: * and the database. Either of these methods must be called before the
4180: * cursor moves to another row.
4181: *
4182: * @param columnName a <code>String</code> object giving the name of the column
4183: * to be updated; must match one of the column names in this
4184: * <code>JoinRowSetImpl</code> object
4185: * @param ref the <code>java.sql.Ref</code> object that will be set as
4186: * the new column value
4187: * @throws SQLException if (1) the given column name is not valid,
4188: * (2) the cursor is not on one of this rowset's rows or its
4189: * insert row, or (3) this rowset is
4190: * <code>ResultSet.CONCUR_READ_ONLY</code>
4191: */
4192: public void updateRef(String columnName, java.sql.Ref ref)
4193: throws SQLException {
4194: crsInternal.updateRef(columnName, ref);
4195: }
4196:
4197: /**
4198: * Sets the designated column in either the current row or the insert
4199: * row of this <code>JoinRowSetImpl</code> object with the given
4200: * <code>Clob</code> object.
4201: * <P>
4202: * This method updates a column value in the current row or the insert
4203: * row of this rowset, but it does not update the database.
4204: * If the cursor is on a row in the rowset, the
4205: * method {@link #updateRow} must be called to update the database.
4206: * If the cursor is on the insert row, the method {@link #insertRow}
4207: * must be called, which will insert the new row into both this rowset
4208: * and the database. Either of these methods must be called before the
4209: * cursor moves to another row.
4210: *
4211: * @param columnIndex the first column is <code>1</code>, the second
4212: * is <code>2</code>, and so on; must be <code>1</code> or larger
4213: * and equal to or less than the number of columns in this rowset
4214: * @param c the <code>java.sql.Clob</code> object that will be set as
4215: * the new column value
4216: * @throws SQLException if (1) the given column index is out of bounds,
4217: * (2) the cursor is not on one of this rowset's rows or its
4218: * insert row, or (3) this rowset is
4219: * <code>ResultSet.CONCUR_READ_ONLY</code>
4220: */
4221: public void updateClob(int columnIndex, Clob c) throws SQLException {
4222: crsInternal.updateClob(columnIndex, c);
4223: }
4224:
4225: /**
4226: * Sets the designated column in either the current row or the insert
4227: * row of this <code>JoinRowSetImpl</code> object with the given
4228: * <code>Clob</code> object.
4229: * <P>
4230: * This method updates a column value in the current row or the insert
4231: * row of this rowset, but it does not update the database.
4232: * If the cursor is on a row in the rowset, the
4233: * method {@link #updateRow} must be called to update the database.
4234: * If the cursor is on the insert row, the method {@link #insertRow}
4235: * must be called, which will insert the new row into both this rowset
4236: * and the database. Either of these methods must be called before the
4237: * cursor moves to another row.
4238: *
4239: * @param columnName a <code>String</code> object giving the name of the column
4240: * to be updated; must match one of the column names in this
4241: * <code>JoinRowSetImpl</code> object
4242: * @param c the <code>java.sql.Clob</code> object that will be set as
4243: * the new column value
4244: * @throws SQLException if (1) the given column name is not valid,
4245: * (2) the cursor is not on one of this rowset's rows or its
4246: * insert row, or (3) this rowset is
4247: * <code>ResultSet.CONCUR_READ_ONLY</code>
4248: */
4249: public void updateClob(String columnName, Clob c)
4250: throws SQLException {
4251: crsInternal.updateClob(columnName, c);
4252: }
4253:
4254: /**
4255: * Sets the designated column in either the current row or the insert
4256: * row of this <code>JoinRowSetImpl</code> object with the given
4257: * <code>Blob</code> value.
4258: * <P>
4259: * This method updates a column value in the current row or the insert
4260: * row of this rowset, but it does not update the database.
4261: * If the cursor is on a row in the rowset, the
4262: * method {@link #updateRow} must be called to update the database.
4263: * If the cursor is on the insert row, the method {@link #insertRow}
4264: * must be called, which will insert the new row into both this rowset
4265: * and the database. Either of these methods must be called before the
4266: * cursor moves to another row.
4267: *
4268: * @param columnIndex the first column is <code>1</code>, the second
4269: * is <code>2</code>, and so on; must be <code>1</code> or larger
4270: * and equal to or less than the number of columns in this rowset
4271: * @param b the <code>java.sql.Blob</code> object that will be set as
4272: * the new column value
4273: * @throws SQLException if (1) the given column index is out of bounds,
4274: * (2) the cursor is not on one of this rowset's rows or its
4275: * insert row, or (3) this rowset is
4276: * <code>ResultSet.CONCUR_READ_ONLY</code>
4277: */
4278: public void updateBlob(int columnIndex, Blob b) throws SQLException {
4279: crsInternal.updateBlob(columnIndex, b);
4280: }
4281:
4282: /**
4283: * Sets the designated column in either the current row or the insert
4284: * row of this <code>JoinRowSetImpl</code> object with the given
4285: * <code>Blob</code> object.
4286: * <P>
4287: * This method updates a column value in the current row or the insert
4288: * row of this rowset, but it does not update the database.
4289: * If the cursor is on a row in the rowset, the
4290: * method {@link #updateRow} must be called to update the database.
4291: * If the cursor is on the insert row, the method {@link #insertRow}
4292: * must be called, which will insert the new row into both this rowset
4293: * and the database. Either of these methods must be called before the
4294: * cursor moves to another row.
4295: *
4296: * @param columnName a <code>String</code> object giving the name of the column
4297: * to be updated; must match one of the column names in this
4298: * <code>JoinRowSetImpl</code> object
4299: * @param b the <code>java.sql.Blob</code> object that will be set as
4300: * the new column value
4301: * @throws SQLException if (1) the given column name is not valid,
4302: * (2) the cursor is not on one of this rowset's rows or its
4303: * insert row, or (3) this rowset is
4304: * <code>ResultSet.CONCUR_READ_ONLY</code>
4305: */
4306: public void updateBlob(String columnName, Blob b)
4307: throws SQLException {
4308: crsInternal.updateBlob(columnName, b);
4309: }
4310:
4311: /**
4312: * Sets the designated column in either the current row or the insert
4313: * row of this <code>JoinRowSetImpl</code> object with the given
4314: * <code>Array</code> object.
4315: * <P>
4316: * This method updates a column value in the current row or the insert
4317: * row of this rowset, but it does not update the database.
4318: * If the cursor is on a row in the rowset, the
4319: * method {@link #updateRow} must be called to update the database.
4320: * If the cursor is on the insert row, the method {@link #insertRow}
4321: * must be called, which will insert the new row into both this rowset
4322: * and the database. Either of these methods must be called before the
4323: * cursor moves to another row.
4324: *
4325: * @param columnIndex the first column is <code>1</code>, the second
4326: * is <code>2</code>, and so on; must be <code>1</code> or larger
4327: * and equal to or less than the number of columns in this rowset
4328: * @param a the <code>java.sql.Array</code> object that will be set as
4329: * the new column value
4330: * @throws SQLException if (1) the given column index is out of bounds,
4331: * (2) the cursor is not on one of this rowset's rows or its
4332: * insert row, or (3) this rowset is
4333: * <code>ResultSet.CONCUR_READ_ONLY</code>
4334: */
4335: public void updateArray(int columnIndex, Array a)
4336: throws SQLException {
4337: crsInternal.updateArray(columnIndex, a);
4338: }
4339:
4340: /**
4341: * Sets the designated column in either the current row or the insert
4342: * row of this <code>JoinRowSetImpl</code> object with the given
4343: * <code>Array</code> object.
4344: * <P>
4345: * This method updates a column value in the current row or the insert
4346: * row of this rowset, but it does not update the database.
4347: * If the cursor is on a row in the rowset, the
4348: * method {@link #updateRow} must be called to update the database.
4349: * If the cursor is on the insert row, the method {@link #insertRow}
4350: * must be called, which will insert the new row into both this rowset
4351: * and the database. Either of these methods must be called before the
4352: * cursor moves to another row.
4353: *
4354: * @param columnName a <code>String</code> object giving the name of the column
4355: * to be updated; must match one of the column names in this
4356: * <code>JoinRowSetImpl</code> object
4357: * @param a the <code>java.sql.Array</code> object that will be set as
4358: * the new column value
4359: * @throws SQLException if (1) the given column name is not valid,
4360: * (2) the cursor is not on one of this rowset's rows or its
4361: * insert row, or (3) this rowset is
4362: * <code>ResultSet.CONCUR_READ_ONLY</code>
4363: */
4364: public void updateArray(String columnName, Array a)
4365: throws SQLException {
4366: crsInternal.updateArray(columnName, a);
4367: }
4368:
4369: /**
4370: * Populates this <code>JoinRowSetImpl</code> object with data.
4371: * This form of the method uses the rowset's user, password, and url or
4372: * data source name properties to create a database
4373: * connection. If properties that are needed
4374: * have not been set, this method will throw an exception.
4375: * <P>
4376: * Another form of this method uses an existing JDBC <code>Connection</code>
4377: * object instead of creating a new one; therefore, it ignores the
4378: * properties used for establishing a new connection.
4379: * <P>
4380: * The query specified by the command property is executed to create a
4381: * <code>ResultSet</code> object from which to retrieve data.
4382: * The current contents of the rowset are discarded, and the
4383: * rowset's metadata is also (re)set. If there are outstanding updates,
4384: * they are also ignored.
4385: * <P>
4386: * The method <code>execute</code> closes any database connections that it
4387: * creates.
4388: *
4389: * @throws SQLException if an error occurs or the
4390: * necessary properties have not been set
4391: */
4392: public void execute() throws SQLException {
4393: crsInternal.execute();
4394: }
4395:
4396: /**
4397: * Populates this <code>JoinRowSetImpl</code> object with data,
4398: * using the given connection to produce the result set from
4399: * which data will be read. A second form of this method,
4400: * which takes no arguments, uses the values from this rowset's
4401: * user, password, and either url or data source properties to
4402: * create a new database connection. The form of <code>execute</code>
4403: * that is given a connection ignores these properties.
4404: *
4405: * @param conn A standard JDBC <code>Connection</code> object with valid
4406: * properties that the <code>JoinRowSet</code> implementation
4407: * can pass to a synchronization provider to establish a
4408: * connection to the datasource
4409: * @throws SQLException if an invalid <code>Connection</code> is supplied
4410: * or an error occurs in establishing the connection to the
4411: * data soure
4412: * @see java.sql.Connection
4413: */
4414: public void execute(Connection conn) throws SQLException {
4415: crsInternal.execute(conn);
4416: }
4417:
4418: /**
4419: * Provide interface coverage for getURL(int) in ResultSet->RowSet
4420: */
4421: public java.net.URL getURL(int columnIndex) throws SQLException {
4422: return crsInternal.getURL(columnIndex);
4423: }
4424:
4425: /**
4426: * Provide interface coverage for getURL(String) in ResultSet->RowSet
4427: */
4428: public java.net.URL getURL(String columnName) throws SQLException {
4429: return crsInternal.getURL(columnName);
4430: }
4431:
4432: /**
4433: * Creates a new <code>WebRowSet</code> object, populates it with the
4434: * data in the given <code>ResultSet</code> object, and writes it
4435: * to the given <code>java.io.Writer</code> object in XML format.
4436: *
4437: * @throws SQLException if an error occurs writing out the rowset
4438: * contents to XML
4439: */
4440: public void writeXml(ResultSet rs, java.io.Writer writer)
4441: throws SQLException {
4442: wrs = new WebRowSetImpl();
4443: wrs.populate(rs);
4444: wrs.writeXml(writer);
4445: }
4446:
4447: /**
4448: * Writes this <code>JoinRowSet</code> object to the given
4449: * <code>java.io.Writer</code> object in XML format. In
4450: * addition to the rowset's data, its properties and metadata
4451: * are also included.
4452: *
4453: * @throws SQLException if an error occurs writing out the rowset
4454: * contents to XML
4455: */
4456: public void writeXml(java.io.Writer writer) throws SQLException {
4457: createWebRowSet().writeXml(writer);
4458: }
4459:
4460: /**
4461: * Reads this <code>JoinRowSet</code> object in its XML format.
4462: *
4463: * @throws SQLException if a database access error occurs
4464: */
4465: public void readXml(java.io.Reader reader) throws SQLException {
4466: wrs = new WebRowSetImpl();
4467: wrs.readXml(reader);
4468: crsInternal = (CachedRowSetImpl) wrs;
4469: }
4470:
4471: // Stream based methods
4472: /**
4473: * Reads a stream based XML input to populate an <code>WebRowSet</code>
4474: *
4475: * @throws SQLException if a data source access occurs
4476: * @throws IOException if a IO exception occurs
4477: */
4478: public void readXml(java.io.InputStream iStream)
4479: throws SQLException, IOException {
4480: wrs = new WebRowSetImpl();
4481: wrs.readXml(iStream);
4482: crsInternal = (CachedRowSetImpl) wrs;
4483: }
4484:
4485: /**
4486: * Creates an an output stream of the internal state and contents of a
4487: * <code>WebRowSet</code> for XML proceessing
4488: *
4489: * @throws SQLException if a datasource access occurs
4490: * @throws IOException if an IO exception occurs
4491: */
4492: public void writeXml(java.io.OutputStream oStream)
4493: throws SQLException, IOException {
4494: createWebRowSet().writeXml(oStream);
4495: }
4496:
4497: /**
4498: * Creates a new <code>WebRowSet</code> object, populates it with
4499: * the contents of the <code>ResultSet</code> and creates an output
4500: * streams the internal state and contents of the rowset for XML processing.
4501: *
4502: * @throws SQLException if a datasource access occurs
4503: * @throws IOException if an IO exception occurs
4504: */
4505: public void writeXml(ResultSet rs, java.io.OutputStream oStream)
4506: throws SQLException, IOException {
4507: wrs = new WebRowSetImpl();
4508: wrs.populate(rs);
4509: wrs.writeXml(oStream);
4510: }
4511:
4512: /**
4513: * %%% Javadoc comments to be added here
4514: */
4515: private WebRowSet createWebRowSet() throws SQLException {
4516: if (wrs != null) {
4517: // check if it has already been initialized.
4518: return wrs;
4519: } else {
4520: wrs = new WebRowSetImpl();
4521: crsInternal.beforeFirst();
4522: wrs.populate(crsInternal);
4523: return wrs;
4524: }
4525: }
4526:
4527: /**
4528: * Returns the last set SQL <code>JOIN</code> type in this JoinRowSetImpl
4529: * object
4530: *
4531: * @return joinType One of the standard JoinRowSet static field JOIN types
4532: * @throws SQLException if an error occurs determining the current join type
4533: */
4534: public int getJoinType() throws SQLException {
4535: if (vecJoinType == null) {
4536: // Default JoinRowSet type
4537: this .setJoinType(JoinRowSet.INNER_JOIN);
4538: }
4539: Integer i = (Integer) (vecJoinType.get(vecJoinType.size() - 1));
4540: return i.intValue();
4541: }
4542:
4543: /**
4544: * The listener will be notified whenever an event occurs on this <code>JoinRowSet</code>
4545: * object.
4546: * <P>
4547: * A listener might, for example, be a table or graph that needs to
4548: * be updated in order to accurately reflect the current state of
4549: * the <code>RowSet</code> object.
4550: * <p>
4551: * <b>Note</b>: if the <code>RowSetListener</code> object is
4552: * <code>null</code>, this method silently discards the <code>null</code>
4553: * value and does not add a null reference to the set of listeners.
4554: * <p>
4555: * <b>Note</b>: if the listener is already set, and the new <code>RowSetListerner</code>
4556: * instance is added to the set of listeners already registered to receive
4557: * event notifications from this <code>RowSet</code>.
4558: *
4559: * @param listener an object that has implemented the
4560: * <code>javax.sql.RowSetListener</code> interface and wants to be notified
4561: * of any events that occur on this <code>JoinRowSet</code> object; May be
4562: * null.
4563: * @see #removeRowSetListener
4564: */
4565: public void addRowSetListener(RowSetListener listener) {
4566: crsInternal.addRowSetListener(listener);
4567: }
4568:
4569: /**
4570: * Removes the designated object from this <code>JoinRowSet</code> object's list of listeners.
4571: * If the given argument is not a registered listener, this method
4572: * does nothing.
4573: *
4574: * <b>Note</b>: if the <code>RowSetListener</code> object is
4575: * <code>null</code>, this method silently discards the <code>null</code>
4576: * value.
4577: *
4578: * @param listener a <code>RowSetListener</code> object that is on the list
4579: * of listeners for this <code>JoinRowSet</code> object
4580: * @see #addRowSetListener
4581: */
4582: public void removeRowSetListener(RowSetListener listener) {
4583: crsInternal.removeRowSetListener(listener);
4584: }
4585:
4586: /**
4587: * Converts this <code>JoinRowSetImpl</code> object to a collection
4588: * of tables. The sample implementation utilitizes the <code>TreeMap</code>
4589: * collection type.
4590: * This class guarantees that the map will be in ascending key order,
4591: * sorted according to the natural order for the key's class.
4592: *
4593: * @return a <code>Collection</code> object consisting of tables,
4594: * each of which is a copy of a row in this
4595: * <code>JoinRowSetImpl</code> object
4596: * @throws SQLException if an error occurs in generating the collection
4597: * @see #toCollection(int)
4598: * @see #toCollection(String)
4599: * @see java.util.TreeMap
4600: */
4601: public Collection<?> toCollection() throws SQLException {
4602: return crsInternal.toCollection();
4603: }
4604:
4605: /**
4606: * Returns the specified column of this <code>JoinRowSetImpl</code> object
4607: * as a <code>Collection</code> object. This method makes a copy of the
4608: * column's data and utilitizes the <code>Vector</code> to establish the
4609: * collection. The <code>Vector</code> class implements a growable array
4610: * objects allowing the individual components to be accessed using an
4611: * an integer index similar to that of an array.
4612: *
4613: * @return a <code>Collection</code> object that contains the value(s)
4614: * stored in the specified column of this
4615: * <code>JoinRowSetImpl</code>
4616: * object
4617: * @throws SQLException if an error occurs generated the collection; or
4618: * an invalid column is provided.
4619: * @see #toCollection()
4620: * @see #toCollection(String)
4621: * @see java.util.Vector
4622: */
4623: public Collection<?> toCollection(int column) throws SQLException {
4624: return crsInternal.toCollection(column);
4625: }
4626:
4627: /**
4628: * Returns the specified column of this <code>JoinRowSetImpl</code> object
4629: * as a <code>Collection</code> object. This method makes a copy of the
4630: * column's data and utilitizes the <code>Vector</code> to establish the
4631: * collection. The <code>Vector</code> class implements a growable array
4632: * objects allowing the individual components to be accessed using an
4633: * an integer index similar to that of an array.
4634: *
4635: * @return a <code>Collection</code> object that contains the value(s)
4636: * stored in the specified column of this
4637: * <code>JoinRowSetImpl</code>
4638: * object
4639: * @throws SQLException if an error occurs generated the collection; or
4640: * an invalid column is provided.
4641: * @see #toCollection()
4642: * @see #toCollection(int)
4643: * @see java.util.Vector
4644: */
4645: public Collection<?> toCollection(String column)
4646: throws SQLException {
4647: return crsInternal.toCollection(column);
4648: }
4649:
4650: /**
4651: * Creates a <code>RowSet</code> object that is a copy of
4652: * this <code>JoinRowSetImpl</code> object's table structure
4653: * and the constraints only.
4654: * There will be no data in the object being returned.
4655: * Updates made on a copy are not visible to the original rowset.
4656: * <P>
4657: * This helps in getting the underlying XML schema which can
4658: * be used as the basis for populating a <code>WebRowSet</code>.
4659: *
4660: * @return a new <code>CachedRowSet</code> object that is a copy
4661: * of this <code>JoinRowSetImpl</code> object's schema and
4662: * retains all the constraints on the original rowset but contains
4663: * no data
4664: * @throws SQLException if an error occurs in generating the copy
4665: * of the <code>CachedRowSet</code> object
4666: * @see #createShared
4667: * @see #createCopy
4668: * @see #createCopyNoConstraints
4669: * @see javax.sql.RowSetEvent
4670: * @see javax.sql.RowSetListener
4671: */
4672: public CachedRowSet createCopySchema() throws SQLException {
4673: return crsInternal.createCopySchema();
4674: }
4675:
4676: static final long serialVersionUID = -5590501621560008453L;
4677: }
|