.nf
 
 
    ========== licence begin  GPL
    Copyright (c) 1999-2004 SAP AG
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
 
.fo
*****************************************************
Copyright (c) 1999-2004 SAP AG
SAP Database Technology
 
Release :      Date : 2000-09-11
*****************************************************
modname : GAK68
changed : 2000-09-11
module  : AK_join_const_type
 
Author  : GertG
Created : 1999-02-08
*****************************************************
 
Purpose : Const und Type for ak-layer concering join routines
 
Define  :
 
.CM *-END-* define --------------------------------------
***********************************************************
Use     :
 
.CM *-END-* use -----------------------------------------
***********************************************************
Synonym :
 
.CM *-END-* synonym -------------------------------------
***********************************************************
.CM -lll-
Code    :
 
 
CONST
      (* methods for join sequence search *)
      cak68_heuristic_search      =         0;
      cak68_greedy_search         =         1;
      cak68_permutation_search    =         2;
      (*  *)
      cak68_left                  =         1;
      cak68_right                 =         2;
      (*  *)
      cak68_join_value            =        99;
      (* mxak68_joinparsbuf:                                         *)
      (* csp_maxint2 - length of other parts in tak68_joinparsrecord *)
      mxak68_joinparsbuf          =     22412;
      mxak68_mt_arr               =       512;
      (* *** vak680, vak681, vak682 const *** *)
      cak68_contextconstoffset    =        84;
      cak68_max_real              =   1.0E+38;
      (* cak_max_real - VM : 1.0E+75, UNIX 1.0E+38     *)
      cak68_max_valid_real        =   1.0E+18;
      (* cak_max_valid_real - highest estimation value used  *)
      cak68_sup_field_factor      =       1.2;
      cak68_cartesian_product     =       MAX_JOINS_GG04 + 1;
      cak68_c_distinct_factor     =       3.0;
      cak68_updstat_minpages      =       200;
      cak68_updstat_factor        =       1.2;
      cak68_inv_overhead          =       1.3;
      (* *)
      cak68_only_field_multiplier  =    1;
      cak68_index_field_multiplier =    5;
      cak68_eq_field_multiplier    =    20;
      cak68_unknown_multiplier     =    5;
      (* *** end vak680, vak681,vak682 types *** *)
      MAX_EVALRECORDS_IDX_AK68    =   cak00_maxsources;
      MAX_RESCHEDULE_CNT_AK68     = 1500 (* <= MAX_INT2_SP00 *);
 
