|
Java example source code file (InsertRow.java)
The InsertRow.java Java example source code
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.rowset.internal;
import com.sun.rowset.JdbcRowSetResourceBundle;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.util.*;
/**
* A class used internally to manage a <code>CachedRowSet object's
* insert row. This class keeps track of the number of columns in the
* insert row and which columns have had a value inserted. It provides
* methods for retrieving a column value, setting a column value, and finding
* out whether the insert row is complete.
*/
public class InsertRow extends BaseRow implements Serializable, Cloneable {
/**
* An internal <code>BitSet object used to keep track of the
* columns in this <code>InsertRow object that have had a value
* inserted.
*/
private BitSet colsInserted;
/**
* The number of columns in this <code>InsertRow object.
*/
private int cols;
private JdbcRowSetResourceBundle resBundle;
/**
* Creates an <code>InsertRow object initialized with the
* given number of columns, an array for keeping track of the
* original values in this insert row, and a
* <code>BitSet object with the same number of bits as
* there are columns.
*
* @param numCols an <code>int indicating the number of columns
* in this <code>InsertRow object
*/
public InsertRow(int numCols) {
origVals = new Object[numCols];
colsInserted = new BitSet(numCols);
cols = numCols;
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Sets the bit in this <code>InsertRow object's internal
* <code>BitSet object that corresponds to the specified column
* in this <code>InsertRow object. Setting a bit indicates
* that a value has been set.
*
* @param col the number of the column to be marked as inserted;
* the first column is <code>1
*/
protected void markColInserted(int col) {
colsInserted.set(col);
}
/**
* Indicates whether this <code>InsertRow object has a value
* for every column that cannot be null.
* @param RowSetMD the <code>RowSetMetaData object for the
* <code>CachedRowSet object that maintains this
* <code>InsertRow object
* @return <code>true if this
Other Java examples (source code examples)Here is a short list of links related to this Java InsertRow.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.