List of usage examples for java.sql Blob getBytes
byte[] getBytes(long pos, int length) throws SQLException;
From source file:com.healthmarketscience.jackcess.Column.java
/** * @return an appropriate byte[] representation of the given object. * @usage _advanced_method_/*w w w . j av a 2 s. com*/ */ public static byte[] toByteArray(Object value) throws IOException { if (value == null) { return null; } else if (value instanceof byte[]) { return (byte[]) value; } else if (value instanceof Blob) { try { Blob b = (Blob) value; // note, start pos is 1-based return b.getBytes(1L, (int) b.length()); } catch (SQLException e) { throw (IOException) (new IOException(e.getMessage())).initCause(e); } } ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (value instanceof InputStream) { byte[] buf = new byte[8 * 1024]; InputStream in = (InputStream) value; int read = 0; while ((read = in.read(buf)) != -1) { bout.write(buf, 0, read); } } else { // if all else fails, serialize it ObjectOutputStream oos = new ObjectOutputStream(bout); oos.writeObject(value); oos.close(); } return bout.toByteArray(); }
From source file:org.apache.sqoop.lib.LargeObjectLoader.java
/** * Actually read a BlobRef instance from the ResultSet and materialize * the data either inline or to a file./*w w w .ja v a2 s .c om*/ * * @param colNum the column of the ResultSet's current row to read. * @param r the ResultSet to read from. * @return a BlobRef encapsulating the data in this field. * @throws IOException if an error occurs writing to the FileSystem. * @throws SQLException if an error occurs reading from the database. */ public com.cloudera.sqoop.lib.BlobRef readBlobRef(int colNum, ResultSet r) throws IOException, InterruptedException, SQLException { long maxInlineLobLen = conf.getLong(MAX_INLINE_LOB_LEN_KEY, DEFAULT_MAX_LOB_LENGTH); Blob b = r.getBlob(colNum); if (null == b) { return null; } else if (b.length() > maxInlineLobLen) { // Deserialize very large BLOBs into separate files. long len = b.length(); LobFile.Writer lobWriter = getBlobWriter(); long recordOffset = lobWriter.tell(); InputStream is = null; OutputStream os = lobWriter.writeBlobRecord(len); try { is = b.getBinaryStream(); copyAll(is, os); } finally { if (null != os) { os.close(); } if (null != is) { is.close(); } // Mark the record as finished. lobWriter.finishRecord(); } return new com.cloudera.sqoop.lib.BlobRef(getRelativePath(curBlobWriter), recordOffset, len); } else { // This is a 1-based array. return new com.cloudera.sqoop.lib.BlobRef(b.getBytes(1, (int) b.length())); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8TableBlobTable.java
protected MSSBamTableBlobBuff unpackTableBlobResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTableBlobResultSetToBuff"; int idxcol = 1; String classCode = resultSet.getString(idxcol); idxcol++;/*w ww .ja v a2 s . c om*/ MSSBamTableBlobBuff buff; if (classCode.equals("TBLB")) { buff = schema.getFactoryTableBlob().newBuff(); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Unrecognized class code \"" + classCode + "\""); } buff.setRequiredId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalScopeId(null); } else { buff.setOptionalScopeId(colVal); } } idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortName(null); } else { buff.setOptionalShortName(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalLabel(null); } else { buff.setOptionalLabel(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortDescription(null); } else { buff.setOptionalShortDescription(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDescription(null); } else { buff.setOptionalDescription(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalAuthorId(null); } else { buff.setOptionalAuthorId(colVal); } } idxcol++; buff.setRequiredValueContainerId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredIsNullable(resultSet.getBoolean(idxcol)); idxcol++; { boolean colVal = resultSet.getBoolean(idxcol); if (resultSet.wasNull()) { buff.setOptionalGenerateId(null); } else { buff.setOptionalGenerateId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDataScopeId(null); } else { buff.setOptionalDataScopeId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessSecurityId(null); } else { buff.setOptionalViewAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessSecurityId(null); } else { buff.setOptionalEditAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessFrequencyId(null); } else { buff.setOptionalViewAccessFrequencyId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessFrequencyId(null); } else { buff.setOptionalEditAccessFrequencyId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalPrevId(null); } else { buff.setOptionalPrevId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalNextId(null); } else { buff.setOptionalNextId(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDbName(null); } else { buff.setOptionalDbName(colVal); } } idxcol++; buff.setRequiredMaxLen(resultSet.getInt(idxcol)); idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalInitValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "InitValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalInitValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalDefaultValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "DefaultValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalDefaultValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalNullValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "NullValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalNullValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalUnknownValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "UnknownValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalUnknownValue(colVal); } } idxcol++; buff.setRequiredContainerId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8SchemaBlobTable.java
protected MSSBamSchemaBlobBuff unpackSchemaBlobResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSchemaBlobResultSetToBuff"; int idxcol = 1; String classCode = resultSet.getString(idxcol); idxcol++;/* w ww .j a v a 2s. co m*/ MSSBamSchemaBlobBuff buff; if (classCode.equals("SBLB")) { buff = schema.getFactorySchemaBlob().newBuff(); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Unrecognized class code \"" + classCode + "\""); } buff.setRequiredId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalScopeId(null); } else { buff.setOptionalScopeId(colVal); } } idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortName(null); } else { buff.setOptionalShortName(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalLabel(null); } else { buff.setOptionalLabel(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortDescription(null); } else { buff.setOptionalShortDescription(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDescription(null); } else { buff.setOptionalDescription(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalAuthorId(null); } else { buff.setOptionalAuthorId(colVal); } } idxcol++; buff.setRequiredValueContainerId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredIsNullable(resultSet.getBoolean(idxcol)); idxcol++; { boolean colVal = resultSet.getBoolean(idxcol); if (resultSet.wasNull()) { buff.setOptionalGenerateId(null); } else { buff.setOptionalGenerateId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDataScopeId(null); } else { buff.setOptionalDataScopeId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessSecurityId(null); } else { buff.setOptionalViewAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessSecurityId(null); } else { buff.setOptionalEditAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessFrequencyId(null); } else { buff.setOptionalViewAccessFrequencyId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessFrequencyId(null); } else { buff.setOptionalEditAccessFrequencyId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalPrevId(null); } else { buff.setOptionalPrevId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalNextId(null); } else { buff.setOptionalNextId(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDbName(null); } else { buff.setOptionalDbName(colVal); } } idxcol++; buff.setRequiredMaxLen(resultSet.getInt(idxcol)); idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalInitValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "InitValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalInitValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalDefaultValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "DefaultValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalDefaultValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalNullValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "NullValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalNullValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalUnknownValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "UnknownValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalUnknownValue(colVal); } } idxcol++; buff.setRequiredContainerId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:code.Servlet.java
private void send_image(BufferedReader reader, HttpServletResponse response, Statement stmt, PrintWriter out) throws SQLException, IOException { String line = reader.readLine(); String idStep = line.substring(12, line.length() - 2); Blob test = null; byte[] bytesEncoded; String sql;// w w w. j av a 2 s . c o m if (idStep.compareTo("'-1") == 0) // treasure found! { sql = "select answer, correct, image, question from question join answer where question.idQuestion=answer.Question_idQuestion and question.idQuestion='6' order by correct desc"; } else { sql = "select answer, correct, image, question from (step join question) join answer where step.idStep=" + idStep + "' and step.Question_idQuestion=question.idQuestion and question.idQuestion=answer.Question_idQuestion order by correct desc"; } ResultSet rs = stmt.executeQuery(sql); if (!rs.next()) { System.out.println("vuoto blob!"); } String mex = rs.getString("question") + ";"; int num_risp = 0; do { test = rs.getBlob(3); bytesEncoded = Base64.encodeBase64(test.getBytes(1, (int) test.length())); mex += rs.getString("answer") + "," + rs.getString("correct") + "," + new String(bytesEncoded) + ";"; num_risp++; } while (rs.next()); mex += "" + num_risp; System.out.println("fine send_image, inviate " + num_risp + " risposte"); response.setContentType("text/plain"); response.setContentLength(mex.length()); PrintWriter reply = response.getWriter(); reply.println(mex); out.close(); //non so se serve out out.flush(); }
From source file:org.apache.qpid.server.store.derby.DerbyMessageStore.java
private String blobToString(Blob blob) throws SQLException { byte[] bytes = blob.getBytes(1, (int) blob.length()); return new String(bytes, UTF8_CHARSET); }
From source file:org.apache.qpid.server.store.derby.DerbyMessageStore.java
StorableMessageMetaData getMetaData(long messageId) throws SQLException { Connection conn = newAutoCommitConnection(); try {//from w w w. j a v a 2s .c o m PreparedStatement stmt = conn.prepareStatement(SELECT_FROM_META_DATA); try { stmt.setLong(1, messageId); ResultSet rs = stmt.executeQuery(); try { if (rs.next()) { Blob dataAsBlob = rs.getBlob(1); byte[] dataAsBytes = dataAsBlob.getBytes(1, (int) dataAsBlob.length()); java.nio.ByteBuffer buf = java.nio.ByteBuffer.wrap(dataAsBytes); buf.position(1); buf = buf.slice(); MessageMetaDataType type = MessageMetaDataType.values()[dataAsBytes[0]]; StorableMessageMetaData metaData = type.getFactory().createMetaData(buf); return metaData; } else { throw new RuntimeException("Meta data not found for message with id " + messageId); } } finally { rs.close(); } } finally { stmt.close(); } } finally { conn.close(); } }
From source file:org.apache.qpid.server.store.derby.DerbyMessageStore.java
public int getContent(long messageId, int offset, ByteBuffer dst) { Connection conn = null;/*w ww. j a v a2s . c o m*/ PreparedStatement stmt = null; try { conn = newAutoCommitConnection(); stmt = conn.prepareStatement(SELECT_FROM_MESSAGE_CONTENT); stmt.setLong(1, messageId); ResultSet rs = stmt.executeQuery(); int written = 0; if (rs.next()) { Blob dataAsBlob = rs.getBlob(1); final int size = (int) dataAsBlob.length(); byte[] dataAsBytes = dataAsBlob.getBytes(1, size); if (offset > size) { throw new RuntimeException("Offset " + offset + " is greater than message size " + size + " for message id " + messageId + "!"); } written = size - offset; if (written > dst.remaining()) { written = dst.remaining(); } dst.put(dataAsBytes, offset, written); } return written; } catch (SQLException e) { throw new RuntimeException("Error retrieving content from offset " + offset + " for message " + messageId + ": " + e.getMessage(), e); } finally { closePreparedStatement(stmt); closeConnection(conn); } }
From source file:org.apache.qpid.server.store.derby.DerbyMessageStore.java
private void recoverMessages(MessageStoreRecoveryHandler recoveryHandler) throws SQLException { Connection conn = newAutoCommitConnection(); try {// w w w .j av a 2s . co m MessageStoreRecoveryHandler.StoredMessageRecoveryHandler messageHandler = recoveryHandler.begin(); Statement stmt = conn.createStatement(); try { ResultSet rs = stmt.executeQuery(SELECT_ALL_FROM_META_DATA); try { long maxId = 0; while (rs.next()) { long messageId = rs.getLong(1); Blob dataAsBlob = rs.getBlob(2); if (messageId > maxId) { maxId = messageId; } byte[] dataAsBytes = dataAsBlob.getBytes(1, (int) dataAsBlob.length()); java.nio.ByteBuffer buf = java.nio.ByteBuffer.wrap(dataAsBytes); buf.position(1); buf = buf.slice(); MessageMetaDataType type = MessageMetaDataType.values()[dataAsBytes[0]]; StorableMessageMetaData metaData = type.getFactory().createMetaData(buf); StoredDerbyMessage message = new StoredDerbyMessage(messageId, metaData, true); messageHandler.message(message); } _messageId.set(maxId); messageHandler.completeMessageRecovery(); } finally { rs.close(); } } finally { stmt.close(); } } finally { conn.close(); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BlobDefTable.java
protected MSSBamBlobDefBuff unpackBlobDefResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackBlobDefResultSetToBuff"; int idxcol = 1; String classCode = resultSet.getString(idxcol); idxcol++;/*from www . j av a 2 s . c om*/ MSSBamBlobDefBuff buff; if (classCode.equals("BLB")) { buff = schema.getFactoryBlobDef().newBuff(); } else if (classCode.equals("TBLB")) { buff = schema.getFactoryTableBlob().newBuff(); } else if (classCode.equals("SBLB")) { buff = schema.getFactorySchemaBlob().newBuff(); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Unrecognized class code \"" + classCode + "\""); } buff.setRequiredId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalScopeId(null); } else { buff.setOptionalScopeId(colVal); } } idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortName(null); } else { buff.setOptionalShortName(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalLabel(null); } else { buff.setOptionalLabel(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalShortDescription(null); } else { buff.setOptionalShortDescription(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDescription(null); } else { buff.setOptionalDescription(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalAuthorId(null); } else { buff.setOptionalAuthorId(colVal); } } idxcol++; buff.setRequiredValueContainerId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredIsNullable(resultSet.getBoolean(idxcol)); idxcol++; { boolean colVal = resultSet.getBoolean(idxcol); if (resultSet.wasNull()) { buff.setOptionalGenerateId(null); } else { buff.setOptionalGenerateId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDataScopeId(null); } else { buff.setOptionalDataScopeId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessSecurityId(null); } else { buff.setOptionalViewAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessSecurityId(null); } else { buff.setOptionalEditAccessSecurityId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalViewAccessFrequencyId(null); } else { buff.setOptionalViewAccessFrequencyId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalEditAccessFrequencyId(null); } else { buff.setOptionalEditAccessFrequencyId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalPrevId(null); } else { buff.setOptionalPrevId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalNextId(null); } else { buff.setOptionalNextId(colVal); } } idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDbName(null); } else { buff.setOptionalDbName(colVal); } } idxcol++; buff.setRequiredMaxLen(resultSet.getInt(idxcol)); idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalInitValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "InitValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalInitValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalDefaultValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "DefaultValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalDefaultValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalNullValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "NullValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalNullValue(colVal); } } idxcol++; { Blob binding = resultSet.getBlob(idxcol); if (resultSet.wasNull()) { buff.setOptionalUnknownValue(null); } else { long bindLen = binding.length(); if (bindLen > Integer.MAX_VALUE) { throw CFLib.getDefaultExceptionFactory().newArgumentOverflowException(getClass(), S_ProcName, idxcol, "UnknownValue", bindLen, (long) (Integer.MAX_VALUE)); } byte[] colVal = binding.getBytes(0, (int) bindLen); buff.setOptionalUnknownValue(colVal); } } idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }