Example usage for java.sql Types ARRAY

List of usage examples for java.sql Types ARRAY

Introduction

In this page you can find the example usage for java.sql Types ARRAY.

Prototype

int ARRAY

To view the source code for java.sql Types ARRAY.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type ARRAY.

Usage

From source file:lasige.steeldb.jdbc.BFTRowSet.java

/**
 * Retrieves the value of the designated column in this
 * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
 * in the Java programming language.//from   ww  w.jav a2 s  . c o m
 *
 * @param columnIndex the first column is <code>1</code>, the second
 *        is <code>2</code>, and so on; must be <code>1</code> or larger
 *        and equal to or less than the number of columns in this rowset
 * @return an <code>Array</code> object representing an SQL
 *         <code>ARRAY</code> value
 * @throws SQLException if (1) the given column index is out of bounds,
 *            (2) the cursor is not on one of this rowset's rows or its
 *            insert row, or (3) the designated column does not store an
 *            SQL <code>ARRAY</code> value
 * @see #getArray(String)
 */
public Array getArray(int columnIndex) throws SQLException {
    java.sql.Array value;

    // sanity check.
    checkIndex(columnIndex);
    // make sure the cursor is on a valid row
    checkCursor();

    if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.ARRAY) {
        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
    }

    setLastValueNull(false);
    value = (java.sql.Array) (getCurrentRow().getColumnObject(columnIndex));

    // check for SQL NULL
    if (value == null) {
        setLastValueNull(true);
        return null;
    }

    return value;
}