Logo Search packages:      
Sourcecode: mysql-connector-java version File versions

java.sql.Blob com::mysql::jdbc::ResultSet::getBlob ( int  columnIndex  )  throws SQLException [inline, inherited]

JDBC 2.0 Get a BLOB column.

Parameters:
columnIndex the first column is 1, the second is 2, ...
Returns:
an object representing a BLOB
Exceptions:
SQLException if an error occurs.

Definition at line 633 of file ResultSet.java.

References com::mysql::jdbc::ResultSet::checkRowPos(), com::mysql::jdbc::ResultSet::connection, com::mysql::jdbc::ResultSet::fields, com::mysql::jdbc::ConnectionProperties::getEmulateLocators(), com::mysql::jdbc::ResultSet::isBinaryEncoded, com::mysql::jdbc::Field::length, com::mysql::jdbc::ResultSet::thisRow, and com::mysql::jdbc::ResultSet::wasNullFlag.

Referenced by com::mysql::jdbc::CallableStatement::getBlob().

                                                                      {
        if (!this.isBinaryEncoded) {
            checkRowPos();

            if ((columnIndex < 1) || (columnIndex > this.fields.length)) {
                throw new SQLException(Messages.getString(
                        "ResultSet.Column_Index_out_of_range",
                        new Object[] {
                            new Integer(columnIndex),
                            new Integer(this.fields.length)
                        }), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
            }

            try {
                if (this.thisRow[columnIndex - 1] == null) {
                  this.wasNullFlag = true;
                } else {
                  this.wasNullFlag = false;
                }
            } catch (NullPointerException ex) {
                  this.wasNullFlag = true;
            }

            if (this.wasNullFlag) {
                return null;
            }

            if (!this.connection.getEmulateLocators()) {
                return new Blob((byte[]) this.thisRow[columnIndex - 1]);
            }

            return new BlobFromLocator(this, columnIndex);
        }

        return getNativeBlob(columnIndex);
    }


Generated by  Doxygen 1.6.0   Back to index