TYPE
      (*---------------- basic types ---------------------*)
      tak68_mbuf_to_tmpbuf_context = (mtc_search_sequence,
            mtc_generate_join_info,
            mtc_generate_join_info_operator_join,
            mtc_save_context);
      (*--------------------------------------------------*)
      tak68_one_jointype =  (
            to_single_keyfield,
            to_key,
            to_unique_field,
            to_keypart,            (* more than one keyfield  *)
            to_first_keyfield,
            to_all_invfields,
            to_invpart,
            to_invfield,
            to_mt_join,            (* more than one jointable *)
            to_eq_field,
            to_lt_gt_field,
            to_ne_field,
            to_cartesian_prod,
            to_illegal);
      (*--------------------------------------------------*)
      tak68_joinarr_index = tsp00_Int2;     (* index in tak_joinarr *)
      (*------------- combined types ---------------------*)
 
      tak68_evaluation_rec  =  RECORD
            ev_strat_value  : tsp00_Longreal;
            ev_readIO_pages : tsp00_Int4;
            ev_wholeIO_pages: tsp00_Int4;
            ev_inv_only     : boolean;
            ev_fill1        : boolean;
            ev_fill2        : tsp00_C2;
      END;
 
      tak68_evaluation_records  =
            ARRAY [ 1..MAX_EVALRECORDS_IDX_AK68 ] OF tak68_evaluation_rec;
 
      tak68_njinfo  =  RECORD
            nj_kbjrec                   : tgg07_KbJoinRec;
            nj_joincols_to_be_shifted   : tsp00_Int2;
            nj_nxt_klen_filled          : tsp00_Int2;
            nj_r_len                    : tsp00_Int2;
            nj_nk_len                   : tsp00_Int2;
            nj_nxttabno                 : tsp00_Int2;
            nj_left_side                : tak_joinset;
            nj_clefill                  : boolean;
            nj_fill1                    : boolean;
            nj_fill2                    : tsp00_C2;
      END;
 
      
      tak68_joininfos  =  RECORD
            ji_old_tree          : tgg00_FileId;
            ji_old_recl          : tsp00_Int2;
            ji_old_keyl          : tsp00_Int2;
            ji_nxtjinfo          : tak68_njinfo;
            ji_acttabno          : tsp00_Int2;
            ji_outpos            : tsp00_Int2;
            ji_keylen            : tsp00_Int2;
            ji_act_join          : tsp00_Int2;
            ji_stack_desc        : tgg00_StackDesc;
            ji_mb_data_len       : tsp00_Int2;
            ji_use_operator_join : tgg07_opjoin_usage;
            ji_set_output_filter : boolean;
            ji_st_addr           : tgg00_StackListPtr;
            ji_parskey           : tak_parskey; (* session command ID *)
      END;
 
      (* eqt_whole :   for quick compare of (tabno1,colno1) = (tabno2,colno2) *)
      (* eqt_tabno :   index in tak_all_from_tables (dmli.d_tabarr)           *)
      (* eqt_colno :   record column position                                 *)
 
      tak68_eqfieldid_type = RECORD
            CASE boolean OF
                true :
                    (eqt_whole : tsp00_Int4);
                false :
                    (eqt_tabno : tsp00_Int2;
                    eqt_colno : tsp00_Int2);
                END;
            (*ENDCASE*) 
 
 
      tak68_eqfieldinfo  =  RECORD
            eqi_fieldid  : tak68_eqfieldid_type;
            eqi_stackpos : tsp00_Int2;            (* stackpos of column description *)
            eqi_joinno   : tak68_joinarr_index; (* index in tak_joinarr *)
            eqi_codetype : tsp00_CodeType;       (* ascii, unicode *)
            eqi_jrecs    : tsp00_Uint1;         (* left or right column *)
            eqi_jrfill1  : tsp00_Int2;
      END;
      tak68_eqfield = ARRAY [ cak68_left..cak68_right ] OF tak68_eqfieldinfo;
 
      tak68_eq_arr  =  ARRAY [ 1..MAX_JOINS_GG04 ] OF tak68_eqfield;
 
      tak68_eq_record  =  RECORD
            eqr_arr   : tak68_eq_arr;
            eqr_cnt   : tsp00_Int2;           (* count of equal conditions *)
            eqr_fill  : tsp00_Int2
      END;
 
 
      tak68_one_table_stat  =  RECORD
            ts_pages_searched : tsp00_Longreal;
            ts_strat_value    : tsp00_Longreal;
            ts_all_pages      : tsp00_Int4;
            ts_cost           : tsp00_Int4;
            ts_recs_per_page  : tsp00_Int2;
            ts_filler         : tsp00_C6;
      END;
 
      tak68_table_stats  =  ARRAY [ 1..cak00_maxsources ] OF tak68_one_table_stat;
 
      tak68_join_transition    =  RECORD
            jt_multipl   : tsp00_Int4;
            jt_joinno    : tak68_joinarr_index;
            jt_indexno   : tsp00_Int2;
            jt_jointype  : tak68_one_jointype;
            jt_filler    : tsp00_C3;
      END;
 
      tak68_join_transitions  =  ARRAY [ 1..cak00_maxsources, 1..cak00_maxsources ]
            OF tak68_join_transition;
      (* data structure for join sequence *)
 
      tak68_one_seq_join  =  PACKED RECORD
            jos_joinstrat                : tgg07_StratEnum;
            jos_predefined_buf           : boolean;
            jos_source                   : tsp00_Int2;
            jos_fieldcnt                 : tsp00_Int2;
            jos_indexno                  : tsp00_Int2;
            jos_invlen                   : tsp00_Int4;
            jos_joinno                   : tak68_joinarr_index;
            jos_access_mod               : tgg07_StratAccessModSet; (* PTS 1127791 M.Ki. *)
            jos_filler                   : boolean;
            jos_table_buffer             : tsp00_Int4;
            jos_expected_recs            : tsp00_Int4;
            jos_expected_table_rec_reads : tsp00_Int4;
            jos_parallel_server          : tsp00_Int4;
      END;
 
      tak68_sequence  =  ARRAY [ 1..cak00_maxsources ] OF tak68_one_seq_join;
      tak68_joinparsbuf = PACKED ARRAY [ 1..mxak68_joinparsbuf ] OF char;
 
      tak68_joinview_rec  =  RECORD
            jv_tabid     : tgg00_Surrogate;
            jv_keybuf    : tak_sysbufferaddress;
            jv_maxkeyl   : tsp00_Int2;
            jv_checkview : boolean;
      END;
 
 
      tak68_joinparsrecord  =  RECORD
            jp_reclen                 : tsp00_Int2;
            jp_keylen                 : tsp00_Int2;
            jp_varcol_offset          : tsp00_Int2;
            jp_varcol_cnt             : tsp00_Int2;
            jp_surrogate              : tgg00_Surrogate;
            jp_entrytype              : tsp00_C2;
            jp_segno                  : tsp00_Int2;
            jp_fullen                 : tsp00_Int4;
            jp_restree                : tgg00_FileId;
            jp_d_inoutpos             : tsp00_Int2;
            jp_d_cntfromtab           : tsp00_Int2;
            jp_d_reclen               : tsp00_Int2;
            jp_d_keylen               : tsp00_Int2;
            jp_eq_cnt                 : tsp00_Int2;
            jp_sr_strategy            : tgg07_StratEnum;
            jp_sr_use_rowno           : boolean;
            jp_filler1                : boolean;
            jp_sr_distinct_bytes      : boolean;
            jp_d_standard             : boolean;
            jp_d_single               : boolean;
            jp_d_distinct             : tgg04_Distinct;
            jp_d_union                : boolean;
            jp_search_sequence        : boolean;
            jp_a_outer_join           : boolean;
            jp_nextexist              : boolean;
            jp_d_pseudo_ins_select    : boolean;
            jp_d_order_cnt            : tsp00_Int2;
            jp_d_rowno                : tsp00_Int2;
            jp_d_globstate            : tgg00_HandlingSet;
            jp_d_session_isolevel     : tsp00_Uint1;
            jp_d_use_session_isolevel : boolean;
            jp_d_one_join_phase       : boolean;
            jp_use_operator_join      : tgg07_opjoin_usage;
            jp_joincnt                : tsp00_Int2;
            jp_d_filler2              : tsp00_C6;
            jp_d_buffer               : tak68_joinparsbuf;
      END;
 
 
      tak68_joinparsrecord_hybrid = RECORD
            CASE boolean OF
                true:
                    (jph_uniptr   : tak_sysbufferaddress);
                false:
                    (jph_joinpars : ^tak68_joinparsrecord);
                END;
            (*ENDCASE*) 
            (* data structure for possible join access path *)
 
 
      tak68_mul_tab_rec  =  RECORD
            mtr_dst_table: tsp00_Int2;
            mtr_tablecnt : tsp00_Int2;
            mtr_multipl  : tsp00_Int4;
            mtr_combdist : tsp00_Int4;
            mtr_tab_seq  : tak_joinset;
            mtr_fieldcnt : tsp00_Int2;
            mtr_joinno   : tak68_joinarr_index;
            mtr_indexno  : tsp00_Int2;
            mtr_jointype : tak68_one_jointype;
            mtr_filler   : tsp00_Uint1;
      END;
 
      tak68_mult_tab_arr    =  ARRAY [ 1..mxak68_mt_arr ] OF tak68_mul_tab_rec;
 
      tak68_mult_tabs  =  RECORD
            mt_cnt : tsp00_Int2;
            mt_pos : tsp00_Int2;
            mt_arr : tak68_mult_tab_arr;
      END;
 
 
      tak68_result_info  =  RECORD
            ri_rec_len           : tsp00_Int2;
            ri_recs_per_page     : tsp00_Int2;
            ri_old_recs_per_page : tsp00_Int2;
            ri_filler            : tsp00_Int2;
            ri_one_tab_len       : ARRAY [ 1..cak00_maxsources ] OF tsp00_Int2;
            ri_single_strat      : ARRAY [ 1..cak00_maxsources ] OF
                  tgg07_StratEnum;
            ri_inv_only_strat    : ARRAY [ 1..cak00_maxsources ] OF boolean;
            ri_indexno           : ARRAY [ 1..cak00_maxsources ] OF tsp00_Int2;
      END;
 
 
      tak68_succ  =  RECORD
            s_backup  : tsp00_Int2;
            s_tableno : tsp00_Int2;
      END;
 
      tak68_succession =  ARRAY [ 1..cak00_maxsources ] OF tak68_succ;
 
      tak68_sequence_info  =  RECORD
            si_sum      : tsp00_Longreal;
            si_pages    : tsp00_Longreal;
            si_sequence : tak68_succession;
      END;
 
 
      tak68_last_values    = RECORD
            lv_newsum               : tsp00_Longreal;
            lv_newpages             : tsp00_Longreal;
            lv_res_rec_len          : tsp00_Int2;
            lv_recs_per_respage     : tsp00_Int2;
            lv_old_recs_per_respage : tsp00_Int2;
            lv_filler               : tsp00_Int2;
      END;
 
 
      tak68_lastsuccession = RECORD
            ls_values     : ARRAY [ 1..cak00_maxsources ] OF tak68_last_values;
            ls_sequence   : tak68_succession;
      END;
 
 
      tak68_best_jstrat = RECORD
            bj_srctab     : tsp00_Int2;
            bj_fieldcnt   : tsp00_Int2;
            bj_multiplier : tsp00_Int4;
            bj_indexno    : tsp00_Int2;
            bj_jtype      : tak68_one_jointype;
            bj_filler     : boolean;
      END;
 
      tak68_outcol = RECORD
            oc_srctab     : tsp00_Int2;
            oc_srcpos     : tsp00_Int2;
            oc_dstpos     : tsp00_Int2;
            oc_len        : tsp00_Int2;
      END;

      tak68_outcols = ARRAY [ 0..MAX_INT2_SP00 ] OF tak68_outcol;
      tak68_outcols_ptr = ^tak68_outcols;

      tak68_output_desc = RECORD
            od_outcols      : tak68_outcols_ptr;
            od_capacity     : tsp00_Int2;
            od_size         : tsp00_Int2;
            od_outreclen    : tsp00_Int4;
      END;
      
      tak68_join = RECORD
            jn_res_rec_len: tsp00_Int4;
            jn_rec_len    : tsp00_Int4;
            jn_res_key_len: tsp00_Int4;
            jn_key_len    : tsp00_Int4;
            jn_jarr_cnt   : tsp00_Int2;
            jn_jarr_path  : tsp00_Int2;
            jn_leftoj     : boolean;
            jn_rightoj    : boolean;
            jn_filler     : tsp00_Int2;
            jn_jarr       : ARRAY [1..MAX_JOINS_GG04] OF tsp00_Int2;
      END;
      tak68_join_ptr = ^tak68_join;
      
      tak68_join_context = RECORD
            jc_act_join   : tsp00_Int2;
            jc_acttabno   : tsp00_Int2;
            jc_nxttabno   : tsp00_Int2;
            jc_mb_data_len: tsp00_Int2;
            jc_outpos     : tsp00_Int4;
            jc_sortkeylen : tsp00_Int4;
            jc_left_side  : tak_joinset;
            jc_st_addr    : tgg00_StackListPtr;
            jc_stack_desc : tgg00_StackDesc;
            jc_parskey    : tak_parskey; (* session command ID *)
            jc_outdesc    : tak68_output_desc;
            jc_joininfo   : tak68_join;
            jc_tempresult : boolean;
      END;

.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
