Ejemplo n.º 1
0
DB_STATUS
qel_c4_ldbid_short(
bool		    i_alias_b,
QEF_RCB		    *v_qer_p,
QEC_LINK	    *v_lnk_p )
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    DD_LDB_DESC	    *cdb_p = & dds_p->qes_d4_ddb_p->
			dd_d3_cdb_info.dd_i1_ldb_desc,
		    *ldb_p = v_lnk_p->qec_19_ldb_p;

    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p;
    QEC_D2_LDBIDS
		    *ldbids_p = v_lnk_p->qec_7_ldbids_p;


    /* 1.  must initialize ldb_id to unknown */

    ldbids_p->d2_5_ldb_id = 0;

    /* 2.  set up for accessing IIDD_DDB_LDBIDS */

    sel_p->qeq_c3_ptr_u.d2_ldbids_p = ldbids_p; 
    sel_p->qeq_c4_ldb_p = cdb_p;
    sel_p->qeq_c5_eod_b = FALSE;
    sel_p->qeq_c6_col_cnt = 0;

    qed_u0_trimtail( ldb_p->dd_l2_node_name, (u_i4) DB_NODE_MAXNAME,
		ldbids_p->d2_1_ldb_node);
    qed_u0_trimtail( ldb_p->dd_l4_dbms_name, (u_i4) DB_TYPE_MAXLEN,
		ldbids_p->d2_2_ldb_dbms);

    if (i_alias_b)
	qed_u0_trimtail( v_lnk_p->qec_5_ldb_alias, (u_i4) DB_DB_MAXNAME,
		ldbids_p->d2_3_ldb_database);
					    /* use alias as database name */
    else
	qed_u0_trimtail(
		ldb_p->dd_l3_ldb_name,
		(u_i4) DD_256_MAXDBNAME,
		ldbids_p->d2_3_ldb_database);

    /* 4.  send SELECT query to retrieve ldb id if it exists */

    sel_p->qeq_c1_can_id = SEL_005_DD_DDB_LDBIDS_BY_NAME;

    status = qel_s4_prepare(v_qer_p, v_lnk_p);
    if (status) 
	return(status);

    if (! sel_p->qeq_c5_eod_b)
	status = qel_s3_flush(v_qer_p, v_lnk_p);

    return(status);
}
Ejemplo n.º 2
0
DB_STATUS
qel_c5_ldbid_long(
QEF_RCB		    *v_qer_p,
QEC_LINK	    *v_lnk_p )
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    DD_LDB_DESC	    *cdb_p = & dds_p->qes_d4_ddb_p->
			dd_d3_cdb_info.dd_i1_ldb_desc,
		    *ldb_p = v_lnk_p->qec_19_ldb_p;

    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p;
    QEC_D5_LONG_LDBNAMES
		    *long_p = v_lnk_p->qec_8_longnames_p;


    /* 1.  set up for accessing IIDD_DDB_LDB_LONGNAMES */

    sel_p->qeq_c3_ptr_u.d5_long_ldbnames_p = long_p; 
    sel_p->qeq_c4_ldb_p = cdb_p;
    sel_p->qeq_c5_eod_b = FALSE;
    sel_p->qeq_c6_col_cnt = 0;

    qed_u0_trimtail(
	ldb_p->dd_l3_ldb_name,
	(u_i4) DD_256_MAXDBNAME,
	long_p->d5_1_ldb_name);

    /* 3.  retrieve the LDB's 32-char alias if it exists */

    sel_p->qeq_c1_can_id = SEL_014_DD_DDB_LONG_LDBNAMES;

    status = qel_s4_prepare(v_qer_p, v_lnk_p);
    if (status)
	return(status);

    if (! sel_p->qeq_c5_eod_b)	    
    {
	/* no data */
    
	status = qel_s3_flush(v_qer_p, v_lnk_p);
	if (status) 
	    return(status);

	/* generate alias */

	STcopy(IIQE_30_alias_prefix, v_lnk_p->qec_5_ldb_alias);   /* prefix */
	CVla(v_lnk_p->qec_2_tableinfo_p->d9_1_obj_id.db_tab_base,
	     &v_lnk_p->qec_5_ldb_alias[QEK_5_SIZE_OF_PREFIX]);

	return(E_DB_OK);
    }

    /* 4.  send SELECT query to retrieve ldb id if it exists */

    status = qel_c4_ldbid_short(TRUE, v_qer_p, v_lnk_p);
						/* TRUE for using alias */
    return(status);
}
Ejemplo n.º 3
0
DB_STATUS
qee_p1_dsh_gen(
	QEF_RCB		*v_qer_p,
	QEE_DSH		*i_dsh_p)
{
    DB_STATUS	    status = E_DB_OK;
    QEF_QP_CB	    *qp_p = i_dsh_p->dsh_qp_ptr;    /* debugging aid */
    QEE_DDB_CB	    *dde_p = i_dsh_p->dsh_ddb_cb;
    char	    cur_name[DB_CURSOR_MAXNAME + 1];
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    qed_u0_trimtail(i_dsh_p->dsh_qp_id.db_cur_name, DB_CURSOR_MAXNAME, cur_name);

    STprintf(cbuf, 
	"%s %p: ...    query id: %x %x %s\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	i_dsh_p->dsh_qp_id.db_cursor_id[0],
	i_dsh_p->dsh_qp_id.db_cursor_id[1],
	cur_name);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    if (i_dsh_p->dsh_qp_status & DSH_QP_LOCKED)
    {
 	STprintf(cbuf, 
	    "%s %p: ...     query plan LOCKED by this session\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_qp_status & DSH_QP_OBSOLETE)
    {
	STprintf(cbuf, 
	    "%s %p: ...     query plan is OBSOLETE; to be destroyed\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_qp_status & DSH_DEFERRED_CURSOR)
    {
	STprintf(cbuf, 
	    "%s %p: ...     query plan contains a DEFERRED cursor\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_positioned)
    {
	STprintf(cbuf, 
	    "%s %p: ...     cursor is positioned\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    return(E_DB_OK);
}
Ejemplo n.º 4
0
DB_STATUS
qel_c7_ldb_chrs(
QEF_RCB		    *v_qer_p,
QEC_LINK	    *v_lnk_p )
{
    DB_STATUS	    status;
    DD_LDB_DESC	    *ldb_p = v_lnk_p->qec_19_ldb_p;
    QEC_D2_LDBIDS   *ldbids_p = v_lnk_p->qec_7_ldbids_p;
    QEC_L1_DBCONSTANTS
		    dbconsts;	    /* tuple structure */
    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p;


    /* 1.  set up to retrieve from IIDBCONSTANTS */

    sel_p->qeq_c1_can_id = SEL_105_II_DBCONSTANTS;
    sel_p->qeq_c2_rqf_bind_p = v_lnk_p->qec_20_rqf_bind_p;
    sel_p->qeq_c3_ptr_u.l1_dbconstants_p = & dbconsts; 
    sel_p->qeq_c4_ldb_p = ldb_p;
    sel_p->qeq_c5_eod_b = FALSE;
    sel_p->qeq_c6_col_cnt = 0;

    /* 2.  retrieve data */

    status = qel_s4_prepare(v_qer_p, v_lnk_p);
    if (status)
	return(status);

    if (! sel_p->qeq_c5_eod_b)
    {	
	status = qel_s3_flush(v_qer_p, v_lnk_p);
	if (status)
	    return(status);
    }

    if (dbconsts.l1_1_usr_name[0] == '$')
	ldbids_p->d2_6_ldb_user[0] = 'N';	/* no user name */
    else
	ldbids_p->d2_6_ldb_user[0] = 'Y'; 
    ldbids_p->d2_6_ldb_user[1] = EOS;		/* null terminate */

    if (dbconsts.l1_2_dba_name[0] == '$')   
    {
	ldbids_p->d2_7_ldb_dba[0] = 'N';	/* no DBA name */
	ldbids_p->d2_8_ldb_dbaname[0] = EOS;	/* set to null string */
    }
    else
    {
	ldbids_p->d2_7_ldb_dba[0] = 'Y'; 
	qed_u0_trimtail( dbconsts.l1_2_dba_name, (u_i4) DB_OWN_MAXNAME,
		ldbids_p->d2_8_ldb_dbaname);
    }
    ldbids_p->d2_7_ldb_dba[1] = EOS;	/* null terminate */

    return(E_DB_OK);
}
Ejemplo n.º 5
0
DB_STATUS
qee_p4_ldb_qid(
	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;
    QEF_DDB_REQ     *ddr_p = & v_qer_p->qef_r3_ddb_req;
*/
    QEE_DDB_CB      *qee_p = i_dsh_p->dsh_ddb_cb;
    DB_CURSOR_ID    *ldb_qid_p = & qee_p->qee_d5_local_qid;
    char	    cur_name[DB_CURSOR_MAXNAME + 1];
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    STprintf(cbuf, 
	"%s %p: ...the LDB query id:\n",
        IIQE_61_qefsess,
        (PTR) v_qer_p->qef_cb);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    STprintf(cbuf, 
	"%s %p: ...   1) DB_CURSOR_ID[0] %x,\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	ldb_qid_p->db_cursor_id[0]);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    STprintf(cbuf, 
	"%s %p: ...   2) DB_CURSOR_ID[1] %x,\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	ldb_qid_p->db_cursor_id[1]);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    qed_u0_trimtail(ldb_qid_p->db_cur_name, DB_CURSOR_MAXNAME, cur_name);

    STprintf(cbuf, 
	"%s %p: ...   3) DB_CUR_NAME     %s\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	cur_name);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    return(E_DB_OK);
}
Ejemplo n.º 6
0
DB_STATUS
qee_p2_dsh_ddb(
	QEF_RCB		*v_qer_p,
	QEE_DSH		*i_dsh_p)
{
    DB_STATUS	    status = E_DB_OK;
    QEF_CB	    *qecb_p = v_qer_p->qef_cb;
    QEF_QP_CB	    *qp_p = i_dsh_p->dsh_qp_ptr;    /* debugging aid */
    QEQ_DDQ_CB	    *ddq_p = & qp_p->qp_ddq_cb;
    QEE_DDB_CB	    *dde_p = i_dsh_p->dsh_ddb_cb;
    DD_TAB_NAME	    *tmptbl_p = (DD_TAB_NAME *) NULL;
    i4	    *sts_p = (i4 *) NULL;
    i4		    i;
    char	    namebuf[DB_TAB_MAXNAME + 1];
    char	    cur_name[DB_CURSOR_MAXNAME + 1];
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    if (! (qecb_p->qef_c1_distrib & DB_3_DDB_SESS) )
	return(E_DB_OK);    /* NOT a DDB session */

    if (ddq_p->qeq_d3_elt_cnt == 0)
    {
	STprintf(cbuf, 
	    "%s %p: ...     0 temporary tables used by query\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    else
    {
	if (ddq_p->qeq_d3_elt_cnt == 1)
	{
	    STprintf(cbuf, 
		"%s %p: ...     1 temporary table ",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}
	else
	{
	    STprintf(cbuf, 
		"%s %p: ...     %d temporary tables ",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb,
		ddq_p->qeq_d3_elt_cnt);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}
	STprintf(cbuf, "used by query\n");
        qec_tprintf(v_qer_p, cbufsize, cbuf);

	/* print all the temporary table names */

	for (i = 1, tmptbl_p = dde_p->qee_d1_tmp_p,
		    sts_p = dde_p->qee_d2_sts_p;
		i <= ddq_p->qeq_d3_elt_cnt; 
		i++, tmptbl_p++, sts_p++)
	    if (*sts_p & QEE_01M_CREATED)
	    {
		qed_u0_trimtail((char *) tmptbl_p, DB_TAB_MAXNAME, namebuf);
		STprintf(cbuf, 
		    "%s %p: ...     %d) %s\n",
		    IIQE_61_qefsess,
		    (PTR) v_qer_p->qef_cb,
		    i,
		    namebuf);
        	qec_tprintf(v_qer_p, cbufsize, cbuf);
	    }
    }

    if (dde_p->qee_d3_status & QEE_01Q_CSR)
    {
        STprintf(cbuf, 
	    "%s %p: ...     query pertains to a CURSOR\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_02Q_RPT)
    {
        STprintf(cbuf, 
	    "%s %p: ...     this is a REPEAT query\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_03Q_DEF)
    {
        STprintf(cbuf, 
	    "%s %p: ...     query has been DEFINED to the LDB\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_04Q_EOD)
    {
	STprintf(cbuf, 
	    "%s %p: ...     query has NO more retrieved data coming back\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_05Q_CDB)
    {
        STprintf(cbuf, 
"%s %p: ...     retrieval REROUTED thru the CDB, to be committed when done\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_06Q_TDS)
    {
        STprintf(cbuf, 
	    "%s %p: ...     RQF returning a tuple descriptor to SCF\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_07Q_ATT)
    {
        STprintf(cbuf, 
	    "%s %p: ...     tuple descriptor contains attribute names\n",
	    IIQE_61_qefsess,
            (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d4_given_qid.db_cursor_id[0] != 0)
    {
	/* null-terminate name part for printing */

	qed_u0_trimtail( dde_p->qee_d4_given_qid.db_cur_name, DB_CURSOR_MAXNAME,
	    cur_name);

	STprintf(cbuf, 
	    "%s %p: ...     DDB query id: %x %x %s\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb,
	    dde_p->qee_d4_given_qid.db_cursor_id[0],
	    dde_p->qee_d4_given_qid.db_cursor_id[1],
	    cur_name);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }

    if (dde_p->qee_d5_local_qid.db_cursor_id[0] != 0)
    {
	/* null-terminate name part for printing */

	qed_u0_trimtail( dde_p->qee_d5_local_qid.db_cur_name, DB_CURSOR_MAXNAME,
	    cur_name);

	STprintf(cbuf, 
	    "%s %p: ...     LDB (sub)query id: %x %x %s\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb,
	    dde_p->qee_d5_local_qid.db_cursor_id[0],
	    dde_p->qee_d5_local_qid.db_cursor_id[1],
	    cur_name);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }

    if (dde_p->qee_d6_dynamic_cnt > 0)
    {
	if (dde_p->qee_d6_dynamic_cnt == 1)
	{
	    STprintf(cbuf, 
		"%s %p: ...     1 DB_DATA_VALUE ",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}
	else
	{
	    STprintf(cbuf, 
		"%s %p: ...     %d DB_DATA_VALUEs ",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb,
		dde_p->qee_d6_dynamic_cnt);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}
	STprintf(cbuf, "for query\n");
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (dde_p->qee_d3_status & QEE_01Q_CSR
	||
	dde_p->qee_d3_status & QEE_02Q_RPT)
    {
	if (dde_p->qee_d3_status & QEE_01Q_CSR)
	{
	    STprintf(cbuf, 
		"%s %p: ...     LDB for this CURSOR query:\n",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}
	else
	{
	    STprintf(cbuf, 
		"%s %p: ...     LDB for this REPEAT query:\n",
		IIQE_61_qefsess,
		(PTR) v_qer_p->qef_cb);
            qec_tprintf(v_qer_p, cbufsize, cbuf);
	}

	/* print the LDB's information */

	status = qed_w1_prt_ldbdesc(v_qer_p, & dde_p->qee_d11_ldbdesc);
    }

    return(E_DB_OK);
}
Ejemplo n.º 7
0
DB_STATUS
qel_c0_cre_lnk(
QEF_RCB		*v_qer_p ) 
{
    DB_STATUS		status;
    QEF_CB		*qef_cb = v_qer_p->qef_cb;
    QES_DDB_SES		*dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO	*ddl_p = & v_qer_p->qef_r3_ddb_req.qer_d7_ddl_info;
    DD_0LDB_PLUS	*plus_p = & ddl_p->qed_d6_tab_info_p->
			    dd_t9_ldb_p->dd_i2_ldb_plus;
    DD_CAPS		*caps_p = & plus_p->dd_p3_ldb_caps;
    DD_LDB_DESC		ldb,		    /* for replicating LDB desc */
			*ldb_p = & ldb,
			*cdb_p = & dds_p->qes_d4_ddb_p->
			    dd_d3_cdb_info.dd_i1_ldb_desc,
			*ddl_ldb_p = & ddl_p->qed_d6_tab_info_p->
			    dd_t9_ldb_p->dd_i1_ldb_desc;
    QEC_D9_TABLEINFO	tabinfo;	    /* used for table info of link */
    QEC_D2_LDBIDS	ldbids;		    /* used for internal LDB id info */
    QEC_D5_LONG_LDBNAMES
			longnames;	    /* used for excessively long LDB
					    ** name */
    QEC_L16_TABLES	tables;		    /* used for IITABLES-style info */
    QEC_D6_OBJECTS	objects;	    /* used for object info */
    QEC_L6_INDEXES	indexes;
    QEC_MIN_CAP_LVLS	pre_mins,
			aft_mins;
    QEC_LINK		link,		    /* used as global control block */
			*link_p = & link;
    QEQ_1CAN_QRY	del,
			ins,
			sel,
			upd,		    /* used for ordering canned query */
			*upd_p = & upd;
    u_i4		len;
    SYSTIME		now;
    bool		log_ddl_56 = FALSE,
			log_err_59 = FALSE;
    i4		i4_1,
			i4_2;
    QEC_INDEX_ID	ndx_ids[QEK_0MAX_NDX_COUNT + 1];
					    /* working space for index ids */
    RQB_BIND		rq_bind[QEC_CAT_COL_COUNT_MAX + 1];
    QEC_D7_OBJECT_BASE	obj_base,
			*base_p = & obj_base;
    i4			xact_mode;
    char		*cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4			cbufsize = v_qer_p->qef_cb->qef_trsize;

    
    if (ult_check_macro(& qef_cb->qef_trace, QEF_TRACE_DDB_LOG_DDL_56,
	    & i4_1, & i4_2))
    {
        log_ddl_56 = TRUE;
    }
    
    if (ult_check_macro(& qef_cb->qef_trace, QEF_TRACE_DDB_LOG_ERR_59,
	    & i4_1, & i4_2))
    {
        log_err_59 = TRUE;
    }
    sel.qeq_c2_rqf_bind_p = rq_bind;		/* must set up */
    del.qeq_c2_rqf_bind_p = (RQB_BIND *) NULL;
    ins.qeq_c2_rqf_bind_p = (RQB_BIND *) NULL;
    upd.qeq_c2_rqf_bind_p = (RQB_BIND *) NULL;

    /* 1.  set up control block */

    if (dds_p->qes_d7_ses_state == QES_4ST_REFRESH)	
						/* REGISTER WITH REFRESH ? */
	STRUCT_ASSIGN_MACRO(ddl_p->qed_d7_obj_id, tabinfo.d9_1_obj_id);
						/* yes */
    else					/* no */
    {
	tabinfo.d9_1_obj_id.db_tab_base = 0;	/* unknown */
	tabinfo.d9_1_obj_id.db_tab_index = 0;	/* always 0 for non-index */
    }
    link_p->qec_1_ddl_info_p = ddl_p;
    link_p->qec_2_tableinfo_p = & tabinfo;
    link_p->qec_3_ldb_id = 0;			
    link_p->qec_4_col_cnt = 0;
    MEfill(DB_DB_MAXNAME, ' ', link_p->qec_5_ldb_alias);
    link_p->qec_6_select_p = & sel;
    link_p->qec_7_ldbids_p = & ldbids;
    link_p->qec_8_longnames_p = & longnames;
    link_p->qec_9_tables_p = & tables;
    link_p->qec_10_haves = QEC_07_CREATE;
    if (caps_p->dd_c6_name_case == DD_2CASE_UPPER)
	link_p->qec_10_haves |= QEC_06_UPPER_LDB;
    if (caps_p->dd_c1_ldb_caps & DD_7CAP_USE_PHYSICAL_SOURCE)
	link_p->qec_10_haves |= QEC_10_USE_PHY_SRC;
    if (caps_p->dd_c2_ldb_caps & DD_201CAP_DIFF_ARCH)
	link_p->qec_10_haves |= QEC_11_LDB_DIFF_ARCH;

    /* make a copy of the LDB descriptor for non-$ingrs access if necessary */

    if (ddl_ldb_p->dd_l1_ingres_b)
    {
	/* make a copy for non-$ingres access */

	STRUCT_ASSIGN_MACRO(*ddl_ldb_p, ldb);
	ldb_p->dd_l1_ingres_b = FALSE;
	ldb_p->dd_l5_ldb_id = DD_0_IS_UNASSIGNED;
    }
    else
    {	
	/* use provided LDB descriptor but determine if LDB has a long name */

	qed_u0_trimtail(
		ddl_ldb_p->dd_l3_ldb_name, 
		(u_i4) DD_256_MAXDBNAME,
		ldb_p->dd_l3_ldb_name);

	len = STlength(ldb_p->dd_l3_ldb_name);
	if (len > DB_DB_MAXNAME)
	    link_p->qec_10_haves |= QEC_04_LONG_LDBNAME;

	ldb_p = ddl_ldb_p;
    }
    link_p->qec_11_ldb_obj_cnt = 0;
    link_p->qec_12_indexes_p = & indexes;
    link_p->qec_13_objects_p = & objects;
    link_p->qec_15_ndx_cnt = 0;
    link_p->qec_16_ndx_ids_p = ndx_ids;
    link_p->qec_19_ldb_p = ldb_p;
    link_p->qec_20_rqf_bind_p = rq_bind;
    link_p->qec_21_delete_p = & del;
    link_p->qec_22_insert_p = & ins;
    link_p->qec_23_update_p = & upd;

    status = qed_u8_gmt_now(v_qer_p, link_p->qec_24_cur_time);
    if (status)
	return(status);

    link_p->qec_24_cur_time[DD_25_DATE_SIZE] = EOS;
    link_p->qec_25_pre_mins_p = & pre_mins;
    link_p->qec_26_aft_mins_p = & aft_mins;
    link_p->qec_27_select_cnt = 0;
    link_p->qec_28_iistats_cnt = 0;
    
    TMnow(& now);
    link_p->qec_17_ts1 = now.TM_secs;
    link_p->qec_18_ts2 = now.TM_msecs;
    
    /* 2.  inform TPF of update intention on CDB (note that only CREATE does
    **	   LDB retrievals */

    /* 2.1 2PC is required if DDL concurrency is off. */
    if (dds_p->qes_d9_ctl_info & QES_01CTL_DDL_CONCURRENCY_ON)
	xact_mode = QEK_4TPF_1PC;
    else
	xact_mode = QEK_3TPF_UPDATE;

    status = qet_t5_register(v_qer_p, cdb_p, DB_SQL, xact_mode);
    if (status)
	return(status);

    if (log_ddl_56)
    {
	/* display beginning, CDB and LDB info */

	STprintf(cbuf, "\n%s %p: %s REGISTRATION begins%s\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb,
	    IIQE_65_tracing,
	    IIQE_62_3dots);
        qec_tprintf(v_qer_p, cbufsize, cbuf);

	STprintf(cbuf, 
	    "%s %p: ...the CDB:\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
	qed_w1_prt_ldbdesc(v_qer_p, cdb_p);

	STprintf(cbuf, 
	    "%s %p: ...the LDB:\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
	qed_w1_prt_ldbdesc(v_qer_p, ldb_p);

	STprintf(cbuf, "\n");
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    /* 3.  update OBJECT_BASE in II_DD_DB_OBJECT_BASE */

    upd_p->qeq_c1_can_id = UPD_716_DD_DDB_OBJECT_BASE;
    upd_p->qeq_c3_ptr_u.d7_object_base_p = base_p;
    upd_p->qeq_c4_ldb_p = cdb_p;

    status = qel_u1_update(v_qer_p, link_p);
    if (status)
	goto END_TRACING;

    /* 4.  enter phase 1: set up necessary information */

    status = qel_c1_cre_p1(v_qer_p, link_p);
    if (status)
	goto END_TRACING;

    /* 2.  enter phase 2: promote information into STAR catalogs */

    status = qel_c2_cre_p2(v_qer_p, link_p);
    if (status)
	v_qer_p->qef_cb->qef_abort = TRUE;

END_TRACING:

    if (log_ddl_56)
    {
	/* display end tracing message */

	STprintf(cbuf, 
	    "%s %p: %s REGISTRATION ends\n\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb,
	    IIQE_65_tracing);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }

    return(status);
}    
Ejemplo n.º 8
0
DB_STATUS
qeu_15_views(
QEF_RCB		*i_qer_p,
QEUQ_CB		*i_quq_p,
QEC_LINK	*v_lnk_p)
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QEUQ_DDB_CB	    *ddu_p = & i_quq_p->qeuq_ddb_cb;
    QEF_DATA	    *data_p = i_quq_p->qeuq_qry_tup;
    QEC_L17_VIEWS   views,
		    *views_p = & views;
    QEQ_1CAN_QRY    *ins_p = v_lnk_p->qec_22_insert_p;
    i4		    seq;


    /* 1.  set up constant values for all entries */

    qed_u0_trimtail( ddl_p->qed_d1_obj_name, DB_OBJ_MAXNAME,
	views_p->l17_1_tab_name);

    qed_u0_trimtail( ddl_p->qed_d2_obj_owner, DB_OWN_MAXNAME,
	views_p->l17_2_tab_owner);

    if (ddu_p->qeu_1_lang == DB_SQL)
	views_p->l17_3_dml[0] = 'S';
    else if (ddu_p->qeu_1_lang == DB_QUEL)
	views_p->l17_3_dml[0] = 'Q';
    else
    {
	status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB,
			& i_qer_p->error);
	return(status);
    }
    views_p->l17_3_dml[1] = EOS;

    if (ddu_p->qeu_2_view_chk_b)
	views_p->l17_4_chk_option[0] = 'Y';
    else
	views_p->l17_4_chk_option[0] = 'N';
    views_p->l17_4_chk_option[1] = EOS;

    for (seq = 0; seq < i_quq_p->qeuq_cq; seq++)
    {
	/* 2.  fill in specific information for current entry */

	views_p->l17_5_sequence = seq + 1;

	if (data_p->dt_size > QEK_256_VIEW_SIZE)
	{
	    status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB,
			& i_qer_p->error);
	    return(status);
	}
	else
	{
	    MEcopy((char *) data_p->dt_data, data_p->dt_size,
		views_p->l17_6_txt_seg);
	    views_p->l17_6_txt_seg[data_p->dt_size] = EOS;
	    views_p->l17_7_txt_size = data_p->dt_size;
	}

	data_p = data_p->dt_next;		/* advance to next item */

	/* 3.  insert into IIDD_VIEWS */

	ins_p->qeq_c1_can_id = INS_632_DD_VIEWS;
	ins_p->qeq_c3_ptr_u.l17_views_p = views_p;
	ins_p->qeq_c4_ldb_p = cdb_p;
	status = qel_i1_insert(i_qer_p, v_lnk_p);
	if (status)
	    return(status);
    } 

    return(E_DB_OK);
}    
Ejemplo n.º 9
0
DB_STATUS
qeu_d5_alt_tab(
QEF_RCB		*v_qer_p,
DMT_CB		*i_dmt_p)
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QEC_D9_TABLEINFO	
		    tabinfo;			/* dummy part of link */
    QEC_D6_OBJECTS  objects,
		    *objs_p = & objects;
    QEC_L16_TABLES  tables,
		    *tabs_p = & tables;
    QEQ_1CAN_QRY    upd,
		    *upd_p = & upd;
    QEC_LINK	    link,
		    *lnk_p = & link; 
    DMT_CHAR_ENTRY  *chr_p;
    bool	    err_b = FALSE;		/* assume no error */
    i4		    xact_mode;


    MEfill(sizeof(link), '\0', (PTR) & link);
    lnk_p->qec_2_tableinfo_p = & tabinfo;
    lnk_p->qec_13_objects_p = objs_p;

    /* 1.  vefify input parameters */

    chr_p = (DMT_CHAR_ENTRY *) i_dmt_p->dmt_char_array.data_address;

    if (chr_p->char_id != DMT_C_ZOPTSTATS)
	err_b = TRUE;
    else 
    {
	if (chr_p->char_value == DMT_C_ON)
	{
	    tabs_p->l16_9_stats[0] = 'Y';
	    tabs_p->l16_9_stats[1] = EOS;
	}
	else if (chr_p->char_value == DMT_C_OFF)
	{
	    tabs_p->l16_9_stats[0] = 'N';
	    tabs_p->l16_9_stats[1] = EOS;
	}
	else
	    err_b = TRUE;
    }
    if (err_b)
    {
	status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB, & v_qer_p->error);
	return(status);
    }

    /* 2.  inform TPF of update */

    /* 2.1 2PC is required if DDL concurrency is off. */
    if (dds_p->qes_d9_ctl_info & QES_01CTL_DDL_CONCURRENCY_ON)
	xact_mode = QEK_4TPF_1PC;
    else
	xact_mode = QEK_3TPF_UPDATE;

    status = qet_t5_register(v_qer_p, cdb_p, DB_SQL, xact_mode);
    if (status)
	return(status);

    /* 3.  set up to update TABLE_STATS and MODIFY_DATE of IIDD_TABLES */

    qed_u0_trimtail( (char *) & i_dmt_p->dmt_table, DB_TAB_MAXNAME,
	tabs_p->l16_1_tab_name);

    qed_u0_trimtail( (char *) & i_dmt_p->dmt_owner, DB_OWN_MAXNAME,
	tabs_p->l16_2_tab_owner);

    status = qed_u8_gmt_now(v_qer_p, tabs_p->l16_21_mod_date);
    if (status)
	return(status);

    tabs_p->l16_21_mod_date[DD_25_DATE_SIZE] = EOS;

    upd_p->qeq_c1_can_id = UPD_731_DD_TABLES;
    upd_p->qeq_c2_rqf_bind_p = NULL;
    upd_p->qeq_c3_ptr_u.l16_tables_p = tabs_p;
    upd_p->qeq_c4_ldb_p = cdb_p;

    lnk_p->qec_23_update_p = upd_p;
    status = qel_u1_update(v_qer_p, lnk_p);    
    if (status)
    {
	return(status);
    }

    return(E_DB_OK);
}    
Ejemplo n.º 10
0
DB_STATUS
qeu_13_tables(
QEF_RCB		*i_qer_p,
QEUQ_CB		*i_quq_p,
QEC_LINK	*v_lnk_p)
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QEC_D6_OBJECTS  *objects_p = v_lnk_p->qec_13_objects_p;
    QEC_L16_TABLES  *tables_p = v_lnk_p->qec_9_tables_p;
    QEQ_1CAN_QRY    *ins_p = v_lnk_p->qec_22_insert_p;
						/* working structure */


    /* 1.  set up tuple for insertion */

    qed_u0_trimtail( ddl_p->qed_d1_obj_name, DB_OBJ_MAXNAME,
		tables_p->l16_1_tab_name);

    qed_u0_trimtail( ddl_p->qed_d2_obj_owner, DB_OWN_MAXNAME, 
		tables_p->l16_2_tab_owner);

    STcopy(v_lnk_p->qec_24_cur_time, tables_p->l16_3_cre_date);
    STcopy(v_lnk_p->qec_24_cur_time, tables_p->l16_4_alt_date);

    tables_p->l16_5_tab_type[0] = 'V';
    tables_p->l16_5_tab_type[1] = EOS;		/* null terminate */

    tables_p->l16_6_sub_type[0] = 'N';		/* native */
    tables_p->l16_6_sub_type[1] = EOS;		/* null terminate */

    STcopy(IIQE_42_ing_60, tables_p->l16_7_version);

    if (dds_p->qes_d9_ctl_info & QES_05CTL_SYSCAT_USER)
    {
	if (ddl_p->qed_d1_obj_name[0] == 'i'
	    &&
	    ddl_p->qed_d1_obj_name[1] == 'i')
	{
	    tables_p->l16_8_sys_use[0] = 'S';	/* system object */

	}
	else
	    tables_p->l16_8_sys_use[0] = 'U';	/* user object */
    }
    else
	tables_p->l16_8_sys_use[0] = 'U';	/* user object */
    tables_p->l16_8_sys_use[1] = EOS;		/* null terminate */

    tables_p->l16_9_stats[0] = 'N';		/* no statistics for view */
    tables_p->l16_9_stats[1] = EOS;		/* null terminate */

    tables_p->l16_10_indexes[0] = 'N';		/* no indexes for view */
    tables_p->l16_10_indexes[1] = EOS;		/* null terminate */

    tables_p->l16_11_readonly[0] = 'N';		/* may be updateable */
    tables_p->l16_11_readonly[1] = EOS;		/* null terminate */

    tables_p->l16_12_num_rows = 0;		/* unknown */

    STcopy(IIQE_43_heap, tables_p->l16_13_storage);
						/* view structure is HEAP */
    tables_p->l16_14_compressed[0] = 'N';	/* not compressed */
    tables_p->l16_14_compressed[1] = EOS;	/* null terminate */

    tables_p->l16_15_dup_rows[0] = 'U';		/* unknown */
    tables_p->l16_15_dup_rows[1] = EOS;		/* null terminate */

    tables_p->l16_16_uniquerule[0] = 'D';	/* duplicate */
    tables_p->l16_16_uniquerule[1] = EOS;	/* null terminate */

    tables_p->l16_17_num_pages = 1;		/* assume */
    tables_p->l16_18_overflow = 0;		/* assume */
    tables_p->l16_19_row_width = i_quq_p->qeuq_ddb_cb.qeu_3_row_width;
    tables_p->l16_20_tab_expire = 0;		/* no expiration date */
    tables_p->l16_21_mod_date[0] = EOS;		/* none */
    tables_p->l16_22_loc_name[0] = EOS;		/* none */

    tables_p->l16_23_integrities[0] = 'N';
    tables_p->l16_23_integrities[1] = EOS;

    tables_p->l16_24_permits[0] = 'N';
    tables_p->l16_24_permits[1] = EOS;

    tables_p->l16_25_all_to_all[0] = 'Y';
    tables_p->l16_25_all_to_all[1] = EOS;

    tables_p->l16_26_ret_to_all[0] = 'Y';
    tables_p->l16_26_ret_to_all[1] = EOS;

    tables_p->l16_27_journalled[0] = 'N';
    tables_p->l16_27_journalled[1] = EOS;

    tables_p->l16_28_view_base[0] = 'N';
    tables_p->l16_28_view_base[1] = EOS;

    tables_p->l16_29_multi_loc[0] = EOS;	/* none */
    tables_p->l16_30_ifillpct = 0;
    tables_p->l16_31_dfillpct = 100;
    tables_p->l16_32_lfillpct = 0;
    tables_p->l16_33_minpages = 1;
    tables_p->l16_34_maxpages = 1;
    tables_p->l16_35_rel_st1 = v_lnk_p->qec_17_ts1;
    tables_p->l16_36_rel_st2 = v_lnk_p->qec_18_ts2;
    tables_p->l16_37_reltid = objects_p->d6_3_obj_id.db_tab_base;
    tables_p->l16_38_reltidx = objects_p->d6_3_obj_id.db_tab_index; 
    tables_p->l16_39_pagesize = 0; 	/* unknown */


    /* 2.  insert into IIDD_TABLES */

    ins_p->qeq_c1_can_id = INS_631_DD_TABLES;	
    ins_p->qeq_c3_ptr_u.l16_tables_p = tables_p;	
    ins_p->qeq_c4_ldb_p = cdb_p;
    status = qel_i1_insert(i_qer_p, v_lnk_p);

    return(status);
}    
Ejemplo n.º 11
0
DB_STATUS
qeu_14_columns(
QEF_RCB		*i_qer_p,
QEUQ_CB		*i_quq_p,
QEC_LINK	*v_lnk_p)
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QEC_L3_COLUMNS  dd_columns,
		    *columns_p = & dd_columns;	/* tuple struct */
    QEQ_1CAN_QRY    *ins_p = v_lnk_p->qec_22_insert_p;
    QEP_PTR_UNION   ptr_u;
    DMU_CB	    *dmu_p;
    DMF_ATTR_ENTRY  **col_pp,
		    *curcol_p;
    i4		    colnum,
		    coltype,
		    postype;
    QEC_LONGNAT_TO_I4  
		    coerce;
    ADI_DT_NAME	    adi_dname;


    ptr_u.qep_ptr_u.qep_1_ptr = i_quq_p->qeuq_dmf_cb;
    dmu_p = ptr_u.qep_ptr_u.qep_3_dmu_cb_p;

    ptr_u.qep_ptr_u.qep_1_ptr = dmu_p->dmu_attr_array.ptr_address;
    col_pp = ptr_u.qep_ptr_u.qep_4_dmu_attr_pp;

    /* 1.  set up constant values for all columns */

    qed_u0_trimtail( ddl_p->qed_d1_obj_name, DB_OBJ_MAXNAME,
	columns_p->l3_1_tab_name);

    qed_u0_trimtail( ddl_p->qed_d2_obj_owner, DB_OWN_MAXNAME,
	columns_p->l3_2_tab_owner);

    columns_p->l3_10_seq_in_key = 0;

    for (colnum = 0; colnum < i_quq_p->qeuq_ano; colnum++, col_pp++)
    {
	curcol_p = *col_pp;

	/* 2.  fill in specific information for current column */

	qed_u0_trimtail( curcol_p->attr_name.db_att_name, DB_ATT_MAXNAME,
	    columns_p->l3_3_col_name);

	coerce.qec_i4_i4.qec_1_i4 = curcol_p->attr_type;
	coltype = coerce.qec_i4_i4.qec_2_i4;
	if (coltype < 0)
	{
	    columns_p->l3_7_nulls[0] = 'Y';
	    postype = -coltype;			    /* must make positive */
	}
	else
	{
	    columns_p->l3_7_nulls[0] = 'N';
	    postype = coltype;
	}
	columns_p->l3_7_nulls[1] = EOS;

        /* call adi_tyname to get data type name */
	status = adi_tyname(i_qer_p->qef_adf_cb, postype, &adi_dname);
	if (status == E_DB_OK) 
		STcopy(adi_dname.adi_dtname, columns_p->l3_4_data_type);
	else
	{
	    status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB,
			& i_qer_p->error);
	    return(status);
	}

	coerce.qec_i4_i4.qec_1_i4 = curcol_p->attr_size;
	columns_p->l3_5_length = coerce.qec_i4_i4.qec_2_i4;

	coerce.qec_i4_i4.qec_1_i4 = curcol_p->attr_precision;
	columns_p->l3_6_scale = coerce.qec_i4_i4.qec_2_i4;

	if (curcol_p->attr_flags_mask & DMU_F_NDEFAULT)
	    columns_p->l3_8_defaults[0] = 'N';
	else
	    columns_p->l3_8_defaults[0] = 'Y';
	columns_p->l3_8_defaults[1] = EOS;

	columns_p->l3_9_seq_in_row = colnum + 1;
	columns_p->l3_10_seq_in_key = 0;	/* none */

	columns_p->l3_11_sort_dir[0] = 'A';	/* assume ascending */
	columns_p->l3_11_sort_dir[1] = EOS;	/* null terminate */

	columns_p->l3_12_ing_datatype = coltype;

	/* 3.  insert into IIDD_COLUMNS */

	ins_p->qeq_c1_can_id = INS_602_DD_COLUMNS;
	ins_p->qeq_c3_ptr_u.l3_columns_p = columns_p;
	ins_p->qeq_c4_ldb_p = cdb_p;
	status = qel_i1_insert(i_qer_p, v_lnk_p);
	if (status)
	    return(status);
    } 

    return(E_DB_OK);
}    
Ejemplo n.º 12
0
DB_STATUS
qeu_12_objects(
QEF_RCB		*i_qer_p,
QEC_LINK	*v_lnk_p)
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QEC_D6_OBJECTS  *objects_p = v_lnk_p->qec_13_objects_p;
    QEQ_1CAN_QRY    *ins_p = v_lnk_p->qec_22_insert_p;
    u_i4	    l_obj, l_own, l_ing;


    /* 1.  set up insert information */

    l_obj = (u_i4)qed_u0_trimtail( ddl_p->qed_d1_obj_name, DB_OBJ_MAXNAME, 
	    objects_p->d6_1_obj_name);

    l_own = (u_i4)qed_u0_trimtail( ddl_p->qed_d2_obj_owner, DB_OWN_MAXNAME,
	    objects_p->d6_2_obj_owner);

    l_ing = STlength( IIQE_c0_usr_ingres );

    STcopy(
	v_lnk_p->qec_24_cur_time, 
	objects_p->d6_5_obj_cre);

    objects_p->d6_6_obj_type[0] = 'V';		/* view */
    objects_p->d6_6_obj_type[1] = EOS;

    STcopy(
	objects_p->d6_5_obj_cre,
	objects_p->d6_7_obj_alt);

    /*
    ** Assume that if object name begins with ii, and if owner is $ingres,
    ** then it is a system object.
    */

    if( ( l_obj >= 2 ) &&
        (MEcmp( objects_p->d6_1_obj_name, "ii", 2 ) == 0 ) &&
        ( l_own == l_ing ) &&
        (MEcmp( objects_p->d6_2_obj_owner, IIQE_c0_usr_ingres, l_ing ) == 0 ))
    {
        objects_p->d6_8_sys_obj[0] = 'Y';       /* system object */
    }
    else
    {
        objects_p->d6_8_sys_obj[0] = 'N';       /* not a system object */
    }

    objects_p->d6_8_sys_obj[1] = EOS;

    objects_p->d6_9_to_expire[0] = 'N';		/* no expiration date */
    objects_p->d6_9_to_expire[1] = EOS;

    objects_p->d6_10_exp_date[0] = EOS;		/* no expiration date */

    ins_p->qeq_c1_can_id = INS_615_DD_DDB_OBJECTS;
    ins_p->qeq_c3_ptr_u.d6_objects_p = objects_p;
    ins_p->qeq_c4_ldb_p = cdb_p;

    /* 2.  send INSERT query */

    status = qel_i1_insert(i_qer_p, v_lnk_p);
    return(status);
}    
Ejemplo n.º 13
0
DB_STATUS
qel_35_registrations(
QEF_RCB		*i_qer_p,
QEC_LINK	*v_lnk_p )
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    QED_QUERY_INFO  *qry_p;
    DD_2LDB_TAB_INFO
		    *tab_p = ddl_p->qed_d6_tab_info_p;
    QEC_L14_REGISTRATIONS
		    regs,
		    *regs_p = & regs;
    QEC_L18_PROCEDURES
		    procs,
		    *proc_p = & procs;
    QEQ_1CAN_QRY    *ins_p = v_lnk_p->qec_22_insert_p;
    DD_PACKET	    *pkt_p;
    i4		    seq;


    /* insert query text only for CREATE LINK | TABLE */

    if (ddl_p->qed_d9_reg_info_p == NULL)
	return(E_DB_OK);			/* no query text to insert */

    switch (ddl_p->qed_d8_obj_type)
    {
    case DD_1OBJ_LINK:
    case DD_2OBJ_TABLE:
    case DD_5OBJ_REG_PROC:
	break;
    default:
	return(E_DB_OK);			/* no query text to insert */
    }

    qry_p = ddl_p->qed_d9_reg_info_p;

    /* 1.  set up constant values for all entries */

    qed_u0_trimtail( ddl_p->qed_d1_obj_name, (u_i2) DB_OBJ_MAXNAME,
	regs_p->l14_1_obj_name);

    qed_u0_trimtail( ddl_p->qed_d2_obj_owner, (u_i2) DB_OWN_MAXNAME,
	regs_p->l14_2_obj_owner);

    if (qry_p->qed_q2_lang == DB_SQL)
	regs_p->l14_3_dml[0] = 'S';
    else if (qry_p->qed_q2_lang == DB_QUEL)
	regs_p->l14_3_dml[0] = 'Q';
    else
    {
	status = qed_u1_gen_interr(& i_qer_p->error);
	return(status);
    }
    regs_p->l14_3_dml[1] = EOS;

    if (tab_p->dd_t3_tab_type == DD_2OBJ_TABLE)
    {
	regs_p->l14_4_obj_type[0] = 'T';	/* local table */
    }
    else if (tab_p->dd_t3_tab_type == DD_3OBJ_VIEW)
    {
	regs_p->l14_4_obj_type[0] = 'V';	/* local view */
    }
    else if (tab_p->dd_t3_tab_type == DD_4OBJ_INDEX)
    {
	regs_p->l14_4_obj_type[0] = 'I';	/* local index */
    }
    else if (tab_p->dd_t3_tab_type == DD_5OBJ_REG_PROC)
    {
	regs_p->l14_4_obj_type[0] = 'P';	/* local index */
    }
    else
    {
	status = qed_u1_gen_interr(& i_qer_p->error);
	return(status);
    }
    regs_p->l14_4_obj_type[1] = EOS;
    regs_p->l14_5_obj_subtype[0] = 'L';		/* must set to link */
    regs_p->l14_5_obj_subtype[1] = EOS;

    pkt_p = qry_p->qed_q4_pkt_p;

    for (seq = 0; pkt_p != NULL; seq++)
    {
	/* 2.  construct text segment for current entry */

	regs_p->l14_6_sequence = seq + 1;
	regs_p->l14_7_pkt_p = pkt_p;

	if (pkt_p->dd_p1_len > QEK_256_VIEW_SIZE)
	{
	    status = qed_u1_gen_interr(& i_qer_p->error);
	    return(status);
	}

	/* 3.  insert into IIDD_DDB_REGISTRATIONS */

	ins_p->qeq_c1_can_id = INS_629_DD_REGISTRATIONS;
	ins_p->qeq_c3_ptr_u.l14_registrations_p = regs_p;
	ins_p->qeq_c4_ldb_p = cdb_p;
	status = qel_i1_insert(i_qer_p, v_lnk_p);
	if (status)
	    return(status);

	pkt_p = pkt_p->dd_p3_nxt_p;		/* advance to next segment,
						** if any */
    } 

    /* if a registered procedure, update iiprocedures */
    if (tab_p->dd_t3_tab_type == DD_5OBJ_REG_PROC)
    {
	qed_u0_trimtail( ddl_p->qed_d1_obj_name, (u_i2) DB_OBJ_MAXNAME,
	    proc_p->l18_1_proc_name);

	qed_u0_trimtail( ddl_p->qed_d2_obj_owner, (u_i2) DB_OWN_MAXNAME,
	    proc_p->l18_2_proc_owner);

	STcopy(v_lnk_p->qec_24_cur_time, proc_p->l18_3_cre_date);
	proc_p->l18_4_proc_subtype[0] = 'L';		/* must set to link */
	proc_p->l18_4_proc_subtype[1] = EOS;

	pkt_p = qry_p->qed_q4_pkt_p;

	for (seq = 0; pkt_p != NULL; seq++)
	{
	    /* 3.  construct text segment for current entry */

	    proc_p->l18_5_sequence = seq + 1;
	    proc_p->l18_6_pkt_p = pkt_p;

	    if (pkt_p->dd_p1_len > QEK_256_VIEW_SIZE)
	    {
		status = qed_u1_gen_interr(& i_qer_p->error);
		return(status);
	    }

	    /* 4.  insert into IIDD_DDB_REGISTRATIONS */

	    ins_p->qeq_c1_can_id = INS_633_DD_PROCEDURES;
	    ins_p->qeq_c3_ptr_u.l18_procedures_p = proc_p;
	    ins_p->qeq_c4_ldb_p = cdb_p;
	    status = qel_i1_insert(i_qer_p, v_lnk_p);
	    if (status)
		return(status);

	    pkt_p = pkt_p->dd_p3_nxt_p;		/* advance to next segment,
						    ** if any */
	} 
    }

    return(E_DB_OK);
}    
Ejemplo n.º 14
0
DB_STATUS
qel_34_altcols(
QEF_RCB		*i_qer_p,
QEC_LINK	*v_lnk_p )
{
    DB_STATUS	    status,
		    ignore;
    DB_ERROR	    sav_error;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_2LDB_TAB_INFO
		    *ldbtab_p = ddl_p->qed_d6_tab_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc,
		    *ldb_p = v_lnk_p->qec_19_ldb_p;
    QEC_L2_ALT_COLUMNS
		    altcols,
		    *altcols_p = & altcols;	/* tuple struct */
    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p,
		    *ins_p = v_lnk_p->qec_22_insert_p;
    DD_COLUMN_DESC  **col_descs_pp = ddl_p->qed_d4_ddb_cols_pp,
		    *from_p;
    i4		    tupcnt;


    /* 1.  set up for looping through each retrieved IIALT_COLUMNS tuple */

    qed_u0_trimtail( ldbtab_p->dd_t1_tab_name, (u_i4) DB_TAB_MAXNAME,
		    altcols_p->l2_1_tab_name);
    qed_u0_trimtail( ldbtab_p->dd_t2_tab_owner, (u_i4) DB_OWN_MAXNAME,
		    altcols_p->l2_2_tab_owner);

    sel_p->qeq_c1_can_id = SEL_101_II_ALT_COLUMNS;
    sel_p->qeq_c2_rqf_bind_p = v_lnk_p->qec_20_rqf_bind_p;
    sel_p->qeq_c3_ptr_u.l2_alt_columns_p = altcols_p;
    sel_p->qeq_c4_ldb_p = ldb_p;

    /* 2.  send SELECT query and fetch first tuple */

    status = qel_s4_prepare(i_qer_p, v_lnk_p);
    if (status)
	return(status);
        
    if (sel_p->qeq_c5_eod_b)
	return(E_DB_OK);			/* no date */

    tupcnt = 0;

    if (col_descs_pp)
    {
	col_descs_pp++;			/* must start from slot 1 */
	from_p = *col_descs_pp;
    }

    while (! sel_p->qeq_c5_eod_b && ! status)
    {
	/* 3.  replace with link name and link owner */

	qed_u0_trimtail( ddl_p->qed_d1_obj_name, (u_i4) DB_OBJ_MAXNAME,
			altcols_p->l2_1_tab_name);
	qed_u0_trimtail( ddl_p->qed_d2_obj_owner, (u_i4) DB_OWN_MAXNAME,
			altcols_p->l2_2_tab_owner);
	
	/* 4.  do column mapping if necessary */

	if (col_descs_pp)
	{
	    /* substitute link col name from inserting into IIDD_ALT_COLUMNS */

	    qed_u0_trimtail( from_p->dd_c1_col_name, (u_i4) DB_ATT_MAXNAME,
			altcols_p->l2_4_col_name);
	}
	else
	{
	    qel_a2_case_col(i_qer_p, altcols_p->l2_4_col_name,
			    *i_qer_p->qef_cb->qef_dbxlate,
			    &ldbtab_p->dd_t9_ldb_p->dd_i2_ldb_plus.
			    dd_p3_ldb_caps);
	}
			

	/* 5.  insert into IIDD_ALT_COLUMNS */

	ins_p->qeq_c1_can_id = INS_601_DD_ALT_COLUMNS;
	ins_p->qeq_c3_ptr_u.l2_alt_columns_p = altcols_p;
	ins_p->qeq_c4_ldb_p = cdb_p;

	status = qel_i1_insert(i_qer_p, v_lnk_p);
	if (status)
	{
	    /* must flush sending LDB */

	    STRUCT_ASSIGN_MACRO(i_qer_p->error, sav_error);
	    ignore = qel_s3_flush(i_qer_p, v_lnk_p);
	    STRUCT_ASSIGN_MACRO(sav_error, i_qer_p->error);
	    return(status);
	}

	tupcnt++;
	
	if (col_descs_pp)
	{
	    col_descs_pp++;			/* increment to pick up the
						** next DD_COLUMN_DESC */
	    from_p = *col_descs_pp;
	}

	/* 6.  read next tuple from LDB */

	sel_p->qeq_c4_ldb_p = ldb_p;
	status = qel_s2_fetch(i_qer_p, v_lnk_p);
	if (status)
	    return(status);
    }
    return(status);
}    
Ejemplo n.º 15
0
DB_STATUS
qel_33_columns(
QEF_RCB		*i_qer_p,
QEC_LINK	*v_lnk_p )
{
    DB_STATUS	    status,
		    ignore;
    DB_ERROR	    sav_error;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_2LDB_TAB_INFO
		    *ldbtab_p = ddl_p->qed_d6_tab_info_p;
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc,
		    *ldb_p = v_lnk_p->qec_19_ldb_p;
    QEC_D9_TABLEINFO
		    *tabinfo_p = v_lnk_p->qec_2_tableinfo_p;
    QEC_L3_COLUMNS  dd_columns,
		    *ddcolumns_p = & dd_columns;	/* tuple struct */
    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p,
		    *ins_p = v_lnk_p->qec_22_insert_p;
    DD_COLUMN_DESC  **col_descs_pp = ddl_p->qed_d4_ddb_cols_pp,
		    *name_p;
    i4		    tupcnt;

    if (v_lnk_p->qec_10_haves & QEC_08_NO_IITABLES)
	return(E_DB_OK);

    /* 1.  set up for looping through each retrieved local column */

    qed_u0_trimtail( ldbtab_p->dd_t1_tab_name, (u_i4) DB_TAB_MAXNAME,
		    ddcolumns_p->l3_1_tab_name);
    qed_u0_trimtail( ldbtab_p->dd_t2_tab_owner, (u_i4) DB_OWN_MAXNAME,
		    ddcolumns_p->l3_2_tab_owner);

    sel_p->qeq_c1_can_id = SEL_102_II_COLUMNS;
    sel_p->qeq_c2_rqf_bind_p = v_lnk_p->qec_20_rqf_bind_p;
    sel_p->qeq_c3_ptr_u.l3_columns_p = ddcolumns_p;
    sel_p->qeq_c4_ldb_p = ldb_p;

    ddcolumns_p->l3_15_internal_ingtype = 0;    /* init in case not ingres */

    /* 2.  send SELECT query and fetch first tuple */

    status = qel_s4_prepare(i_qer_p, v_lnk_p);
    if (status)
	return(status);
        
    if (sel_p->qeq_c5_eod_b)
    {
	/* no data ! */

	status = qed_u1_gen_interr(& i_qer_p->error);
	return(status);
    }

    tupcnt  = 0;

    if (col_descs_pp)
    {
	col_descs_pp++;			/* must start from slot 1 */
	name_p = *col_descs_pp;
    }

    while (! sel_p->qeq_c5_eod_b && ! status)
    {
	/* 4.  do column mapping if necessary  */

	if (col_descs_pp)
	{

	    /* 4.  set up for insertion */

	    /* substitue the link column name for inserting into IIDD_COLUMNS */

	    qed_u0_trimtail( name_p->dd_c1_col_name, (u_i4) DB_ATT_MAXNAME,
			ddcolumns_p->l3_3_col_name);
	}
	else
	{
	    qel_a2_case_col(i_qer_p, ddcolumns_p->l3_3_col_name,
			    *i_qer_p->qef_cb->qef_dbxlate,
			    &ldbtab_p->dd_t9_ldb_p->dd_i2_ldb_plus.
			    dd_p3_ldb_caps);
	}

	/* 4+. handle special datatypes (if any) */

	if(ddcolumns_p->l3_15_internal_ingtype >= 16384 ||
	   ddcolumns_p->l3_15_internal_ingtype <= -16384)    /* user datatype */
	{
	    /* copy internal type, length, ingtype into external for 6.2 cats */
	    MEcopy((PTR)ddcolumns_p->l3_13_internal_datatype,
		   DB_TYPE_MAXLEN +1,
		   (PTR)ddcolumns_p->l3_4_data_type);
	    ddcolumns_p->l3_5_length = ddcolumns_p->l3_14_internal_length;
	    ddcolumns_p->l3_12_ing_datatype =
					ddcolumns_p->l3_15_internal_ingtype;
	}
	ddcolumns_p->l3_15_internal_ingtype = 0;    /* init for next */


	/* 5.  replace with link name, link owner, and link creation date */

	qed_u0_trimtail( ddl_p->qed_d1_obj_name, (u_i4) DB_OBJ_MAXNAME,
			ddcolumns_p->l3_1_tab_name);
	qed_u0_trimtail( ddl_p->qed_d2_obj_owner, (u_i4) DB_OWN_MAXNAME,
			ddcolumns_p->l3_2_tab_owner);

	/* 6.  insert into IIDD_COLUMNS */

	ins_p->qeq_c1_can_id = INS_602_DD_COLUMNS;
	ins_p->qeq_c3_ptr_u.l3_columns_p = ddcolumns_p;
	ins_p->qeq_c4_ldb_p = cdb_p;
	status = qel_i1_insert(i_qer_p, v_lnk_p);
	if (status)
	{
	    /* must flush sending LDB */

	    STRUCT_ASSIGN_MACRO(i_qer_p->error, sav_error);
	    ignore = qel_s3_flush(i_qer_p, v_lnk_p);
	    STRUCT_ASSIGN_MACRO(sav_error, i_qer_p->error);
	    return(status);
	}

	tupcnt++;

	if (col_descs_pp)
	{
	    col_descs_pp++;			/* increment to pick up the
						** next DD_COLUMN_DESC */
	    name_p = *col_descs_pp;
	}

	/* 3.  retrieve next tuple */

	sel_p->qeq_c4_ldb_p = ldb_p;
	status = qel_s2_fetch(i_qer_p, v_lnk_p);
	if (status)
	    return(status);

    } /* end while */

    /*	the following check cannot be applied in the following 2 cases:
    **
    **	1)  an INGRES index because the count from IIINDEX_COLUMNS may be 
    **	    one less than the count from II_COLUMNS which includes "tidp" 
    **	    as an column,
    **	2)  on a REFRESH on an LDB table whose old schema can be a proper
    **	    subset of the new schema */

    if (ldbtab_p->dd_t3_tab_type == DD_2OBJ_TABLE
	&&
	dds_p->qes_d7_ses_state != QES_4ST_REFRESH)
    {
	if (tupcnt != ddl_p->qed_d3_col_count)
	{
	    status = qed_u1_gen_interr(& i_qer_p->error);
	    return(status);
	}
    }

    return(status);
}    
Ejemplo n.º 16
0
DB_STATUS
qel_32_tables(
QEF_RCB		*i_qer_p,
QEC_LINK	*v_lnk_p )
{
    DB_STATUS	    status;
    QES_DDB_SES	    *dds_p = & i_qer_p->qef_cb->qef_c2_ddb_ses;
    QED_DDL_INFO    *ddl_p = v_lnk_p->qec_1_ddl_info_p;
    DD_2LDB_TAB_INFO
		    *tabinfo_p = ddl_p->qed_d6_tab_info_p;
    QEC_L16_TABLES  *tables_p = v_lnk_p->qec_9_tables_p;
    QEQ_1CAN_QRY    *sel_p = v_lnk_p->qec_6_select_p,
		    *ins_p = v_lnk_p->qec_22_insert_p;
						/* working structure */
    DD_LDB_DESC	    *cdb_p = 
			& dds_p->qes_d4_ddb_p->dd_d3_cdb_info.dd_i1_ldb_desc,
		    *ldb_p = v_lnk_p->qec_19_ldb_p;
    u_i4	    l_obj;


    if (v_lnk_p->qec_10_haves & QEC_08_NO_IITABLES)
	return(E_DB_OK);

    /* 1.  set up to retrieve from IITABLES */

    qed_u0_trimtail( tabinfo_p->dd_t1_tab_name, (u_i4) DB_TAB_MAXNAME,
		    tables_p->l16_1_tab_name);
    qed_u0_trimtail( tabinfo_p->dd_t2_tab_owner, (u_i4) DB_OWN_MAXNAME,
		    tables_p->l16_2_tab_owner);

    sel_p->qeq_c1_can_id = SEL_117_II_TABLES;
    sel_p->qeq_c3_ptr_u.l16_tables_p = tables_p;
    sel_p->qeq_c4_ldb_p = ldb_p;
    sel_p->qeq_c2_rqf_bind_p = v_lnk_p->qec_20_rqf_bind_p;

    /* 2.  send SELECT query and fetch first tuple */

    status = qel_s4_prepare(i_qer_p, v_lnk_p);
    if (status)
	return(status);
        
    if (! sel_p->qeq_c5_eod_b)
    {
	status = qel_s3_flush(i_qer_p, v_lnk_p);
	if (status)
	    return(status);
    }

    if (v_lnk_p->qec_27_select_cnt != 1)
    {
	status = qed_u1_gen_interr(& i_qer_p->error);
	return(status);
    }

    if (v_lnk_p->qec_10_haves & QEC_10_USE_PHY_SRC)
    {
	/* 3.  read remaining information from the LDB's IIPHYSICAL_TABLES */

	sel_p->qeq_c1_can_id = SEL_113_II_PHYSICAL_TABLES;

	/* 3.1  send SELECT query and fetch first tuple */

	status = qel_s4_prepare(i_qer_p, v_lnk_p);
	if (status)
	    return(status);
        
	if (! sel_p->qeq_c5_eod_b)
	{
	    status = qel_s3_flush(i_qer_p, v_lnk_p);
	    if (status)
		return(status);
	}

	if (v_lnk_p->qec_27_select_cnt != 1)
	{
	    status = qed_u1_gen_interr(& i_qer_p->error);
	    return(status);
	}
    }

    if (v_lnk_p->qec_10_haves & QEC_11_LDB_DIFF_ARCH)
    {
	/* binary statistics data cannot be propagated for use due to 
	** different LDB architecture */

	tables_p->l16_9_stats[0] = 'N';		/* declare no statistics */
    }
    else if (!
	(
	(tables_p->l16_9_stats[0] == 'N')
	||
	(tables_p->l16_9_stats[0] == 'n')
	))
	v_lnk_p->qec_10_haves |= QEC_05_STATS;

    if (!
	(
	(tables_p->l16_10_indexes[0] == 'N')
	||
	(tables_p->l16_10_indexes[0] == 'n')
	))
	v_lnk_p->qec_10_haves |= QEC_02_INDEXES;

    /* 3.  set up tuple for insertion */

    l_obj = (u_i4)qed_u0_trimtail( ddl_p->qed_d1_obj_name, (u_i4)DB_OBJ_MAXNAME,
		tables_p->l16_1_tab_name);

    qed_u0_trimtail( ddl_p->qed_d2_obj_owner, (u_i4) DB_OWN_MAXNAME,
		tables_p->l16_2_tab_owner);

    STcopy(v_lnk_p->qec_24_cur_time, 
	    tables_p->l16_3_cre_date);
    STcopy(v_lnk_p->qec_24_cur_time, 
	    tables_p->l16_4_alt_date);

    if (tabinfo_p->dd_t3_tab_type == DD_2OBJ_TABLE)
	tables_p->l16_5_tab_type[0] = 'T';	/* local table */
    else if (tabinfo_p->dd_t3_tab_type == DD_3OBJ_VIEW)
	tables_p->l16_5_tab_type[0] = 'V';	/* local view */
    else if (tabinfo_p->dd_t3_tab_type == DD_4OBJ_INDEX)
	tables_p->l16_5_tab_type[0] = 'I';	/* local index */
    else 
    {
	status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB,
		    & i_qer_p->error);
	return(status);
    }
    tables_p->l16_5_tab_type[1] = EOS;		/* null terminate */

    if (ddl_p->qed_d8_obj_type == DD_1OBJ_LINK)
   	tables_p->l16_6_sub_type[0] = 'L';	/* DDB link */
    else if (ddl_p->qed_d8_obj_type == DD_2OBJ_TABLE
	     ||
	     ddl_p->qed_d8_obj_type == DD_3OBJ_VIEW)
	tables_p->l16_6_sub_type[0] = 'N';	/* DDB native */
    else
    {
	status = qed_u2_set_interr(E_QE0018_BAD_PARAM_IN_CB,
		    & i_qer_p->error);
	return(status);
    }
    tables_p->l16_6_sub_type[1] = EOS;		/* null terminate */

    STcopy(IIQE_42_ing_60, tables_p->l16_7_version);

    if (dds_p->qes_d9_ctl_info & QES_05CTL_SYSCAT_USER)
    {
	char *ch2 = ddl_p->qed_d1_obj_name + CMbytecnt(ddl_p->qed_d1_obj_name);

	if( ( l_obj >= 2 ) &&
	    (CMcmpnocase(ddl_p->qed_d1_obj_name, "i") == 0 ) &&
	    (CMcmpnocase(ch2, "i") == 0 ))
	{
	    tables_p->l16_8_sys_use[0] = 'S';	/* system object */

	}
	else
	    tables_p->l16_8_sys_use[0] = 'U';	/* user object */
    }
    else
	tables_p->l16_8_sys_use[0] = 'U';	/* user object */
    tables_p->l16_8_sys_use[1] = EOS;		/* null terminate */

    if (! (v_lnk_p->qec_10_haves & QEC_03_INGRES) )
    {
	/* index information NOT propagated for gateways */
	tables_p->l16_10_indexes[0] = 'N';	/* N */
	tables_p->l16_10_indexes[1] = EOS;	/* null terminate */
    }
    tables_p->l16_23_integrities[0] = 'N';	/* always N */
    tables_p->l16_23_integrities[1] = EOS;	/* null terminate */

    tables_p->l16_24_permits[0] = 'N';		/* always N */
    tables_p->l16_24_permits[1] = EOS;	/* null terminate */

    if (tabinfo_p->dd_t3_tab_type == DD_4OBJ_INDEX)
	tables_p->l16_25_all_to_all[0] = 'N';	/* always N if an index */
    else
	tables_p->l16_25_all_to_all[0] = 'Y';	/* always Y otherwise */
    tables_p->l16_25_all_to_all[1] = EOS;	/* null terminate */

    /* 4.  insert into IIDD_TABLES */

    ins_p->qeq_c1_can_id = INS_631_DD_TABLES;	
    ins_p->qeq_c3_ptr_u.l16_tables_p = tables_p;	
    ins_p->qeq_c4_ldb_p = cdb_p;
    status = qel_i1_insert(i_qer_p, v_lnk_p);

    return(status);
}