Here you can find the source of getRSInfo(Object rsObj, int[] rsInfo, long[] rsCounter, Object[] conn, int[] errCode, String[] errDetail)
public static void getRSInfo(Object rsObj, int[] rsInfo, long[] rsCounter, Object[] conn, int[] errCode, String[] errDetail) throws Throwable
//package com.java2s; /********************************************************************** // @@@ START COPYRIGHT @@@//from ww w .jav a2 s. co m // // (C) Copyright 1997-2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // @@@ END COPYRIGHT @@@ **********************************************************************/ import java.lang.reflect.Method; import java.sql.ResultSet; import java.lang.reflect.Field; public class Main { static final int RS_INFO_ERROR = 11235; static Class rsT2Cls_ = null; static Method rsInfoMID_ = null; static Field[] rsInfoFlds_ = null; /** * Method to get data pertaining to a specific result set object. This * method calls the getResultSetInfo() method provided by the JDBC/MX * driver. The above method call returns a * org.trafodion.jdbc.t2.ResultSetInfo object whose structure is as below. * class org.trafodion.jdbc.t2.ResultSetInfo * { * public: * boolean LOBDataDetected; * Connection connection; * int ctxHandle; * int stmtID; * int firstBufferedRow; * int lastBufferedRow; * int currentRowPosition; * int cursorType; * long RSCounter; * } * The input (rsObj) to this method is a Java result set object. * The following are the outputs of this method: * rsInfo: An int array with each element populated with data from * a ResultSetInfo object as represented below. * rsInfo[0] = LOBDataDetected [a value of 1 = true, 0 = false] * rsInfo[1] = ctxHandle * rsInfo[2] = stmtID * rsInfo[3] = firstBufferedRow * rsInfo[4] = lastBufferedRow * rsInfo[5] = currentRowPosition * rsInfo[6] = cursorType * [0 = TYPE_FORWARD_ONLY, 1 = TYPE_SCROLL_INSENSITIVE, * 2 = TYPE_SCROLL_SENSITIVE] * rsInfo[7] = RSClosed * rsCounter: Value representing the order in which the underlying * result set statement was executed. * conn: Reference to the java.sql.Connection object of which the * result set is part of. * errCode - Container for returned error code * errDetail - Container for any returned error detail text * The errCode is set to RS_INFO_ERROR (11235) and errDetail initialized * accordingly whenever an exception is thrown by this method. * Note: * This method is called from the LM C++ layer (LmResultSetJava class) * via JNI. Any change to the pamaters of this method will impact the * LM C++ layer. **/ public static void getRSInfo(Object rsObj, int[] rsInfo, long[] rsCounter, Object[] conn, int[] errCode, String[] errDetail) throws Throwable { errCode[0] = 0; errDetail[0] = ""; Object rsInfoObj = null; // First check if the rsObj is an instance of // org.trafodion.jdbc.t2.SQLMXResultSet class if (!(rsT2Cls_.isInstance(rsObj))) { errCode[0] = RS_INFO_ERROR; errDetail[0] = "One or more returned result sets are not instances of " + "class org.trafodion.jdbc.t2.SQLMXResultSet"; return; } // Invoke the method rsInfoObj = rsInfoMID_.invoke(rsObj, null); if (rsInfoObj != null) { // Populate the output parameters with the values // from ResultSetInfo fields // rsInfoFlds_[0] = LOBDataDetected - of type boolean boolean value = rsInfoFlds_[0].getBoolean(rsInfoObj); rsInfo[0] = (value) ? 1 : 0; // rsInfoFlds_[1] = connection - of type java.sql.Connection object conn[0] = rsInfoFlds_[1].get(rsInfoObj); // rsInfoFlds_[2] = ctxHandle - of type int rsInfo[1] = rsInfoFlds_[2].getInt(rsInfoObj); // rsInfoFlds_[3] = stmtID - of type int rsInfo[2] = rsInfoFlds_[3].getInt(rsInfoObj); // rsInfoFlds_[4] = firstBufferedRow - of type int rsInfo[3] = rsInfoFlds_[4].getInt(rsInfoObj); // rsInfoFlds_[5] = lastBufferedRow - of type int rsInfo[4] = rsInfoFlds_[5].getInt(rsInfoObj); // rsInfoFlds_[6] = currentRowPosition - of type int rsInfo[5] = rsInfoFlds_[6].getInt(rsInfoObj); // rsInfoFlds_[7] = cursorType - of type int int ctype = rsInfoFlds_[7].getInt(rsInfoObj); if (ctype == ResultSet.TYPE_FORWARD_ONLY) rsInfo[6] = 0; else if (ctype == ResultSet.TYPE_SCROLL_INSENSITIVE) rsInfo[6] = 1; else if (ctype == ResultSet.TYPE_SCROLL_SENSITIVE) rsInfo[6] = 2; // rsInfoFlds_[8] = RSCounter - of type long rsCounter[0] = rsInfoFlds_[8].getLong(rsInfoObj); // rsInfoFlds_[9] = RSClosed - of type boolean boolean rsIsClosed = rsInfoFlds_[9].getBoolean(rsInfoObj); // This test shouldn't be necessary and we may eventually decide // to remove it. We check to see if the connection is closed and // if so, close the RS and set the RSClosed flag to FALSE. JDBC // driver should be doing this for us but as of 3/4/2006, is // not. if (!rsIsClosed) { try { java.sql.Connection c = (java.sql.Connection) conn[0]; if (c.isClosed()) { rsIsClosed = true; java.sql.ResultSet rs = (java.sql.ResultSet) rsObj; rs.close(); rs.getStatement().close(); } } catch (Throwable t) { } } rsInfo[7] = rsIsClosed ? 1 : 0; // rsInfoFlds_[10] = CLI_stmt_status - of type boolean boolean cli_stmt_closed = rsInfoFlds_[10].getBoolean(rsInfoObj); rsInfo[8] = cli_stmt_closed ? 1 : 0; } // if (rsInfoObj) else { errCode[0] = RS_INFO_ERROR; errDetail[0] = "JDBC/MX returned a NULL ResultSetInfo object"; return; } } }