Пример #1
0
/*
** Name: ParseHTMLVariables() - Entry point
**
** Description:
**
** Inputs:
**	ACT_PSESSION	active session
**	char*			var
**
** Outputs:
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      11-Sep-1998 (fanra01)
**          Separate declaration and initialisation for building on unix.
**      20-Aug-2003 (fanra01)
**          Additional output information if parse error encountered.
*/
GSTATUS 
ParseHTMLVariables(
	ACT_PSESSION act_session, 
	char *var) 
{
	GSTATUS err = GSTAT_OK;	
	if (var != NULL) 
	{
		PARSER_IN in;
		VAR_PARSER_OUT out;

		MEfill (sizeof(PARSER_IN), 0, (PTR)&in);
		in.first_node = FIRST_VARIABLE_NODE;
		in.buffer = var;
		in.length = STlength(var);
		
		MEfill (sizeof(VAR_PARSER_OUT), 0, (PTR)&out);
		out.act_session = act_session;
		out.HexProcessing = FALSE;
		out.type = WSM_ACTIVE;
		
		err = ParseOpen(Variable, &in, (PPARSER_OUT) &out);
		if (err == GSTAT_OK)
			err = Parse(Variable, &in, (PPARSER_OUT) &out);
		if (err == GSTAT_OK)
			err = ParseClose(Variable, &in, (PPARSER_OUT) &out);
        if (err != GSTAT_OK)
        {
            DDFStatusInfo( err, "Variable name = %s\n", var );
        }
	}
return(err);
}
Пример #2
0
DB_STATUS
qet_t2_begin(
QEF_CB     *qef_cb)
{
    DB_STATUS   status;
    TPR_CB	tpr_cb,
		*tpr_p = & tpr_cb;


    /* caller may have already set qef_cb->qef_stat, so don't check */

    MEfill(sizeof(tpr_cb), '\0', (PTR) & tpr_cb);
    tpr_p->tpr_session = qef_cb->qef_c2_ddb_ses.qes_d2_tps_p;
    tpr_p->tpr_rqf = qef_cb->qef_c2_ddb_ses.qes_d3_rqs_p;
    tpr_p->tpr_lang_type = DB_NOLANG;

    status = qed_u17_tpf_call(TPF_BEGIN_DX, tpr_p, qef_cb->qef_rcb);
    if (status)
    {
	return(status);
    }

    MEfill(sizeof(DB_TRAN_ID), ' ', (PTR) & qef_cb->qef_tran_id);
    qef_cb->qef_stmt = 1;			/* renumber statements for new 
						** xact */
    qef_cb->qef_defr_curs = FALSE;		/* no deferred cursor yet */
    return (E_DB_OK);
}
Пример #3
0
/*{
** Name: psy_kgroup - Destroy group
**
**  INTERNAL PSF call format: status = psy_kgroup(&psy_cb, sess_cb);
**
** Description:
**	This procedure deletes group identifiers.  No members can be
**	in the group to be deleted.  If members exist in a group,
**	the group is not deleted.
**	This procedure is called for SQL language only.
**
** Inputs:
**      psy_cb
**	    .psy_tblq			head of group  queue
**	sess_cb				Pointer to session control block
**					(Can be NULL)
**
** Outputs:
**      psy_cb
**	    .psy_error			Filled in if error happens
**	Returns:
**	    E_DB_OK			Function completed normally.
**	    E_DB_INFO			Function completed with message(s).
**	    E_DB_WARN			One or more groups were rejected.
**	    E_DB_ERROR			Function failed; non-catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Removed tuples from iiusergroup.
**
** History:
**	13-mar-89 (ralph)
**          written
**	20-may-89 (ralph)
**	    Allow multiple groups to be specified.
**	12-mar-90 (andre)
**	    set rdr_2types_mask to 0.
**      22-may-90 (teg)
**          init rdr_instr to RDF_NO_INSTR
*/
DB_STATUS
psy_kgroup(
	PSY_CB             *psy_cb,
	PSS_SESBLK	   *sess_cb)
{
    DB_STATUS		status, stat;
    RDF_CB		rdf_cb;
    register RDR_RB	*rdf_rb = &rdf_cb.rdf_rb;
    DB_USERGROUP	ugtuple;
    register DB_USERGROUP *ugtup = &ugtuple;
    PSY_TBL		*psy_tbl;
    PSY_USR		*psy_usr;

    /* This code is called for SQL only */

    /*
    ** Fill in the part of RDF request block that will be constant.
    */
    pst_rdfcb_init(&rdf_cb, sess_cb);
    rdf_rb->rdr_update_op   = RDR_DELETE;
    rdf_rb->rdr_status	    = DB_SQL;
    rdf_rb->rdr_types_mask  = RDR_GROUP;
    rdf_rb->rdr_qrytuple    = (PTR) ugtup;
    rdf_rb->rdr_qtuple_count = 1;

    MEfill(sizeof(DB_OWN_NAME), (u_char)' ', (PTR)&ugtup->dbug_member);
    MEfill(sizeof(ugtup->dbug_reserve),
	   (u_char)' ',
	   (PTR)ugtup->dbug_reserve);

    status = E_DB_OK;

    for (psy_tbl  = (PSY_TBL *)  psy_cb->psy_tblq.q_next;
	 psy_tbl != (PSY_TBL *) &psy_cb->psy_tblq;
	 psy_tbl  = (PSY_TBL *)  psy_tbl->queue.q_next
	)
    {
	/* STRUCT_ASSIGN_MACRO(psy_tbl->psy_tabnm,
			       ugtup->dbug_group); */
	MEcopy((PTR)&psy_tbl->psy_tabnm,
	       sizeof(ugtup->dbug_group),
	       (PTR)&ugtup->dbug_group);

	stat = rdf_call(RDF_UPDATE, (PTR) &rdf_cb);
	status = (stat > status) ? stat : status;

	if (DB_FAILURE_MACRO(stat))
	    break;
    }

    if (DB_FAILURE_MACRO(status))
	(VOID) psf_rdf_error(RDF_UPDATE, &rdf_cb.rdf_error, 
			     &psy_cb->psy_error);

    return    (status);
}
Пример #4
0
/*{
** Name: ope_neweqcls	- create a new equivalence class for joinop attribute
**
** Description:
**      This routine will create a new equivalence class for the joinop 
**      attribute.  It is assumed that the joinop attribute is not already 
**      assigned to an equivalence class.
**
** Inputs:
**      subquery                        ptr to subquery be analyzed
**      attr                          joinop attribute to be placed
**                                      in equivalence class
**
** Outputs:
**	Returns:
**	    equivalence class which was assigned
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**	24-apr-86 (seputis)
**          initial creation
**	24-oct-88 (seputis)
**          init ope_nulljoin field
**	21-dec-88 (seputis)
**          init ope_mask field, check for non-nullable attributes
**	13-may-91 (seputis)
**	    - fix for b37172 - added ope_sargp
**	31-jan-94 (rganski)
**	    Removed ope_sargp, due to change to oph_sarglist.
**	9-aug-05 (inkdo01)
**	    Add support of OJ & EQC bit maps.
**	24-aug-05 (inkdo01)
**	    Drop ope_ojs - problem was solved differently.
**	21-jul-06 (hayke02)
**	    Re-introcude and initialize ope_ojs. This change fixes bug 116406.
[@history_line@]...
*/
OPE_IEQCLS
ope_neweqcls(
	OPS_SUBQUERY	   *subquery,
	OPZ_IATTS          attr)
{
    OPE_IEQCLS          eqcls;	    /* index into equivalence class array */
    OPE_ET              *ebase;	    /* ptr to base of equivalence class array */

    ebase = subquery->ops_eclass.ope_base;
    eqcls = subquery->ops_eclass.ope_ev++; /* find first available unassigned
                                    ** equivalence class, allocate it */
    if (eqcls >= OPE_MAXEQCLS)
	opx_error(E_OP0301_EQCLS_OVERFLOW);

    {	/* eqcls now contains the unassigned equivalence class index */
	OPE_EQCLIST            *eqcls_ptr;

	eqcls_ptr = (OPE_EQCLIST *) opu_memory(subquery->ops_global, 
	    (i4) sizeof(OPE_EQCLIST));
	ebase->ope_eqclist[eqcls] = eqcls_ptr; /* assign memory for the
				    ** equivalence class element */
	MEfill(sizeof(OPZ_BMATTS), (u_char) 0, 
	    (PTR) &eqcls_ptr->ope_attrmap); /* initialize equivalence class 
                                    ** element attribute bit map to  zero */
        eqcls_ptr->ope_bfindex = OPB_NOBF; /* no constant predicates found yet*/
        eqcls_ptr->ope_nbf = OPB_NOBF; /* no sargable predicates found yet */
	eqcls_ptr->ope_nulljoin = TRUE; /* keep nulls in joins unless user 
				    ** explicitly joins two attributes */
	eqcls_ptr->ope_mask = 0;    /* mask of various booleans */
	if (attr != OPZ_NOATTR)
	{   /* update information in attribute to reference equivalence class*/
	    OPZ_ATTS           *attr_ptr;   /* ptr to attribute element to
				    ** be placed in equivalence class
				    */

	    BTset((i4) attr, (char *)&eqcls_ptr->ope_attrmap);  /* set the appropriate
					** bit to indicate attribute */
	    attr_ptr = subquery->ops_attrs.opz_base->opz_attnums[attr];
	    if (attr_ptr->opz_dataval.db_datatype > 0)
	    	/* NULLs will not exist, if this eventually becomes a joining eqcls */
		eqcls_ptr->ope_nulljoin = FALSE;
            eqcls_ptr->ope_eqctype = (attr_ptr->opz_attnm.db_att_id ==DB_IMTID) 
		? OPE_TID : OPE_NONTID; /* set type of this eqclass to
				    ** OPE_TID if the att is an implicit TID */
	    MEfill((u_i2) sizeof(OPL_BMOJ), (u_char) 0,
		(PTR) &eqcls_ptr->ope_ojs); /* init OJ bit map */
	    attr_ptr->opz_equcls = eqcls; /* remember that this att has
				    ** been assigned to an eqclass */
	    BTset((i4)eqcls, (char *)&attr_ptr->opz_eqcmap);
				    /* & set eqc in map (for multi-EQC atts) */
	}
	else
	    eqcls_ptr->ope_eqctype = OPE_NONTID;
    }
    return(eqcls);
}
Пример #5
0
II_EXTERN II_VOID
IIapi_cnvtDataValue2GDV
(
    IIAPI_DESCRIPTOR	*descriptor,
    IIAPI_DATAVALUE	*dataValue,
    II_PTR		gcaValue
)
{
    II_UINT2 length;

    if ( descriptor->ds_nullable  &&  dataValue->dv_null )
    {
	length = IIapi_getGCALength( descriptor );
	MEfill( length, '\0', gcaValue );
	IIAPI_SETNULL( length, gcaValue );
        return;
    }

    length = min( descriptor->ds_length, dataValue->dv_length );
    MEcopy( dataValue->dv_value, length, gcaValue );

    if ( length < descriptor->ds_length )
	switch( descriptor->ds_dataType )
	{
	case IIAPI_NCHA_TYPE :
	{
	    u_i2 pad = 0x0020;	/* UCS-2 space */
	    u_i1 *ptr;

	    for( 
		 ptr = (u_i1 *)gcaValue + length; 
		 length < descriptor->ds_length; 
		 length += sizeof(pad), ptr += sizeof(pad) 
	       )
		MECOPY_CONST_MACRO( (PTR)&pad, sizeof(pad), (PTR)ptr );
	    break;
	}
	case IIAPI_CHA_TYPE :
	case IIAPI_CHR_TYPE :
	    MEfill( descriptor->ds_length - length, ' ', 
		    (PTR)((u_i1 *)gcaValue + length) );
	    break;

	default :
	    MEfill( descriptor->ds_length - length, '\0', 
		    (PTR)((u_i1 *)gcaValue + length) );
	    break;
	}

    length = descriptor->ds_length;
    if ( descriptor->ds_nullable )  IIAPI_SETNOTNULL( length + 1, gcaValue );

    return;
}
Пример #6
0
DB_STATUS
qeq_a2_fetch(
    QEF_RCB		*v_qer_p,
    QEF_AHD		*i_act_p,
    bool		*o_tupread_p,
    bool		*o_eod_p )
{
    DB_STATUS	    status,
                    ignore;
    DB_ERROR	    sav_error;
    QEE_DSH	    *dsh_p = (QEE_DSH *)(v_qer_p->qef_cb->qef_dsh);
    QEE_DDB_CB	    *qee_p = dsh_p->dsh_ddb_cb;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    QEQ_D1_QRY	    *sub_p = & i_act_p->qhd_obj.qhd_d1_qry;
    RQR_CB	    rqr,
                *rqr_p = & rqr;
    RQB_BIND	    *bind;


    MEfill(sizeof(rqr), '\0', (PTR) & rqr);

    rqr_p->rqr_session = dds_p->qes_d3_rqs_p;   /* RQF session id */
    rqr_p->rqr_q_language = sub_p->qeq_q1_lang;
    rqr_p->rqr_timeout = sub_p->qeq_q2_quantum;
    rqr_p->rqr_1_site = sub_p->qeq_q5_ldb_p;
    rqr_p->rqr_col_count = sub_p->qeq_q6_col_cnt;
    rqr_p->rqr_bind_addrs = (RQB_BIND *) qee_p->qee_d9_bind_p;
    /* must use invariant array */
    status = qed_u3_rqf_call(RQR_T_FETCH, rqr_p, v_qer_p);
    if (status)
    {
        /* must flush before returning */

        STRUCT_ASSIGN_MACRO(v_qer_p->error, sav_error);
        ignore = qeq_a3_flush(v_qer_p, sub_p->qeq_q5_ldb_p);
        STRUCT_ASSIGN_MACRO(sav_error, v_qer_p->error);
        return(status);
    }

    bind = rqr_p->rqr_bind_addrs;

    /* fix for b55503  FIXME: more general fix needed */
    if(bind->rqb_r_dt_id < 0 && bind->rqb_addr[bind->rqb_length-1] > 0)
    {
        /* nullable and null byte on */
        MEfill(bind->rqb_length-1, '\0', (PTR) bind->rqb_addr);
    }

    *o_eod_p = rqr_p->rqr_end_of_data;
    *o_tupread_p = ! rqr_p->rqr_end_of_data;

    return(E_DB_OK);
}
Пример #7
0
/*{
** Name: pst_clrrng	- Clear the user range table.
**
** Description:
**      This function clears the user range table.  It deallocates the memory
**	in which the table descriptions are stored, and it sets the memory
**	stream pointer for each range variable to NULL, so we can tell it's
**	no longer used.
**
** Inputs:
**      rngtab                          Pointer to the user range table
**      err_blk                         Place to put error info
**	sess_cb			 	Pointer to session control block
**
** Outputs:
**	rngtab				All mem. stream ptrs. set to NULL
**      err_blk                         Filled in if an error happens
**	Returns:
**	    E_DB_OK			Success
**	    E_DB_ERROR			Non-catastrophic error
**	    E_DB_FATAL			Catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Deallocates memory
**
** History:
**	03-apr-86 (jeff)
**          written
**	28-jul-86 (jeff)
**	    made it clear RDF info pointer for result range variable
**	1-sep-89 (andre)
**	    reset all bits inside the pss_outer_rel and pss_inner_rel.
**	12-mar-90 (andre)
**	    set rdr_2types_mask to 0.
**	21-may-90 (teg)
**	    init rdr_instr to RDF_NO_INSTR
**	15-jun-92 (barbara)
**	    Added sess_cb as a parameter.
**	03-aug-92 (barbara)
**	    Call pst_rdfcb_init to initialize RDF_CB before rdf_call()
**	08-jan-93 (rblumer)
**	    don't free rdf info for dummy set-input range variables.
**	14-jul-93 (ed)
**	    replacing <dbms.h> by <gl.h> <sl.h> <iicommon.h> <dbdbms.h>
**	10-aug-93 (andre)
**	    removed declaration of rdf_call() + cast the second arg as (PTR)
**	    to avoid acc warnings
**	25-jan-06 (dougi)
**	    Don't UNFIX derived table entries.
**	23-Jun-2006 (kschendel)
**	    Use new general unfixer.
*/
DB_STATUS
pst_clrrng(
	PSS_SESBLK	   *sess_cb,
	PSS_USRRANGE       *rngtab,
	DB_ERROR           *err_blk)
{
    DB_STATUS           status;
    register i4	i;
    register PSS_RNGTAB *rngvar;

    /* Reset the maximum range variable number */
    rngtab->pss_maxrng = -1;

    /* Close off all streams. */
    for (i = 0, rngvar = rngtab->pss_rngtab; i < PST_NUMVARS; i++, rngvar++)
    {
	/* Release cached description;
	** but don't release it if this is a dummy set-input range variable
	** and we are creating the procedure for the first time
	** or if it is a derived table (subselect in FROM clause).
	*/
	status = pst_rng_unfix(sess_cb, rngvar, err_blk);
	if (status != E_DB_OK)
	    return (status);

	/* Clear the range variable number */
	rngvar->pss_rgno = -1;

	/* clear the inner and the outer relation mask */
	MEfill(sizeof(PST_J_MASK), (u_char) 0, (PTR) &rngvar->pss_inner_rel);
	MEfill(sizeof(PST_J_MASK), (u_char) 0, (PTR) &rngvar->pss_outer_rel);
    }

    /* Release description for result range variable;
    ** but don't release it if this is a dummy set-input range variable
    ** and we are creating the procedure for the first time
    */
    status = pst_rng_unfix(sess_cb, &rngtab->pss_rsrng, err_blk);
    if (status != E_DB_OK)
	return (status);

    /* Clear the range variable number */
    rngtab->pss_rsrng.pss_rgno = -1;

    /* clear the inner and the outer relation mask */
    MEfill(sizeof(PST_J_MASK), (u_char) 0,
           (PTR) &rngtab->pss_rsrng.pss_inner_rel);
    MEfill(sizeof(PST_J_MASK), (u_char) 0,
           (PTR) &rngtab->pss_rsrng.pss_outer_rel);

    return (E_DB_OK);
}
Пример #8
0
STATUS
gcn_recv( i4 assoc_id, char *buff, i4 buff_len, bool formatted,
          i4  *msg_type, i4 *msg_size, bool *eod, bool *eog )
{
    GCA_RV_PARMS	recv;
    STATUS		status;

    MEfill( sizeof( recv ), 0, (PTR)&recv );
    recv.gca_association_id = assoc_id;
    recv.gca_flow_type_indicator = GCA_NORMAL;
    recv.gca_modifiers = formatted ? GCA_FORMATTED : 0;
    recv.gca_buffer = buff;
    recv.gca_b_length = buff_len;

    gca_call( &gcn_gca_cb, GCA_RECEIVE, (GCA_PARMLIST *)&recv, 
	      GCA_SYNC_FLAG, NULL, GCN_RCV_TIMEOUT, &status );

    gcn_checkerr("GCA_RECEIVE", &status, recv.gca_status, &recv.gca_os_status);
    if ( status != OK )  return( status );

    *msg_type = recv.gca_message_type;
    *msg_size = recv.gca_d_length;
    *eod = recv.gca_end_of_data;
    *eog = recv.gca_end_of_group;

    return( OK );
}
Пример #9
0
/*{
** Name: OPU_GSMEMORY_CLOSE	- Get memory from the stack ULM memory stream
**
** Description:
**      This routine allocates memory from the ULM memory stream that is used 
**      for the stack style memory usage.
[@comment_line@]...
**
** Inputs:
**	global -
**	    State info for the current query.
**	global->ops_mstate.ops_ulmrcb -
**	    The ULM control block.
**	global->ops_mstate.ops_sstreamid -
**	    The stream id.
**	size -
**	    size of the piece of memory to allocate.
**
** Outputs:
**
**	Returns:
**	    The address of the allocated memory.
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**      19-July-87 (eric)
**          written
**      21-feb-91 (seputis)
**          make non-zero initialization of memory an xDEBUG feature
**      16-sep-93 (smc)
**          Moved <cs.h> for CS_SID.
**	11-oct-2006 (hayke02)
**	    Send E_OP0002_NOMEMORY to errlog.log. This change fixes bug 116309.
[@history_line@]...
[@history_template@]...
*/
PTR
opu_Gsmemory_get(
	OPS_STATE   *global,
	i4	    size)
{
    DB_STATUS      ulmstatus;		    /* return status from ULM */

    /* store the stream id */
    global->ops_mstate.ops_ulmrcb.ulm_streamid_p = &global->ops_mstate.ops_sstreamid;

    /* store the size to be allocate */
    global->ops_mstate.ops_ulmrcb.ulm_psize = size;

    if ( (ulmstatus = ulm_palloc( &global->ops_mstate.ops_ulmrcb )) != E_DB_OK )
    {
	if (global->ops_mstate.ops_ulmrcb.ulm_error.err_code == E_UL0005_NOMEM)
	{
	    opx_lerror(E_OP0002_NOMEMORY, 0, 0, 0, 0, 0);
	    opx_error( E_OP0002_NOMEMORY);  /* out of memory */
	}
#ifdef E_OP0093_ULM_ERROR
	else
	    opx_verror( ulmstatus, E_OP0093_ULM_ERROR, 
		global->ops_mstate.ops_ulmrcb.ulm_error.err_code); /* check for error */
#endif
    }	
#ifdef xDEBUG
    MEfill( size, (u_char)127, (PTR)global->ops_mstate.ops_ulmrcb.ulm_pptr); /*FIXME
                                            ** remove this initialization after
                                            ** test for uninitialized memory
                                            ** is not required any more */
#endif
    /* return the allocated memory */
    return( global->ops_mstate.ops_ulmrcb.ulm_pptr );
}
Пример #10
0
GCADM_SCB *
gcadm_new_scb( i4 aid, PTR gca_cb )
{
   GCADM_SCB  *scb;

    scb = (GCADM_SCB *)(* GCADM_global.alloc_rtn )( sizeof( GCADM_SCB ) );
   
    if ( scb )
    {
	MEfill( sizeof( GCADM_SCB ), 0, scb);
	scb->buffer = (char *) (*GCADM_global.alloc_rtn)
			    ( GCADM_global.gcadm_buff_len );
   }
   
    if ( scb->buffer )
    {
	scb->aid  =  aid;
	scb->gca_cb = gca_cb;
	QUinit( &scb->q );
	QUinsert( &scb->q, GCADM_global.scb_q.q_prev); 
    }
    else
    {
	(*GCADM_global.dealloc_rtn)( (PTR)scb );
	scb = NULL;
    }

    return( scb );
}
Пример #11
0
void 
gcadm_resume( GCADM_RCB * rcb )
{
     STATUS status; 
    GCADM_SCB * scb=rcb->scb;
     
	if ( GCADM_global.gcadm_trace_level >= 4 )
	    TRdisplay( "%4d   GCADM resume: entry\n", scb->aid  );
	/*
	** resume GCA services 
	*/

	MEfill(sizeof(scb->parms.gca_all_parm), 0, &scb->parms.gca_all_parm);
	scb->parms.gca_all_parm.gca_assoc_id = scb->aid;
	scb->parms.gca_all_parm.gca_completion = gcadm_complete; 
	scb->parms.gca_all_parm.gca_closure = (PTR)rcb;

	gca_call( &scb->gca_cb, rcb->operation,
		    (GCA_PARMLIST *)&scb->parms,
		    GCA_ASYNC_FLAG | GCA_ALT_EXIT | GCA_RESUME,
		    (PTR)rcb, -1, &status);
		    
	  
	if ( status != OK )  
	{
	    if ( GCADM_global.gcadm_trace_level >= 1 )
		TRdisplay( "%4d   GCADM resume: disassociate error: 0x%x\n",
		       scb->aid, status );
	    if ( rcb ) 
		rcb->status = status; 
	}
	return; 
}
Пример #12
0
/*{
** Name: psy_kuser - Destroy user
**
**  INTERNAL PSF call format: status = psy_kuser(&psy_cb, sess_cb);
**
** Description:
**	This procedure deletes a user.  If the
**	user does not exist, the statement is aborted.
**	If the user does exist, the associated
**	iiuser tuple is deleted.
**	This procedure is called for SQL language only.
**
** Inputs:
**      psy_cb
**	    .psy_usrq			user list
**	sess_cb				Pointer to session control block
**					(Can be NULL)
**
** Outputs:
**      psy_cb
**	    .psy_error			Filled in if error happens
**	Returns:
**	    E_DB_OK			Function completed normally.
**	    E_DB_INFO			Function completed with warning(s).
**	    E_DB_WARN			One ore more roles were rejected.
**	    E_DB_ERROR			Function failed; non-catastrophic error
**	Exceptions:
**	    none
**
** Side Effects:
**	    Removed tuples from iiuser.
**
** History:
**	04-sep-89 (ralph)
**          written
**	12-mar-90 (andre)
**	    set rdr_2types_mask to 0.
**      22-may-90 (teg)
**          init rdr_instr to RDF_NO_INSTR
*/
DB_STATUS
psy_kuser(
	PSY_CB             *psy_cb,
	PSS_SESBLK	   *sess_cb)
{
    DB_STATUS		status, stat;
    RDF_CB		rdf_cb;
    register RDR_RB	*rdf_rb = &rdf_cb.rdf_rb;
    DU_USER		ustuple;
    register DU_USER	*ustup = &ustuple;
    PSY_USR		*psy_usr;

    /* This code is called for SQL only */

    /*
    ** Fill in the part of RDF request block that will be constant.
    */
    pst_rdfcb_init(&rdf_cb, sess_cb);
    rdf_rb->rdr_update_op   = RDR_DELETE;
    rdf_rb->rdr_status	    = DB_SQL;
    rdf_rb->rdr_types_mask  = RDR_USER;
    rdf_rb->rdr_qrytuple    = (PTR) ustup;
    rdf_rb->rdr_qtuple_count = 1;

    ustup->du_gid	= 0;
    ustup->du_mid	= 0;
    ustup->du_status 	= 0;
    ustup->du_flagsmask	= 0;


    MEfill(sizeof(ustup->du_group),
	   (u_char)' ',
	   (PTR)&ustup->du_group);

    status = E_DB_OK;

    for (psy_usr  = (PSY_USR *)  psy_cb->psy_usrq.q_next;
	 psy_usr != (PSY_USR *) &psy_cb->psy_usrq;
	 psy_usr  = (PSY_USR *)  psy_usr->queue.q_next
	)
    {
	/* STRUCT_ASSIGN_MACRO(psy_usr->psy_usrnm,
			       ustup->du_name); */
	MEcopy((PTR)&psy_usr->psy_usrnm,
	       sizeof(ustup->du_name),
	       (PTR)&ustup->du_name);

	stat = rdf_call(RDF_UPDATE, (PTR)&rdf_cb);
	status = (stat > status) ? stat : status;

	if (DB_FAILURE_MACRO(stat))
	    break;
    }

    if (DB_FAILURE_MACRO(status))
	(VOID) psf_rdf_error(RDF_UPDATE, &rdf_cb.rdf_error, 
			     &psy_cb->psy_error);

    return    (status);
} 
Пример #13
0
DB_STATUS
adi_tycoerce(
ADF_CB              *adf_scb,
DB_DT_ID            adi_did,
ADI_DT_BITMASK      *adi_dmsk)
{
    DB_DT_ID            bdt = abs(adi_did);
    u_i2                bm_size = sizeof(ADI_DT_BITMASK);
    i4                  n;


    for(n=1; n <= ADI_MXDTS; n++)
    {
	if (Adf_globs->Adi_datatypes[n].adi_dtid == DB_NODT) break;

	if (Adf_globs->Adi_datatypes[n].adi_dtid == bdt)
	{
	    MEcopy(adf_scb->adf_qlang == DB_SQL
			? (PTR)&Adf_globs->Adi_datatypes[n].adi_dtcoerce_sql
			: (PTR)&Adf_globs->Adi_datatypes[n].adi_dtcoerce_quel,
			bm_size, (PTR)adi_dmsk);
	    return(E_DB_OK);
	}
    }

    MEfill(bm_size, (u_char)0, (PTR)adi_dmsk);
    return(adu_error(adf_scb, E_AD2004_BAD_DTID, 0));
}
Пример #14
0
STATUS
gcn_testaddr( char *target, i4  direct, char *username )
{
    GCA_RQ_PARMS	request;
    i4		count = 0;
    STATUS		status;
    STATUS		req_status;

    MEfill( sizeof( request ), '\0', (PTR)&request );
    request.gca_partner_name = target;
    request.gca_modifiers = direct ? GCA_NO_XLATE : 0;
    request.gca_user_name = username;

    gca_call( &gcn_gca_cb, GCA_REQUEST, (GCA_PARMLIST *)&request,
	      GCA_SYNC_FLAG, NULL, -1, &status );

    gcn_checkerr( "GCA_REQUEST", &status, 
	          request.gca_status, &request.gca_os_status );

    /*
    ** If we connected successfully, release the connection.
    */
    if ( status == OK )
	gcn_send( request.gca_assoc_id, GCA_RELEASE, 
		  (char *)&count, sizeof( count ), TRUE );

    /*
    ** Even failed GCA_REQUEST calls need to call GCA_DISASSOC.
    */
    gcn_release( request.gca_assoc_id );

    return( status );
}
Пример #15
0
STATUS
gcn_fastselect( u_i4 oper_code, char *target )
{
    GCA_RQ_PARMS	request;
    i4	    	assoc_no;
    STATUS		status;
    STATUS		tmp_stat;

    MEfill( sizeof( request ), '\0', (PTR)&request );
    request.gca_partner_name = target;
    request.gca_modifiers = oper_code;

    gca_call( &gcn_gca_cb, GCA_REQUEST, (GCA_PARMLIST *)&request, 
	      GCA_SYNC_FLAG, NULL, (i4)(-1), &status );
    if ( status == OK )  status = request.gca_status;

    if ( status != E_GC0040_CS_OK )
    {
	gcn_checkerr( "GCA_REQUEST", &status, 
		      request.gca_status, &request.gca_os_status);
    }

    gcn_release( request.gca_assoc_id );

    return( status );
}
Пример #16
0
/*{
** Name: QEU_CLOSE      - close an opened table
**
** External QEF call:       status = qef_call(QEU_CLOSE, &qeu_cb);
**
** Description:
**      Close a table opened through the QEU_OPEN command. 
**
** Inputs:
**      qeu_cb
**	    .qeu_eflag			    designate error handling semantis
**					    for user errors.
**		QEF_INTERNAL		    return error code.
**		QEF_EXTERNAL		    send message to user.
**          .qeu_acc_id			    table access id
**
** Outputs:
**      qeu_cb
**          .error.err_code                 One of the following
**                                          E_QE0000_OK
**                                          E_QE0002_INTERNAL_ERROR
**                                          E_QE0004_NO_TRANSACTION
**                                          E_QE0007_NO_CURSOR
**                                          E_QE0017_BAD_CB
**                                          E_QE0018_BAD_PARAM_IN_CB
**      Returns:
**          E_DB_OK
**          E_DB_ERROR                      caller error
**          E_DB_FATAL                      internal error
**      Exceptions:
**          none
**
** Side Effects:
**          none
**
** History:
**      27-may-86 (daved)
**          written
**	14-may-87 (daved)
**	    zero the access id to cause an error in DMF if a table is
**	    closed twice.
*/
DB_STATUS
qeu_close(
QEF_CB      *qef_cb,
QEU_CB      *qeu_cb)
{
    i4     err;
    DMT_CB      dmt_cb;
    DB_STATUS   status;

    /* QEU_CLOSE is only valid in a transaction */
    if (qef_cb->qef_stat == QEF_NOTRAN)
    {
        qef_error(E_QE0004_NO_TRANSACTION, 0L, E_DB_ERROR, &err,
            &qeu_cb->error, 0);
        return (E_DB_ERROR);
    }
    MEfill(sizeof(DMT_CB), 0, (PTR) &dmt_cb);
    dmt_cb.type         = DMT_TABLE_CB;
    dmt_cb.length       = sizeof(DMT_CB);
    dmt_cb.dmt_flags_mask   = 0;
    dmt_cb.dmt_record_access_id = qeu_cb->qeu_acc_id;
    status = dmf_call(DMT_CLOSE, &dmt_cb);
    if (status != E_DB_OK)
    {
        qef_error(dmt_cb.error.err_code, 0L, status, &err, &qeu_cb->error, 0);
    }
    else
	qef_cb->qef_open_count--;
    qeu_cb->qeu_acc_id = (PTR) NULL;
    return (status);
}
Пример #17
0
/*{
** Name: opv_varnode	- make a range variable node
**
** Description:
**      This procedure allocates and initializes a query tree PST_VAR node.
**
** Inputs:
**      global                          ptr to global state variable
**      datavalue                       datatype info of node to create
**      variable                        range variable number - index
**                                      into the global range table
**      attribute                       dmf attribute of range variable to be
**					assigned to var node.
**
** Outputs:
**	Returns:
**	    ptr to PST_QNODE initialized to be a var node
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**	8-apr-86 (seputis)
**          initial creation
**	9-jul-91 (seputis)
**	    remove obsolete trace point
[@history_line@]...
*/
PST_QNODE *
opv_varnode(
	OPS_STATE          *global,
	DB_DATA_VALUE      *datatype,
	OPV_IGVARS         variable,
	DB_ATT_ID	   *dmfattr)
{
    register PST_QNODE *qnode;      /* ptr used for symbol allocation */

    qnode = (PST_QNODE *) opu_memory( global, (i4) sizeof(PST_QNODE));
                                    /* allocate storage for query tree node
                                    ** to be used for creation of var node
                                    */
    qnode->pst_left = NULL;
    qnode->pst_right = NULL;
    qnode->pst_sym.pst_type = PST_VAR; /* create VAR node type */
    STRUCT_ASSIGN_MACRO(*datatype, qnode->pst_sym.pst_dataval);
    qnode->pst_sym.pst_dataval.db_data = NULL;
    qnode->pst_sym.pst_len = sizeof(PST_VAR_NODE);
    qnode->pst_sym.pst_value.pst_s_var.pst_vno = variable;
    STRUCT_ASSIGN_MACRO(*dmfattr, qnode->pst_sym.pst_value.pst_s_var.pst_atno);
    MEfill(sizeof(qnode->pst_sym.pst_value.pst_s_var.pst_atname), ' ', 
	(PTR)&qnode->pst_sym.pst_value.pst_s_var.pst_atname); /* init attribute
				    ** name */
    return( qnode );
}
Пример #18
0
DB_STATUS
qet_t7_p1_recover(
QEF_RCB         *v_qer_p)
{
    DB_STATUS	    status= E_DB_OK;
    QEF_DDB_REQ	    *ddr_p = & v_qer_p->qef_r3_ddb_req;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    DD_LDB_DESC	    *iidbdb_p =  & v_qer_p->qef_r3_ddb_req.qer_d2_ldb_info_p->
			dd_i1_ldb_desc;
    TPR_CB	    tpr_cb,
		    *tpr_p = & tpr_cb;


    ddr_p->qer_d13_ctl_info &= ~QEF_04DD_RECOVERY;  /* assume NO recovery */

    MEfill(sizeof(tpr_cb), '\0', (PTR) & tpr_cb);
    tpr_p->tpr_session = dds_p->qes_d2_tps_p;	/* TPF session CB ptr */
    tpr_p->tpr_rqf = dds_p->qes_d3_rqs_p;	/* RQF session CB ptr */
    tpr_p->tpr_site = iidbdb_p;
						/* iidbdb desc */
    status = qed_u17_tpf_call(TPF_P1_RECOVER, tpr_p, v_qer_p);
    if (status == E_DB_OK)
    {
	if (tpr_p->tpr_need_recovery)
	    ddr_p->qer_d13_ctl_info |= QEF_04DD_RECOVERY;	
						/* yes, recovery */
    }
    return(status);
}
Пример #19
0
DB_STATUS
qet_t10_is_ddb_open(
QEF_RCB         *v_qer_p)
{
    DB_STATUS	    status= E_DB_OK;
    QEF_DDB_REQ	    *ddr_p = & v_qer_p->qef_r3_ddb_req;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    TPR_CB	    tpr_cb,
		    *tpr_p = & tpr_cb;

    ddr_p->qer_d13_ctl_info &= ~QEF_05DD_DDB_OPEN;   /* assume NOT open */

    MEfill(sizeof(tpr_cb), '\0', (PTR) & tpr_cb);
    tpr_p->tpr_session = dds_p->qes_d2_tps_p;	/* TPF session CB ptr */
    tpr_p->tpr_rqf = dds_p->qes_d3_rqs_p;	/* RQF session CB ptr */
    tpr_p->tpr_16_ddb_p = v_qer_p->qef_r3_ddb_req.qer_d1_ddb_p;;

    status = qed_u17_tpf_call(TPF_IS_DDB_OPEN, tpr_p, v_qer_p);
    if (status == E_DB_OK)
    {
	if (tpr_p->tpr_17_ddb_open == TRUE)    /* DDB NOT in recovery */
	    ddr_p->qer_d13_ctl_info |= QEF_05DD_DDB_OPEN;   
    }
    return(status);
}
Пример #20
0
DB_STATUS
qet_t4_savept(
QEF_CB         *qef_cb)
{
    i4	err;
    DB_STATUS   status;
    TPR_CB	tpr_cb,
		*tpr_p = & tpr_cb;


    if (qef_cb->qef_rcb->qef_spoint == 0)
    {
        qef_error(E_QE0018_BAD_PARAM_IN_CB, 0L, E_DB_WARN, &err,
		  &qef_cb->qef_rcb->error, 0);
        return (E_DB_WARN);
    }

    /* Must be in a transaction */

    if (qef_cb->qef_stat == QEF_NOTRAN)
    {
	if (qef_cb->qef_rcb->qef_flag == DB_QUEL)
	{
	    qef_error(E_QE0004_NO_TRANSACTION, 0L, E_DB_WARN, &err,
		      &qef_cb->qef_rcb->error, 0);
	    return (E_DB_WARN);
	}
	else if (qef_cb->qef_auto == QEF_ON)
	{
	    /* savepoint not allowed when autocommit is on */
	    qef_error(2178L, 0L, E_DB_WARN, &err, &qef_cb->qef_rcb->error, 0);
	    return (E_DB_WARN);
	}
    }

    /* Cannot set a savepoint if there are open cursors */

    if (qef_cb->qef_open_count > 0)
    {
        qef_error(E_QE0020_OPEN_CURSOR, 0L, E_DB_WARN, &err,
		  &qef_cb->qef_rcb->error, 0);
        return (E_DB_WARN);
    }

    MEfill(sizeof(tpr_cb), '\0', (PTR) & tpr_cb);
    tpr_p->tpr_session = qef_cb->qef_c2_ddb_ses.qes_d2_tps_p;
    tpr_p->tpr_rqf = qef_cb->qef_c2_ddb_ses.qes_d3_rqs_p;
    tpr_p->tpr_save_name = qef_cb->qef_rcb->qef_spoint;

    if (qef_cb->qef_rcb->qef_flag == DB_QUEL)
	tpr_p->tpr_lang_type = DB_QUEL;
    else if (qef_cb->qef_rcb->qef_flag == DB_SQL)
	tpr_p->tpr_lang_type = DB_SQL;
    else
	tpr_p->tpr_lang_type = DB_NOLANG;

    status = qed_u17_tpf_call(TPF_SAVEPOINT, tpr_p, qef_cb->qef_rcb);

    return(status);
}
Пример #21
0
DB_STATUS
qet_t11_ok_w_ldb(
DD_LDB_DESC	*i1_ldb_p,
QEF_RCB		*v_qer_p,
bool		*o1_ok_p)
{
    DB_STATUS	    status = E_DB_OK;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    TPR_CB	    tpr_cb;
    TPR_W_LDB	    wldb,
		    *wldb_p = & wldb;


    MEfill(sizeof(tpr_cb), '\0', (PTR) & tpr_cb);
    tpr_cb.tpr_session = dds_p->qes_d2_tps_p;	/* TPF session CB ptr */
    tpr_cb.tpr_rqf = dds_p->qes_d3_rqs_p;	/* RQF session CB ptr */
    tpr_cb.tpr_15_w_ldb_p = wldb_p;

    wldb_p->tpr_3_ldb_p = i1_ldb_p;
    wldb_p->tpr_1_prev_p = 
	wldb_p->tpr_2_next_p = (TPR_W_LDB *) NULL;

    status = qed_u17_tpf_call(TPF_OK_W_LDBS, & tpr_cb, v_qer_p);
    if (status == E_DB_OK)
	*o1_ok_p = tpr_cb.tpr_14_w_ldbs_ok;
    return(status);
}
Пример #22
0
GCD_CIB *
gcd_new_cib( u_i2 count )
{
    GCD_CIB	*cib = NULL;
    u_i2	len = sizeof( GCD_CIB ) + (sizeof(CONN_PARM) * (count - 1));

    if ( count < ARR_SIZE( GCD_global.cib_free ) )
	if (! (cib = (GCD_CIB *)QUremove(GCD_global.cib_free[count].q_next)))
	    if ( (cib = (GCD_CIB *)MEreqmem( 0, len, FALSE, NULL )) )
		cib->id = GCD_global.cib_total++;

    if ( ! cib )
	gcu_erlog(0, GCD_global.language, E_GC4808_NO_MEMORY, NULL, 0, NULL);
    else  
    {
	u_i4	id = cib->id;
	char	buff[16];

	MEfill( len, 0, (PTR)cib );
	cib->id = id;
	cib->parm_max = count;
	QUinit( &cib->caps );

	MOulongout( 0, (u_i8)cib->id, sizeof( buff ), buff );
	MOattach( MO_INSTANCE_VAR, GCD_MIB_DBMS, buff, (PTR)cib );

	GCD_global.cib_active++;

	if ( GCD_global.gcd_trace_level >= 6 )
	    TRdisplay( "%4d    GCD new CIB (%d)\n", -1, cib->id );
    }

    return( cib );
}
Пример #23
0
static VOID
uuid_format(
DB_DATA_VALUE   *dv,
UUID		*uuid)
{
    /* Pad or Truncate byte to sizeof(UUID) and align */
    if (dv->db_length != sizeof(UUID))
    {
	if (dv->db_length >= sizeof(UUID))
	{
	    MECOPY_CONST_MACRO((char *)dv->db_data, sizeof(UUID), (char *)uuid);
	}
	else
	{
	    MEcopy((char *)dv->db_data, dv->db_length, (char *)uuid);
	    MEfill(sizeof(UUID) - dv->db_length, '\0', 
		(char *)uuid + dv->db_length);
	}
    }
    else
    {
	/* Alignment */
	MECOPY_CONST_MACRO((char *)dv->db_data, sizeof(UUID), (char *)uuid);
    }
}
Пример #24
0
DB_STATUS 
qeq_c2_delete(
QEF_RCB		*v_qer_p,
QEE_DSH		*i_dsh_p )
{
    DB_STATUS	    status = E_DB_OK;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    QES_QRY_SES	    *qss_p = & dds_p->qes_d8_union.u2_qry_ses;
    QEE_DDB_CB	    *qee_p = i_dsh_p->dsh_ddb_cb;
    QEF_QP_CB	    *qp_p = i_dsh_p->dsh_qp_ptr;
    QEQ_DDQ_CB	    *ddq_p = & qp_p->qp_ddq_cb;	
    bool	    log_qry_55 = FALSE,
                    log_err_59 = FALSE;
    i4         i4_1, i4_2;
    RQR_CB	    rqr,
		    *rqr_p = & rqr;


    if (ult_check_macro(& v_qer_p->qef_cb->qef_trace, QEF_TRACE_DDB_LOG_QRY_55,
        & i4_1, & i4_2))
    {
        log_qry_55 = TRUE;
	qeq_p34_del_csr(v_qer_p, i_dsh_p);
    }
    if (ult_check_macro(& v_qer_p->qef_cb->qef_trace, QEF_TRACE_DDB_LOG_ERR_59,
        & i4_1, & i4_2))
        log_err_59 = TRUE;


    /* 2.  set up to call RQR_DELETE */

    MEfill(sizeof(rqr), '\0', (PTR) & rqr);
    rqr_p->rqr_session = dds_p->qes_d3_rqs_p;   /* RQF session id */
    rqr_p->rqr_tabl_name = ddq_p->qeq_d7_deltable;
    rqr_p->rqr_own_name = ddq_p->qeq_d9_delown;
						/* pass owner/table name for
						** CURSOR DELETE */
    rqr_p->rqr_timeout = QEK_0_TIME_QUANTUM;
    rqr_p->rqr_q_language = qss_p->qes_q2_lang;
    rqr_p->rqr_1_site = qss_p->qes_q3_ldb_p;
    STRUCT_ASSIGN_MACRO(qee_p->qee_d5_local_qid, rqr_p->rqr_qid);

    qss_p->qes_q1_qry_status |= QES_03Q_PHASE2;
						/* enter phase 2 for update */
    status = qed_u3_rqf_call(RQR_DELETE, rqr_p, v_qer_p);
    if (status)
    {
	if (log_err_59 && ! log_qry_55)
	    qeq_p34_del_csr(v_qer_p, i_dsh_p);
    }
    else
    {
    	qss_p->qes_q1_qry_status &= ~QES_03Q_PHASE2;
						/* enter phase 2 for update */
	v_qer_p->qef_rowcount = rqr_p->rqr_tupcount;
	v_qer_p->qef_count = rqr_p->rqr_tupcount;
    }
    return(status);
}
Пример #25
0
/*{
** Name: ule_initiate	- Provide server constant info for the server header
**
** Description:
**      This routine takes in the server constant parameters SERVER NAME and
**      NODE NAME, placing them in an area which is easily found to place on 
**      all error messages.
**
** Inputs:
**      node_name                       Pointer to node name, which is
**      l_node_name                     characters long
**      server_name                     Same for server name
**      l_server_name
**
** Outputs:
**      None.
**	Returns:
**	    VOID
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**      06-Aug-1987 (fred)
**          Created.
**      21-Mar-2005 (mutma03)
**          cleanup of node translation code for clusters.
**	07-jan-2008 (joea)
**	    Undo 28-jun-2001 and 21-mar-2005 cluster nickname changes.
*/
VOID
ule_initiate( char *node_name, i4  l_node_name, char *server_name,
	      i4  l_server_name )
{
    PID proc_id;
    char fmt[20];

    if (Ule_started <= 0)
    {
        PCpid(&proc_id);
	
	MEfill(sizeof(ULE_MHDR), (u_char)' ', (PTR)&Ule_mhdr);	
	MEmove( l_node_name,
		(PTR)  node_name,
		(char) ' ',
		sizeof(Ule_mhdr.ule_node),
		(PTR)  &Ule_mhdr.ule_node[0]);
	MEmove(	l_server_name,
		(PTR)  server_name,
		(char) ' ',
		sizeof(Ule_mhdr.ule_server),
		(PTR)  &Ule_mhdr.ule_server[0]);
	MEfill(	sizeof(Ule_mhdr.ule_session),
		(u_char) '*',
		(PTR)  &Ule_mhdr.ule_session[0]);
	Ule_mhdr.ule_pad1[0] = ':',
	    Ule_mhdr.ule_pad1[1] = ':',
	    Ule_mhdr.ule_pad1[2] = '['; 	
	Ule_mhdr.ule_pad2[0] = ',',
	    Ule_mhdr.ule_pad2[1] = ' '; 	
        STprintf( fmt, "%s", PIDFMT );
        STprintf(Ule_mhdr.ule_pid, fmt, proc_id);
        Ule_mhdr.ule_pad3[0] = ',',
	Ule_mhdr.ule_pad3[1] = ' ';
	Ule_mhdr.ule_pad4[0] = ',';
	Ule_mhdr.ule_pad4[1] = ' ';
	MEfill(	sizeof(Ule_mhdr.ule_source),
		(char) ' ',
		(PTR) &Ule_mhdr.ule_source[0]);
	Ule_mhdr.ule_pad5[0] = ']',
	    Ule_mhdr.ule_pad5[1] = ':',
	    Ule_mhdr.ule_pad5[2] = ' '; 	
	Ule_started = 1;
    }
}
Пример #26
0
/*{
** Name: psy_qminit	- Allocate and initialize the PSY_CB
**
** Description:
**      This function allocates and initialzes the qrymod control
**	block, PSY_CB.  It is called by the grammar.
**
** Inputs:
**	sess_cb				Current session control block
**	psq_cb
**	    .err_blk			Filled in if an error happens
**	mstream				memory stream to use for allocating a
**					PSY_CB
**
** Outputs:
**	sess_cb
**	    .pss_object			Points to allocated psy_cb
**	Returns:
**	    E_DB_OK			Success
**	    Other			Return code from called functions
**	Exceptions:
**	    none
**
** Side Effects:
**	    Allocates memory
**
** History:
**      22-jul-89 (ralph)
**          Written.
**	08-aug-90 (ralph)
**	    Initialize new psy_cb fields.
**	14-jul-92 (andre)
**	    init PSY_CB.psy_flags
**	14-jul-92 (andre)
**	    added mstream to the function's interface which will enable it to no
**	    longer assume that PSY_CB must be allocated from any given stream.
**	20-jul-92 (andre)
**	    added initialization for psy_xcolq
**	20-jul-92 (andre)
**	    iprocessing DROP PROCEDURE (psq_cb->psq_mode == PSQ_DRODBP), memory
**	    stream has already been opened, so don't do it here
**	21-jul-92 (andre)
**	    removed initialization for psy_xcolq;
**
**	    replaced code initializing various fields to 0 with a call to MEfill
**	    to fill a newly allocated PSY_CB with 0's
**	06-dec-92 (andre)
**	    Added code to initialize psy_u_colq and psy_r_colq
**	10-jul-93 (andre)
**	    cast QUinit()'s arg to (QUEUE *) to agree with the prototype
**	    declaration
**	 7-jan-94 (swm)
**	    Bug #58635
**	    Added PTR cast for qsf_owner which has changed type to PTR.
**	28-apr-94 (andre)
**	    (part of fix for bug 62890)
**	    if the statement was generated internally 
**	    (psq_cb->psq_info->pst_execflags & PST_SYSTEM_GENERATED), set 
**	    PSY_SYSTEM_GENEARTED in psy_cb->psy_flags.
*/
DB_STATUS
psy_qminit(
	PSS_SESBLK	    *sess_cb,
	PSQ_CB		    *psq_cb,
	PSF_MSTREAM	    *mstream)
{
    DB_STATUS	    status;
    PSY_CB	    *psy_cb;

    /*
    ** open the memory stream unless we are processing DROP PROCEDURE, in which
    ** case it has already been opened
    */
    if (psq_cb->psq_mode != PSQ_DRODBP)
    {
	/* Allocate the PSY_CB statement */
	status = psf_mopen(sess_cb, QSO_QP_OBJ, mstream, &psq_cb->psq_error);
	if (status != E_DB_OK)
	    return (status);
    }

    status = psf_malloc(sess_cb, mstream, sizeof(PSY_CB), &sess_cb->pss_object,
	&psq_cb->psq_error);
    if (status != E_DB_OK)
	return (status);

    status = psf_mroot(sess_cb, mstream, sess_cb->pss_object, &psq_cb->psq_error);
    if (status != E_DB_OK)
	return (status);

    psy_cb = (PSY_CB *) sess_cb->pss_object;

    MEfill(sizeof(PSY_CB), (u_char) 0, (PTR) psy_cb);

    /* Fill in control block header */
    psy_cb->psy_length	 = sizeof(PSY_CB);
    psy_cb->psy_type	 = PSYCB_CB;
    psy_cb->psy_owner	 = (PTR)DB_PSF_ID;
    psy_cb->psy_ascii_id = PSYCB_ASCII_ID;

    (VOID) QUinit((QUEUE *) &psy_cb->psy_usrq);	/* No users */
    (VOID) QUinit((QUEUE *) &psy_cb->psy_tblq);	/* No tables */
    (VOID) QUinit((QUEUE *) &psy_cb->psy_colq);	/* No columns */
    (VOID) QUinit((QUEUE *) &psy_cb->psy_u_colq);
    (VOID) QUinit((QUEUE *) &psy_cb->psy_r_colq);

    /*
    ** remember whether the statement was generated internally
    */
    if (   psq_cb->psq_info 
	&& psq_cb->psq_info->pst_execflags & PST_SYSTEM_GENERATED)
    {
	psy_cb->psy_flags |= PSY_SYSTEM_GENERATED;
    }

    return(E_DB_OK);
}
Пример #27
0
STATUS
jdbc_gca_init( char *myaddr )
{
    GCA_PARMLIST	parms;
    STATUS		status;

    MEfill( sizeof(parms), 0, (PTR) &parms);
    parms.gca_in_parms.gca_local_protocol = JDBC_GCA_PROTO_LVL;
    parms.gca_in_parms.gca_normal_completion_exit = gca_sm;
    parms.gca_in_parms.gca_expedited_completion_exit = gca_sm;
    parms.gca_in_parms.gca_modifiers |= GCA_API_VERSION_SPECD;
    parms.gca_in_parms.gca_api_version = GCA_API_LEVEL_5;

    IIGCa_cb_call( &gca_cb, GCA_INITIATE, 
		   &parms, GCA_SYNC_FLAG, NULL, -1, &status );
			
    if ( status != OK || (status = parms.gca_in_parms.gca_status) != OK )
    {
	gcu_erlog( 0, JDBC_global.language, status, 
		   &parms.gca_in_parms.gca_os_status, 0, NULL );
	return( status );
    }

    MEfill( sizeof(parms), 0, (PTR) &parms);
    parms.gca_rg_parms.gca_srvr_class = JDBC_SRV_CLASS;
    parms.gca_rg_parms.gca_l_so_vector = 0;
    parms.gca_rg_parms.gca_served_object_vector = NULL;
    parms.gca_rg_parms.gca_installn_id = "";
	    
    IIGCa_cb_call( &gca_cb, GCA_REGISTER, 
		   &parms, GCA_SYNC_FLAG, NULL, -1, &status );

    if ( status != OK || (status = parms.gca_rg_parms.gca_status) != OK )
    {
	gcu_erlog( 0, JDBC_global.language, 
		   status, &parms.gca_rg_parms.gca_os_status, 0, NULL );
	return( status );
    }

    gca_sm( 0 );
    STcopy( parms.gca_rg_parms.gca_listen_id, myaddr );

    return( OK );
}
Пример #28
0
STATUS
gcn_request( char *gcn_host, i4  *assoc_no, i4 *protocol )
{
    GCA_RQ_PARMS	request;
    STATUS		status = OK;
    char		tbuff[ GC_HOSTNAME_MAX + 12 ];
    char		*target;
    i4			len;

    /* 
    ** Prepare for GCA_REQUEST service call 
    */
    len = (gcn_host ? STlength( gcn_host ) + 2 : 0) + 10;
    target = (len <= sizeof( tbuff )) 
    	     ? tbuff : (char *)MEreqmem( 0, len, FALSE, NULL );

    if ( ! target )  return( E_GC0013_ASSFL_MEM );

    STprintf( target, "%s%s/IINMSVR", 
	      gcn_host ? gcn_host : "", gcn_host ? "::" : "" );

    MEfill( sizeof( request ), '\0', (PTR)&request );
    request.gca_peer_protocol = GCA_PROTOCOL_LEVEL_63;
    request.gca_partner_name = target;

    /* 
    ** Make GCA_REQUEST service call 
    */
    gca_call( &gcn_gca_cb, GCA_REQUEST, (GCA_PARMLIST *)&request,
	      GCA_SYNC_FLAG, NULL, GCN_RCV_TIMEOUT, &status );

    gcn_checkerr( "GCA_REQUEST", 
		  &status, request.gca_status, &request.gca_os_status );

    if ( status != OK )  goto done;

    if ( gcn_host  &&  request.gca_peer_protocol < GCA_PROTOCOL_LEVEL_50 )
    {
        gcn_release( request.gca_assoc_id );
	CL_CLEAR_ERR( &request.gca_os_status );
	gcn_checkerr( "GCA_REQUEST", 
		      &status, E_GC000A_INT_PROT_LVL, &request.gca_os_status );
	goto done;
    }

    *assoc_no = request.gca_assoc_id;
    *protocol = request.gca_peer_protocol;

  done :

    if ( target != tbuff )  MEfree( (PTR)target );
    return( status );
}
Пример #29
0
/*{
** Name: adu_lolk	- Return logical key part of coupon
**
** Description:
**      This routine simply returns the logical key part of a
**      particular ADP_COUPON structure.
**
** Inputs:
**      adf_scb                         Session Control Block.
**      cpn_dv                          Ptr to DB_DATA_VALUE describing the
**					coupon to be printed
**      res_dv                          Ptr to DB_DATA_VALUE describing the
**					result area.  Must be DB_TAB_KEY
**
** Outputs:
**      *res_dv->db_data                Filled in.
**
**	Returns:
**	    DB_STATUS
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**      16-Apr-1993 (fred)
**          Created.
[@history_template@]...
*/
DB_STATUS
adu_lolk(
ADF_CB             *adf_scb,
DB_DATA_VALUE      *cpn_dv,
DB_DATA_VALUE      *res_dv)
{
    DB_DT_ID		dtid = abs(cpn_dv->db_datatype);
    ADP_PERIPHERAL	*p = (ADP_PERIPHERAL *) cpn_dv->db_data;
    ADP_PERIPHERAL	peripheral;
    
    if ((Adf_globs->Adi_dtptrs[dtid]->adi_dtstat_bits & AD_PERIPHERAL) == 0)
    {
	MEfill(res_dv->db_length, '\377', res_dv->db_data);
    }
    else
    {
	MEfill(res_dv->db_length, '\0', res_dv->db_data);
    }
    
    return(E_DB_OK);
}
Пример #30
0
void
jdbc_gca_term( void )
{
    GCA_PARMLIST	parms;
    STATUS		status;

    MEfill( sizeof(parms), 0, (PTR) &parms);
    IIGCa_cb_call( &gca_cb, GCA_TERMINATE, 
		   &parms, GCA_SYNC_FLAG, NULL, -1, &status );
			
    return;
}