Example #1
0
        RsltByref
        (
            DrvConn conn,
            AdvanCall stmt,
            AdvanRSMD rsmd,
            long stmt_id,
            bool do_preLoad
        ) : base(conn, stmt, rsmd, stmt_id, 1, false)

            /*
            ** BYREF parameters produce a single result row.
            ** Even if row may be pre-loaded, we don't want
            ** the super-class to do the loading.
            */
        {
            rs_max_rows = 1;
            tr_id       = "Byref[" + inst_id + "]";

            /*
            ** Pre-load the row if available, otherwise disable pre-
            ** fetching to better handle the single expected row
            ** (pre-loading requires pre-fetch to be enabled).
            */
            if (do_preLoad)
            {
                preLoad();
            }
            else
            {
                disablePreFetch();
            }

            /*
            ** Load the single expected row and close the
            ** server statement to unlock the connection.
            */
            try
            {
                if (!next())
                {
                    throw SqlEx.get(ERR_GC4002_PROTOCOL_ERR);
                }
            }
            catch (SqlEx) { throw; }
            finally
            {
                try { closeCursor(); }
                catch (SqlEx) {}
            }
            return;
        } // RsltByref
Example #2
0
        /*
        ** Name: prepareCall
        **
        ** Description:
        **	Creates a CallableStatement object associated with the
        **	connection.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	CallableStatement   A new CallableStatement object.
        **
        ** History:
        **	 5-May-99 (gordy)
        **	    Created.
        **	13-Jun-00 (gordy)
        **	    Unstubbed.
        **	30-Oct-00 (gordy)
        **	    Need to pass Connection object to statement.  The
        **	    associated DbConn can be obtained via getDbConn().
        **	20-Jan-01 (gordy)
        **	    Callable statements not supported until protocol level 2.
        **	18-Apr-01 (gordy)
        **	    Added support for Distributed Transaction Management Connections.*/
        internal AdvanCall prepareCall(String sql)
        {
            if (trace.enabled())
                trace.log(title + ".prepareCall( " + sql + " )");
            warnings = null;

            if (conn.is_dtmc)
            {
                if (trace.enabled(1))
                    trace.write(tr_id + ": not permitted when DTMC");
                throw SqlEx.get( ERR_GC4019_UNSUPPORTED );
            }

            if (conn.msg_protocol_level < MSG_PROTO_2)
            {
                if (trace.enabled(1))
                    trace.write(tr_id + ": protocol = " + conn.msg_protocol_level);
                throw SqlEx.get( ERR_GC4019_UNSUPPORTED );
            }

            AdvanCall call = new AdvanCall(this.conn, sql);

            if (trace.enabled())
                trace.log(title + ".prepareCall()" + call);
            return (call);
        }
Example #3
0
        /*
            ** BYREF parameters produce a single result row.
            ** Even if row may be pre-loaded, we don't want
            ** the super-class to do the loading.
            */
        /*
        ** Name: RsltByref
        **
        ** Description:
        **	Class constructor for Database Procedure BYREF parameters.
        **	Extends procedure row handling to load the single expected
        **	result row and release the server side resources.  Initial
        **	row cache may be pre-loaded, but only if the message stream
        **	is active and DATA message available.
        **
        ** Input:
        **	conn		Associated connection.
        **	stmt		Associated call statement.
        **	rsmd		Result set Meta-Data.
        **	stmt_id		Statement ID.
        **	preLoad		Load initial row cache.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	None.
        **
        ** History:
        **	 3-Aug-00 (gordy)
        **	    Created.
        **	 4-Oct-00 (gordy)
        **	    Create unique ID for standardized internal tracing.
        **	 3-Nov-00 (gordy)
        **	    Changed parameters for 2.0 extensions.
        **	23-Jan-01 (gordy)
        **	    Changed parameter type to AdvanStmt for backward compatibility.
        **	31-Oct-02 (gordy)
        **	    Extracted Byref specifics into separate sub-class.
        **	 4-Aug-03 (gordy)
        **	    Server will handle details of detecting EOD and cleaning
        **	    up the connection, so we disable pre-fetch since only one
        **	    row is expected.
        **	 6-Oct-03 (gordy)
        **	    Added preLoad parameter to read initial row cache from server.
        */
        public RsltByref( 
			DrvConn	conn, 
			AdvanCall	stmt,
			AdvanRSMD	rsmd,
			long	stmt_id,
			bool	do_preLoad
			)
            : base(conn, stmt, rsmd, stmt_id, 1, false)
        {
            rs_max_rows = 1;
            tr_id = "Byref[" + inst_id + "]";

            /*
            ** Pre-load the row if available, otherwise disable pre-
            ** fetching to better handle the single expected row
            ** (pre-loading requires pre-fetch to be enabled).
            */
            if ( do_preLoad )
                preLoad();
            else
                disablePreFetch();

            /*
            ** Load the single expected row and close the
            ** server statement to unlock the connection.
            */
            try
            {
                if ( ! next() )  throw SqlEx.get( ERR_GC4002_PROTOCOL_ERR );
            }
            catch( SqlEx ) { throw; }
            finally
            {
                try { closeCursor(); }
                catch( SqlEx ) {}
            }
            return;
        }