Example #1
0
/*{
** Name: psq_crdump	- Dump cursor control block given cursor and session ids
**
**  INTERNAL PSF call format: status = psq_crdump(&psq_cb, &sess_cb);
**
**  EXTERNAL call format:    status = psq_call(PSQ_CURDUMP, &psq_cb, &sess_cb);
**
** Description:
**      The psq_crdump function will format and print a cursor control block
**	given the cursor id and the session id that identify it.  The output
**	will go to the output terminal and/or file named by the user in the
**	"SET TRACE TERMINAL" and "SET TRACE OUTPUT" commands.
**
** Inputs:
**      psq_cb
**          .psq_cursid                 Cursor id
**	sess_cb				Pointer to session control block
**					(Can be NULL)
**
** Outputs:
**	psq_cb
**	    .psq_error			Error information
**		.err_code		    What error occurred
**		    E_PS0000_OK			Success
**		    E_PS0002_INTERNAL_ERROR	Internal inconsistency in PSF
**		    E_PS0205_SRV_NOT_INIT	Server not initialized
**		    E_PS0401_CUR_NOT_FOUND	Cursor not found
**	Returns:
**	    E_DB_OK			Function completed normally.
**	    E_DB_WARN			Function completed with warning(s)
**	    E_DB_ERROR			Function failed; non-catastrophic error
**	    E_DB_FATAL			Function failed; catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Writes to output file and/or terminal as specified in the "set trace
**	    output" and "set trace terminal" commands.
**
** History:
**	02-oct-85 (jeff)
**          written
**	27-oct-88 (stec)
**	    Dump psc_iupdmap.
**	10-may-89 (neil)
**	    Tracing of new rule-related objects.
**	22-dec-92 (rblumer)
**	    Added tracing of new statement-level rules.
**	10-mar-93 (andre)
**	    dump psc_expmap
**	07-apr-93 (andre)
**	    psc_tbl_mask, psc_rchecked, psc_rules, and psc_stmt_rules have all
**	    been moved from PSC_CURBLK into PSC_TBL_DESCR.  A list of one or
**	    more PSC_TBL_DESCR structures will hang off PSC_CURBLK for 
**		updatable cursors
**	11-oct-1993 (tad)
**	    Bug #56449
**	    Changed %x to %p for pointer values.
**	15-june-06 (dougi)
**	    Add support for "before" triggers.
*/
DB_STATUS
psq_crdump(
	PSQ_CB             *psq_cb,
	PSS_SESBLK	   *sess_cb)
{
    PSC_CURBLK		*cursor;
    DB_STATUS		status;
    i4			i;
    i4			thisline;
    PSC_RESCOL		*column;
    extern PSF_SERVBLK	*Psf_srvblk;

    /*
    ** Make sure server is initialized.
    */
    if (!Psf_srvblk->psf_srvinit)
    {
	psq_cb->psq_error.err_code = E_PS0205_SRV_NOT_INIT;
	return (E_DB_ERROR);
    }

    /*
    ** Get pointer to cursor control block.
    */
    status = psq_crfind(sess_cb, &psq_cb->psq_cursid, &cursor,
	&psq_cb->psq_error);
    if (status != E_DB_OK)
	return (status);

    /*
    ** NULL means no such cursor.
    */
    if (cursor == (PSC_CURBLK *) NULL)
    {
	psq_cb->psq_error.err_code = E_PS0401_CUR_NOT_FOUND;
	return (E_DB_ERROR);
    }

    /*
    ** Now print out everything in the cursor control block.
    */

    TRdisplay("Cursor Control Block for Cursor:");
    status = psq_ciddmp(&psq_cb->psq_cursid);
    if (status != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n\n");

    /* First, the control block header */
    if ((status = psq_headdmp((PSQ_CBHEAD *) cursor)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }

    /* The cursor id */
    TRdisplay("\tpsc_blkid:\n");
    if ((status = psq_ciddmp(&cursor->psc_blkid)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }

    /* Used / Not Used flag */
    TRdisplay("\tpsc_used:\t");
    if ((status = psq_booldmp(cursor->psc_used)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }

    TRdisplay("\n");

    /* Stream pointer */
    TRdisplay("\tpsc_stream:\t%p\n", cursor->psc_stream);

    /* Query language */
    TRdisplay("\tpsc_lang:\t(%d) ", cursor->psc_lang);
    if ((status = psq_lngdmp(cursor->psc_lang)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    /* Delete permission flag */
    TRdisplay("\tpsc_delall:\t");
    if ((status = psq_booldmp(cursor->psc_delall)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    /* For update flag */
    TRdisplay("\tpsc_forupd:\t");
    if ((status = psq_booldmp(cursor->psc_forupd)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    /* Readonly flag */
    TRdisplay("\tpsc_readonly:\t");
    if ((status = psq_booldmp(cursor->psc_readonly)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    /* Repeat cursor flag */
    TRdisplay("\tpsc_repeat:\t");
    if ((status = psq_booldmp(cursor->psc_repeat)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    /* Open flag */
    TRdisplay("\tpsc_open:\t");
    if ((status = psq_booldmp(cursor->psc_open)) != E_DB_OK)
    {
	psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
	return (status);
    }
    TRdisplay("\n");

    TRdisplay("\tList of descriptions of cursor's underlying table/views:\n");
    if (cursor->psc_tbl_descr_queue.q_next == &cursor->psc_tbl_descr_queue)
    {
	TRdisplay("\t\tNONE\n");
    }
    else
    {
	PSC_TBL_DESCR	    *descr, *last_descr;
	i4		    i = 0;

	descr = (PSC_TBL_DESCR *) cursor->psc_tbl_descr_queue.q_next;
	last_descr = (PSC_TBL_DESCR *) cursor->psc_tbl_descr_queue.q_prev;
	
	do
	{
	    if (i++)
		descr = (PSC_TBL_DESCR *) descr->psc_queue.q_next;

	    /* element number (starting at 1) */
	    TRdisplay("\t\telement %d:\n", i);

	    /* table/view id */
	    TRdisplay("\t\t\t\tpsc_tabid:\t(%d,%d)\n",
		descr->psc_tabid.db_tab_base, descr->psc_tabid.db_tab_index);

	    /* table mask */
	    TRdisplay("\t\t\tpsc_tbl_mask:\t0x%x\n", descr->psc_tbl_mask);

	    /* Row-level after user-defined rules */
	    TRdisplay("\t\t\tpsc_row_lvl_usr_rules:\t(address) 0x%p\n",
		descr->psc_row_lvl_usr_rules);

	    /* Row-level after system-generated rules */
	    TRdisplay("\t\t\tpsc_row_lvl_sys_rules:\t(address) 0x%p\n",
		descr->psc_row_lvl_sys_rules);

	    /* statement-level after user-defined rules */
	    TRdisplay("\t\t\tpsc_stmt_lvl_usr_rules:\t(address) 0x%p\n",
		descr->psc_stmt_lvl_usr_rules);

	    /* statement-level after system-generated rules */
	    TRdisplay("\t\t\tpsc_stmt_lvl_sys_rules:\t(address) 0x%p\n",
		descr->psc_stmt_lvl_sys_rules);

	    /* Row-level before user-defined rules */
	    TRdisplay("\t\t\tpsc_row_lvl_usr_before_rules:\t(address) 0x%p\n",
		descr->psc_row_lvl_usr_before_rules);

	    /* Row-level before system-generated rules */
	    TRdisplay("\t\t\tpsc_row_lvl_sys_before_rules:\t(address) 0x%p\n",
		descr->psc_row_lvl_sys_before_rules);

	    /* statement-level before user-defined rules */
	    TRdisplay("\t\t\tpsc_stmt_lvl_usr_before_rules:\t(address) 0x%p\n",
		descr->psc_stmt_lvl_usr_before_rules);

	    /* statement-level before system-generated rules */
	    TRdisplay("\t\t\tpsc_stmt_lvl_sys_before_rules:\t(address) 0x%p\n",
		descr->psc_stmt_lvl_sys_before_rules);

	    /* psc_flags */
	    TRdisplay("\t\t\tpsc_flags:\t");

	    TRdisplay("\t\t\t\tPSC_RULES_CHECKED:\t");
	    if ((status =
		psq_booldmp(descr->psc_flags & PSC_RULES_CHECKED)) != E_DB_OK)
	    {
		psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
		return (status);
	    }
	} while (descr != last_descr);
    }

    TRdisplay("\n");

    /* Now do the set of columns for update.  psc_updmap is a bit map. */
    TRdisplay("\tpsc_updmap:\t");
    thisline = 0;
    for (i = 0; i < (i4)sizeof(cursor->psc_updmap) * BITSPERBYTE; i++)
    {
	if (BTtest(i, (char *) &cursor->psc_updmap))
	{
	    TRdisplay("%d ", i);
	    thisline++;
	    /* Limit to 10 numbers per row */
	    if (thisline >= 10)
	    {
		TRdisplay("\n\t\t");
		thisline = 0;
	    }
	}
    }
    TRdisplay("\n");

    /* Now do the column set */
    TRdisplay("\tpsc_restab:\n");
    TRdisplay("\t\tpsc_tabsize: %d\n", cursor->psc_restab.psc_tabsize);
    TRdisplay("\t\tpsc_coltab:\n");
    for (i = 0; i < cursor->psc_restab.psc_tabsize; i++)
    {
	for (column = cursor->psc_restab.psc_coltab[i];
	    column != (PSC_RESCOL *) NULL;
	    column = column->psc_colnext)
	{
	    TRdisplay("\n");
	    TRdisplay("\t\t\tpsc_attname:\t%#s\n", 
		sizeof (column->psc_attname), &column->psc_attname);
	    TRdisplay("\t\t\tpsc_type:\t");
	    if ((status = psq_dtdump(column->psc_type)) != E_DB_OK)
	    {
		psq_cb->psq_error.err_code = E_PS0002_INTERNAL_ERROR;
		return (status);
	    }
	    TRdisplay("\n\t\t\tpsc_len:\t%d\n", column->psc_len);
	    TRdisplay("\t\t\tpsc_prec:\t%d\n", column->psc_prec);
	    TRdisplay("\t\t\tpsc_attid:\t%d\n", column->psc_attid.db_att_id);
	    TRdisplay("\n");
	}
    }
	
    /* Now do the internal set of columns for update,
    ** psc_iupdmap is a bit map.
    */
    TRdisplay("\tpsc_iupdmap:\t");
    thisline = 0;
    for (i = 0; i < (i4)sizeof(cursor->psc_iupdmap) * BITSPERBYTE; i++)
    {
	if (BTtest(i, (char *) &cursor->psc_iupdmap))
	{
	    TRdisplay("%d ", i);
	    thisline++;
	    /* Limit to 10 numbers per row */
	    if (thisline >= 10)
	    {
		TRdisplay("\n\t\t");
		thisline = 0;
	    }
	}
    }
    TRdisplay("\n");

    /*
    ** Now dump a map of attributes of a view on which a cursor is declared
    ** which (attributes that is) are based on an expression
    ** psc_expmap is a bit map.
    */
    TRdisplay("\tpsc_expmap:\t");
    thisline = 0;
    for (i = 0; i < (i4)sizeof(cursor->psc_expmap) * BITSPERBYTE; i++)
    {
	if (BTtest(i, (char *) &cursor->psc_expmap))
	{
	    TRdisplay("%d ", i);
	    thisline++;
	    /* Limit to 10 numbers per row */
	    if (thisline >= 10)
	    {
		TRdisplay("\n\t\t");
		thisline = 0;
	    }
	}
    }
    TRdisplay("\n");

    return    (E_DB_OK);
}
Example #2
0
/*{
** Name: psq_sesdump	- Dump the session control block for a given session.
**
**  INTERNAL PSF call format: status = psq_sesdump((PSQ_CB *) NULL, &sess_cb);
**
**  EXTERNAL call format:
**		    status = psq_call(PSQ_SESDUMP, (PSQ_CB *) NULL, &sess_cb);
**
** Description:
**      The psq_sesdump function will format and print the session control 
**      block for a given session.  The output will go to the output terminal
**	and/or file named by the user in the "SET TRACE TERMINAL" and "SET TRACE
**	OUTPUT" commands.
**
** Inputs:
**	psq_cb				Ignored
**	sess_cb				Pointer to session control block to dump
**
** Outputs:
**	Returns:
**	    E_DB_OK			Function completed normally.
**	    E_DB_WARN			Function completed with warning(s)
**	    E_DB_ERROR			Function failed; non-catastrophic error
**	    E_DB_FATAL			Function failed; catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Writes to output file and/or terminal as specified in the "set trace
**	    output" and "set trace terminal" commands.
**
** History:
**	02-oct-85 (jeff)
**          written
**      26-aug-85 (seputis)
**          removed reference to pss_yastr
**	13-sep-90 (teresa)
**	    rewrote psq_sesdump to dump each flag in new field pss_flag and
**	    pss_ses_flag.
**	28-mar-91 (andre)
**	    PSS_RGSET and PSS_RASET have been undefined.
**	18-nov-93 (andre)
**	    added code to display new bits in pss_stmt_flags, 
**	    pss_flattening_flags and pss_dbp_flags
**	17-dec-93 (rblumer)
**	    "FIPS mode" no longer exists.  It was replaced some time ago by
**	    several feature-specific flags (e.g. flatten_nosingleton and
**	    direct_cursor_mode).  So I removed all FIPS_MODE flags.
**	19-Nov-2010 (kiria01) SIR 124690
**	    Add support for UCS_BASIC collation.
*/
DB_STATUS
psq_sesdump(
	PSQ_CB             *psq_cb,
	PSS_SESBLK	   *sess_cb)
{
    DB_STATUS		status;
    PSS_RNGTAB		*rv;

    TRdisplay("PSF session control block:\n");

    if ((status = psq_headdmp((PSQ_CBHEAD *) sess_cb)) != E_DB_OK)
	return (status);

    TRdisplay("\tpss_sessid:\t0x%x\n", sess_cb->pss_sessid);
    /* TRdisplay("\tpss_yastr:\t0x%x\n", sess_cb->pss_yastr); */
    TRdisplay("\tpss_numcursors:\t%d\n", sess_cb->pss_numcursors);

    TRdisplay("\tpss_lang:\t");
    if ((status = psq_lngdmp(sess_cb->pss_lang)) != E_DB_OK)
	return (status);
    TRdisplay("\n");

    TRdisplay("\tpss_decimal:\t%c\n", sess_cb->pss_decimal);

    TRdisplay("\tpss_distrib:\t");
    if ((status = psq_dstdmp(sess_cb->pss_distrib)) != E_DB_OK)
	return (status);

    /*
    ** dump bitflags in pss_ses_flag, which tend to persist throughout the
    ** session, though the values may be altered in response to user cmds 
    */
    TRdisplay("\n\tpss_ses_flag.PSS_CATUPD:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_CATUPD);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_ses_flag.PSS_WARNINGS:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_WARNINGS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_ses_flag.PSS_PROJECT:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_PROJECT);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_ses_flag.PSS_JOURNALING:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_JOURNALING);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_ses_flag.PSS_DBA_DROP_ALL:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_DBA_DROP_ALL);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_ses_flag.PSS_NOCHK_SINGLETON_CARD:\t");
    status = psq_booldmp(sess_cb->pss_ses_flag & PSS_NOCHK_SINGLETON_CARD);
    if (status != E_DB_OK)
	return (status);

    /* dump flags found in pss_stmt_flags and pss_dbp_flags */
    TRdisplay("\n\tpss_stmt_flags.PSS_AGINTREE:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_AGINTREE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_SUBINTREE:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_SUBINTREE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_TXTEMIT:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_TXTEMIT);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_QUAL_IN_PERMS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_QUAL_IN_PERMS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_QUEL_RPTQRY_TEXT:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_QUEL_RPTQRY_TEXT);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_DISREGARD_GROUP_ROLE_PERMS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & 
			     PSS_DISREGARD_GROUP_ROLE_PERMS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_SET_LOCKMODE_SESS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_SET_LOCKMODE_SESS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_REG_AS_NATIVE:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_REG_AS_NATIVE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_CP_DUMMY_COL:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_CP_DUMMY_COL);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_GATEWAY_SESS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_GATEWAY_SESS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_NEW_OBJ_NAME:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_NEW_OBJ_NAME);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_PARSING_PRIVS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_PARSING_PRIVS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_CALL_ADF_EXCEPTION:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_CALL_ADF_EXCEPTION);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_PARSING_CHECK_CONS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_PARSING_CHECK_CONS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_VALIDATING_CHECK_OPTION:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_VALIDATING_CHECK_OPTION);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_TXTEMIT2:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_TXTEMIT2);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_IMPL_COL_LIST_IN_DECL_CURS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & 
			     PSS_IMPL_COL_LIST_IN_DECL_CURS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_stmt_flags.PSS_RESOLVING_CHECK_CONS:\t");
    status = psq_booldmp(sess_cb->pss_stmt_flags & PSS_RESOLVING_CHECK_CONS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_flattening_flags.PSS_SINGLETON_SUBSELECT:\t");
    status = psq_booldmp(sess_cb->pss_flattening_flags & 
			     PSS_SINGLETON_SUBSELECT);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_flattening_flags.PSS_SUBSEL_IN_OR_TREE:\t");
    status = psq_booldmp(sess_cb->pss_flattening_flags & PSS_SUBSEL_IN_OR_TREE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_flattening_flags.PSS_ALL_IN_TREE:\t");
    status = psq_booldmp(sess_cb->pss_flattening_flags & PSS_ALL_IN_TREE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_flattening_flags.PSS_MULT_CORR_ATTRS:\t");
    status = psq_booldmp(sess_cb->pss_flattening_flags & PSS_MULT_CORR_ATTRS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_flattening_flags.PSS_CORR_AGGR:\t");
    status = psq_booldmp(sess_cb->pss_flattening_flags & PSS_CORR_AGGR);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_RECREATE:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_RECREATE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_IPROC:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_IPROC);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_DBPROC:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_DBPROC);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_DBPGRANT_OK:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_DBPGRANT_OK);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_0DBPGRANT_CHECK:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_0DBPGRANT_CHECK);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_RUSET:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_RUSET);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_CHECK_IF_ACTIVE:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_CHECK_IF_ACTIVE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_MISSING_PRIV:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_MISSING_PRIV);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_MISSING_OBJ:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_MISSING_OBJ);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_PARSING_SET_PARAM:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_PARSING_SET_PARAM);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SET_INPUT_PARAM:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SET_INPUT_PARAM);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SYSTEM_GENERATED:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SYSTEM_GENERATED);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_NOT_DROPPABLE:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_NOT_DROPPABLE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SUPPORTS_CONS:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SUPPORTS_CONS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_CHECK_IF_ACTIVE:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_CHECK_IF_ACTIVE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_MISSING_PRIV:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_MISSING_PRIV);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_MISSING_OBJ:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_MISSING_OBJ);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_PARSING_SET_PARAM:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_PARSING_SET_PARAM);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SET_INPUT_PARAM:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SET_INPUT_PARAM);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SYSTEM_GENERATED:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SYSTEM_GENERATED);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_NOT_DROPPABLE:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_NOT_DROPPABLE);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_dbp_flags.PSS_SUPPORTS_CONS:\t");
    status = psq_booldmp(sess_cb->pss_dbp_flags & PSS_SUPPORTS_CONS);
    if (status != E_DB_OK)
	return (status);

    TRdisplay("\n\tpss_qbuf:\t0x%p\n", sess_cb->pss_qbuf);
    TRdisplay("\tpss_nxtchar:\t0x%p\n", sess_cb->pss_nxtchar);
    TRdisplay("\tpss_prvtok:\t0x%p\n", sess_cb->pss_prvtok);
    TRdisplay("\tpss_endbuf:\t0x%p\n", sess_cb->pss_endbuf);
    TRdisplay("\tpss_lineno:\t%d\n", sess_cb->pss_lineno);
    TRdisplay("\tpss_qualdepth:\t%d\n", sess_cb->pss_qualdepth);
    TRdisplay("\tpss_symstr:\t0x%p\n", sess_cb->pss_symstr);
    TRdisplay("\tpss_symtab:\t0x%p\n", sess_cb->pss_symtab);
    TRdisplay("\tpss_symnext:\t0x%p\n", sess_cb->pss_symnext);
    TRdisplay("\tpss_symblk:\t0x%p\n", sess_cb->pss_symblk);

    /*
    ** To dump pss_restab call pst_dmpres().
    */
    (VOID) pst_dmpres(&sess_cb->pss_restab);

    TRdisplay("\tpss_yacc:\t0x%p\n", sess_cb->pss_yacc);
    TRdisplay("\tpss_parser:\t0x%p\n", sess_cb->pss_parser);

    TRdisplay("\tpss_defqry:\t%d\n", sess_cb->pss_defqry);
    TRdisplay("\tpss_rsdmno:\t%d\n", sess_cb->pss_rsdmno);
    TRdisplay("\tpss_ostream:\t0x%p\n", &sess_cb->pss_ostream);
    TRdisplay("\tpss_tlist:\t0x%p\n", sess_cb->pss_tlist);
    TRdisplay("\tpss_dbid:\t0x%p\n", sess_cb->pss_dbid);
    TRdisplay("\tpss_crsr:\t0x%p\n", sess_cb->pss_crsr);
    TRdisplay("\tpss_highparm:\t%d\n", sess_cb->pss_highparm);
    TRdisplay("\tpss_memleft:\t%d\n", sess_cb->pss_memleft);
    TRdisplay("\tpss_user:\t%#s\n", sizeof (sess_cb->pss_user),
	&sess_cb->pss_user);
    TRdisplay("\tpss_dba:\t%#s\n", sizeof (sess_cb->pss_dba),
	&sess_cb->pss_dba);
    TRdisplay("\tpss_cstream:\t0x%p\n", sess_cb->pss_cstream);
    TRdisplay("\tpss_def_coll:\t%d\n", sess_cb->pss_def_coll);
    TRdisplay("\tpss_def_unicode_coll:\t%d\n", sess_cb->pss_def_unicode_coll);
    TRdisplay("\tpss_resrng:\n");
    psq_rngdmp(sess_cb->pss_resrng);
    TRdisplay("\n");

    TRdisplay("\tpss_usrrange:\n");
    for (rv = (PSS_RNGTAB *) sess_cb->pss_usrrange.pss_qhead.q_next;
	(QUEUE *) rv != &sess_cb->pss_usrrange.pss_qhead;
	rv = (PSS_RNGTAB *) rv->pss_rngque.q_next)
    {
	psq_rngdmp(rv);
	TRdisplay("\n");
    }
    return    (E_DB_OK);
}
Example #3
0
/*{
** Name: psq_prmdump	- Dump the parameters in a control block.
**
**  INTERNAL PSF call format: status = psq_prmdump(&psq_cb)
**
**  EXTERNAL call format:     status = psq_call(PSQ_PRMDUMP, &psq_cb, NULL);
**
** Description:
**	The psq_prmdump function formats and prints the given control block.
**	The output will go to the output terminal and/or file named by the
**	user in the "SET TRACE TERMINAL" and "SET TRACE OUTPUT" commands.
**
** Inputs:
**      psq_cb                          Everything in the control block gets
**					printed.
**	sess_cb				Ignored.
**
** Outputs:
**	NONE				Nothing in the control block will be
**					altered by this command, even if there
**					is an error.
**	Returns:
**	    E_DB_OK			Function completed normally.
**	    E_DB_WARN			Function completed with warning(s)
**	    E_DB_ERROR			Function failed; non-catastrophic error
**	    E_DB_FATAL			Function failed; catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Sends output to terminal and/or log file
**
** History:
**	02-oct-85 (jeff)
**          written
**	13-sep-90 (teresa)
**	    changed to dump PSQ_FLAG fields.  Flag pqs_force has changed to
**	    be a bitflag instead of a boolean.  Also, many new flags have been
**	    added and some of those are in psq_flag.  Now all psq_flag bits 
**	    will be dumped.
**	08-sep-93 (swm)
**	    Changed cast of session id parameter to psq_siddmp() function
**	    to CS_SID.
**	17-dec-93 (rblumer)
**	    "FIPS mode" no longer exists.  It was replaced some time ago by
**	    several feature-specific flags (e.g. flatten_nosingleton and
**	    direct_cursor_mode).  So I removed all FIPS_MODE flags.
**	11-oct-1993 (tad)
**	    Bug #56449
**	    Changed %x to %p for pointer values.
*/
DB_STATUS
psq_prmdump(
	register PSQ_CB     *psq_cb)
{
    DB_STATUS		  status;

    if (TRdisplay("Contents of PSQ_CB at 0x%p:\n", psq_cb) != TR_OK)
	return (E_DB_ERROR);
    /* Print common header for all cb's */
    if ((status = psq_headdmp((PSQ_CBHEAD *) psq_cb)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_sessid:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print session id */
    if ((status = psq_siddmp((CS_SID *) &psq_cb->psq_sessid)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_qlang:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print query language id */
    if ((status = psq_lngdmp(psq_cb->psq_qlang)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_decimal:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print decimal specification */
    if ((status = psq_decdmp(&psq_cb->psq_decimal)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_distrib:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print distributed specifier */
    if ((status = psq_dstdmp(psq_cb->psq_distrib)) != E_DB_OK)
	return (status);

    /* display bitflags in psq_flags */
    if (TRdisplay("\n\tpsq_flag.PSQ_FORCE:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_FORCE)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_IIQRYTEXT:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_IIQRYTEXT)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_ALIAS_SET:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_ALIAS_SET)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_CATUPD:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_CATUPD)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_WARNINGS:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_WARNINGS)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_ALLDELUPD:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_ALLDELUPD)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_flag.PSQ_DBA_DROP_ALL:\t") != TR_OK)
	return (E_DB_ERROR);
    if ((status = psq_booldmp(psq_cb->psq_flag & PSQ_DBA_DROP_ALL)) != E_DB_OK)
	return (status);

    if (TRdisplay("\n\tpsq_version:\t%d", psq_cb->psq_version) != TR_OK)
	return (E_DB_ERROR);
    if (TRdisplay("\n\tpsq_mode:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print the query mode */
    if ((status = psq_modedmp(psq_cb->psq_mode)) != E_DB_OK)
	return (status);
/*
**    if (TRdisplay("\n\tpsq_qryid:\t") != TR_OK)
**	  return (E_DB_ERROR);
** {Print the query id} 
**    if ((status = psq_qiddmp(&psq_cb->psq_qryid)) != E_DB_OK)
**        return (status);
**
*/
    if (TRdisplay("\n\tpsq_table:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print the id of the given table */
    if ((status = psq_tbiddmp(&psq_cb->psq_table)) != E_DB_OK)
	return (status);
    if (TRdisplay("\n\tpsq_cursid:\t") != TR_OK)
	return (E_DB_ERROR);
    /* Print the cursor id */
    if ((status = psq_ciddmp(&psq_cb->psq_cursid)) != E_DB_OK)
	return (status);
/*
**    if (TRdisplay("\n\tpsq_result:\t") != TR_OK)
**        return (E_DB_ERROR);
**    {Print the id for the parse result }
**    if ((status = psq_qiddmp(&psq_cb->psq_result)) != E_DB_OK)
**        return (status);
**
*/
    if (TRdisplay("\n\tpsq_error:\t:") != TR_OK)
	return (E_DB_ERROR);
    /* Print the error block */
    if ((status = psq_errdmp(&psq_cb->psq_error)) != E_DB_OK)
	return (status);

    return    (E_DB_OK);
}