1 /* BEGIN mrds_dbcb.incl.pl1 -- jaw, 11/7/78 */
  2 
  3 
  4 
  5 /****^  HISTORY COMMENTS:
  6   1) change(85-11-17,Dupuis), approve(85-12-16,MCR7314),
  7      audit(86-02-04,Brunelle), install(86-02-05,MR12.0-1013):
  8      This entry is being made to cover the change made on 85-07-01 by Thanh
  9      Nguyen. The scopes_changed flag was added to make checking for this
 10      more efficient (mrds error list #137).
 11   2) change(86-06-10,Blair), approve(86-08-07,MCR7491),
 12      audit(86-08-07,Gilcrease), install(86-08-15,MR12.0-1127):
 13      Add a bit called dont_check_txn_id to indicate whether or not we should
 14      care if multiple txns use the same selection_expression. (mrds #156)
 15   3) change(87-11-23,Hergert), approve(88-06-28,MCR7903),
 16      audit(88-06-28,Dupuis), install(88-08-01,MR12.2-1073):
 17      Added parser_work_area_ptr and mrds_se_info_ptr for new parser.
 18                                                    END HISTORY COMMENTS */
 19 
 20 
 21 /* WARNING
 22           If the dbcb structure is changed then the mrds_data_
 23           item saved_res_version MUST be incremented to invalidate all
 24           existing saved resultants
 25 */
 26 
 27 /* HISTORY :
 28 
 29    modified by Jim Gray - - 80-10-24, to add new_select_expr bit for
 30    tid_list management
 31 
 32    81-1-9 Jim Gray : added like reference for  ease  in  making  the
 33    phony resultant in mu_database_index, without having the area dcl
 34    included.
 35 
 36    81-06-17 Roger Lackey :  added  last_store_rel_name  for  use  by
 37    mrds_dsl_store
 38 
 39    81-06-26 Roger Lackey : Added no_optimize and  print_search_order
 40    switches
 41 
 42    81-07-06 Jim Gray : added identifier for  the  current  selection
 43    expression,  so  that relation statistics can be updated relative
 44    to number of selection expressions seem. Also  removed  init  for
 45    last_store_rel_name,   as   this   iw   now   properly   done  in
 46    mrds_dsl_init_res.
 47 
 48    81-07-17  Roger Lackey : added pred_ptr and unused_ptrs.
 49 
 50    82-08-19  Mike Kubicar : added store_vector field.  This is needed
 51    for the conversion to the relation manager.
 52 
 53    82-08-23 Davids: added the relmgr_entries and access_costs
 54    substructures so that the entries and costs can change
 55    depending on the type of database that is opened.
 56 
 57    82-09-09 Mike Kubicar : added modify_vector field.  This is needed
 58    since modify uses a different vector type (general) than does store.
 59 
 60    82-09-20 Davids: changed names of (store modify)_vector to
 61    (store modify)_vector_ptr. Also (delete modify)_tuple_by_id to
 62    (delete modify)_tuples_by_id. added the element cursor_storage_ptr
 63    which should be inited to null and will be set by mu_cursor_manager_$get
 64    during the first call.
 65 
 66    82-09-21 Davids: renamed cursor_storage_ptr to cursor_ptrs_storage_ptr
 67    since it deals with the pointers to the cursors and not the cursors
 68    themelves and added the element cursor_storage_area_ptr which points
 69    to the area where the cursors are kept.
 70 
 71    82-09-22 Davids: renamed the transact_ctl_seg to transactions_needed.
 72    the transact_ctl_seg always had a value of 0 and really didn't mean
 73    anything.
 74 
 75    82-09-22 Mike Kubicar : added create_relation, create_index and
 76    destroy_relation_by_opening to relmgr_entries.  They are needed
 77    by mrds_dsl_define_temp_rel.
 78 
 79    82-09-24 Donna Woodka : added  put_tuple to  relmgr_entries. It
 80    is needed by mu_store.
 81 
 82    82-11-12 Davids: changed the declaration of the access_costs from fixed
 83    bin to float bin since the values are not integers.
 84 
 85    83-02-02 Davids: added the dbc_uid element. This will allow mrds to make
 86    sure that the dbc_ptr still points to the correct segment. Element was
 87    added to the end of the structure to allow modules that don't use
 88    the element to continue to reference the dbcb structure without recompiling.
 89 
 90    83-02-25 Davids: added the concurrency_on and rollback_on elements. These
 91    are needed so that temp rels can be created with the same file attributes
 92    as the permanent relations.
 93 
 94    83-05-02 Mike Kubicar : Deleted get_next_search_specification_ptr and
 95    added the resultant_in_pdir bit.
 96 
 97    83-05-18 Davids: reduced the number of reserved bits to 14 (from 15) and
 98    added the res_already_made element.
 99 
100    83-05-24 Mike Kubicar : Updated the relation manager calling sequences.
101 
102    83-08-03 Mike Kubicar : Added the element_id_list_segment_ptr and removed
103    one of the unused pointers.
104 
105    83-09-20 Ron Harvey: Added relmgr_entries.get_population.
106 
107    84-08-27 John Hergert:  Created compiled_se_info_ptr from unused_ptrs(2)
108    leaving unused_ptrs(1).
109 
110    85-01-15 Thanh Nguyen:  Added the work_area_ptr and removed the last
111    unused_ptrs (1).
112 
113    85-04-12 Thanh Nguyen:  Added user_started_transaction and
114    non_shared_to_shared flags.  Also added se_transaction_id and some more
115    spare ptrs, entries and reserved storages for future enhancement, since
116    we changed the saved_res_version from rslt0001 to rslt0002.
117 
118    85-07-01 Thanh Nguyen:  Added scopes_changed flag.  This flag is set by
119    common routine of mrds_dsl_set_scope, reset by mrds_dsl_optimize and
120    mrds_dsl_gen_srch_prog when building of a new search_vars.
121 */
122 
123 
124 /* this structure is based on the {unique_name}.mrds.dbcb segment
125    that constitutes the non-secure portion of the resultant model that is
126    created during the opening of a database. it contains variables that
127    are used during the runtime access of the database, and an area
128    for evaluation of requests. it points to four other
129    segments in the resultant model, {unique_name}.mrds.rdbi, the secure
130    portion of the resultant(see mdbm_rm_db_info.incl.pl1),
131    {unique_name}.mrds.select, an area for selection expression evaluation,
132    {unique_name}.mrds.curdat, and {unique_name}.mrds.stadat, two segments
133    used in the elimination of duplicate tuples during a retrieve.
134    the dbcb area holds the structure in mdbm_scope_info.incl.pl1
135    that is used when the database is using the file scope mechanism
136    for concurrency control over file readying. the segment overlayed via
137    mrds_dbc.incl.pl1 structure is pointed to and also handles concurrency control,
138    across database openings. the pointer to this dbcb structure is kept in a table
139    which associates database indexes(returned from a call to dsl_$open), with particular
140    opening instances of resultant models. (see mu_database_index routine) */
141 
142      dcl     1 dbcb                 aligned based (dbcb_ptr), /* DBCB -- non-secure portion */
143                2 data               like dbcb_data,
144                2 static_area        area (sys_info$max_seg_size - fixed (rel (addr (dbcb.static_area))));
145 
146      dcl     dbcb_ptr               ptr;
147 
148      declare 1 dbcb_data            based,                  /* info part of dbcb, separated out so that
149                                                                like references can avoid getting the area declaration */
150                2 rdbi_ptr           ptr,                    /* pointer to write protected mdbm_util_ info. */
151                2 range_ptr          ptr,                    /*  ptr to range structure, or null */
152                2 select_ptr         ptr,                    /* ptr to select list, or null */
153                2 sv_ptr             ptr,                    /* pointer to search variables */
154                2 so_ptr             ptr,                    /* pointer to search operators */
155                2 ti_ptr             ptr,                    /* pointer to tuple info */
156                2 lit_ptr            ptr,                    /* pointer to the literal area, or null */
157                2 current_ptr        ptr,                    /* ptr to select list resulting from -current clause */
158                2 ss_ptr             ptr,                    /* ptr to select sets block if not simple s.e. */
159                2 retr_info_ptr      ptr,                    /* ptr to retrieve info area */
160                2 trel_info_ptr      ptr,                    /* ptr to retrieve info area */
161                2 sti_ptr            ptr,                    /* pointer to store info */
162                2 dbc_ptr            ptr,                    /*  pointer to the data base control segment */
163                2 sfi_ptr            ptr,                    /* points to head of scalar function list */
164                2 scope_ptr          ptr,                    /* points to array of scope tuples */
165                2 select_area_ptr    ptr,                    /* ptr to area for current selection expression allocations */
166                2 current_data_ptr   ptr,                    /* ptr to one of 2 segments used by mrds_dsl_retrieve
167                                                                for eliminating duplicate tuples. */
168                2 static_data_ptr    ptr,                    /* ptr to one of 2 segments used by mrds_dsl_retrieve
169                                                                for eliminating duplicate tuples. */
170                2 store_area_ptr     ptr,                    /* temp storage area for dsl_$store */
171                2 retrieve_area_ptr  ptr,                    /* temp storage for dsl_$retrieve */
172                2 modify_area_ptr    ptr,                    /* temp storage area for dsl_$modify */
173                2 delete_area_ptr    ptr,                    /* temp storage area for dsl_$delete */
174                2 def_temp_rel_area_ptr ptr,                 /* temp storage area for dsl_$define_temp_rel */
175                2 pred_ptr           ptr,                    /* Pointer to pred_array */
176                2 store_vector_ptr   ptr,                    /* Vector structure used during store operations */
177                2 modify_vector_ptr  ptr,                    /* Used during modifies */
178                2 element_id_list_segment_ptr ptr,           /* Points to the segment used to hold element_id_list structures */
179                2 compiled_se_info_ptr ptr,                  /* points to the segment containing all info on compiled sexs */
180                2 work_area_ptr        ptr,                  /* Work area for encode/decode value allocations in mu_retrieve */
181                2 se_info_ptr          ptr,                  /* Points to se_info struct. Primarily for error reports */
182                2 parser_work_area_ptr ptr,                  /*  work area for parser */
183                2 reserved_ptrs      (4) ptr,                /* Reserved for future use */
184                2 another_flag       bit (1) unal,           /* on if predicate was -another */
185                2 current_flag       bit (1) unal,           /* on if predicate was -current clause */
186                2 dbc_incr           bit (1) unal,           /* on if dbc open mode has been incremented for this user */
187                2 delete_flag        bit (1) unal,           /* On if search was called from mrds_dsl_sec_delete */
188                2 dup_retain         bit (1) unaligned,      /* On if dup tuples allowed for retrieval */
189                2 prev_select        bit (1) unal,           /* on if prev. select block processed in this s.e. */
190                2 possible_op        bit (1) unal,           /* on of arith op. allowed */
191                2 sel_clause         bit (1) unal,           /* on if currently in select clause */
192                2 dsm_sw             bit (1) unal,           /* on if data base was opened via data submodel */
193                2 val_rtrv           bit (1) unal,           /* if s.e. valid for retrieve */
194                2 val_mod            bit (1) unal,           /* for modify */
195                2 val_del            bit (1) unal,           /* for delete */
196                2 val_dtr            bit (1) unal,           /* for define temp rel */
197                2 transactions_needed bit (1) unal,          /* On => transaction must be started or in progress does
198                                                                      not imply that the database is of type page_file */
199                2 open_mode          bit (3) unal,           /* 0=>unknown, 1=>r, 2=>u, 3=>er, 4=>eu, >4=>bad */
200                2 new_select_expr    bit (1) unal,           /* on => starting a new tid list management period */
201                2 no_optimize        bit (1) unal,           /* On => no optimize */
202                2 print_search_order bit (1) unal,           /*  On => print the search order */
203                2 resultant_in_pdir  bit (1) unal,           /* On => Temp segments are in the process dir */
204                2 res_already_made   bit (1) unal,           /* On => resultant has been made based on a saved copy */
205                2 user_started_transaction bit (1) unal,     /* On => user already started his own transaction. */
206                2 non_shared_to_shared bit (1) unal,         /* On => user changed the scope from non shared to shared
207                                                                inside a sequence of -another selection expression. */
208                2 scopes_changed     bit (1) unal,           /* On => scopes had been changed by set_scopes or delete_scopes */
209                2 dont_check_txn_id  bit (1) unal,           /* On => cpmd needs same selection exp across multiple txns */
210                2 reserved           bit (10) unal,          /* reserved for future use */
211                2 nseq_sch           fixed bin (35),         /* no. tuples located via sequential search */
212                2 nind_sch           fixed bin (35),         /* no. tuples located via index search */
213                2 nhash_sch          fixed bin (35),         /* no. tuples located via hash search */
214                2 nlk_sch            fixed bin (35),         /* no tuples located via link search */
215                2 cur_lit_offset     fixed bin (35),         /* current bit offset in literal string */
216                2 dbi                fixed bin (35),         /* database index for this opening */
217                2 last_s_e_id_num    fixed bin (35),         /* identifying number for last selection expression seen */
218                2 se_transaction_id  bit (36) aligned,       /* transaction id from beginning of select expression */
219                2 last_store_rel_name char (32),             /* Name of relation last used  for store */
220                2 cursor_ptrs_storage_ptr ptr,               /* pointer to space where cursor ptrs are stored */
221                2 cursor_storage_area_ptr ptr,               /* pointer to area where the cursors are kept */
222                2 reserved_words     (10) fixed bin (35),    /* Reserved for future use */
223                2 relmgr_entries,                            /* relation manager entries */
224                  3 open             entry (char (*), char (*), bit (36) aligned, fixed bin (35)),
225                  3 close            entry (bit (36) aligned, fixed bin (35)),
226                  3 create_cursor    entry (bit (36) aligned, ptr, ptr, fixed bin (35)),
227                  3 destroy_cursor   entry (ptr, ptr, fixed bin (35)),
228                  3 set_scope        entry (bit (36) aligned, bit (2) aligned, bit (2) aligned, fixed bin (35)),
229                  3 delete_tuples_by_id entry (ptr, ptr, fixed bin (35), fixed bin (35)),
230                  3 modify_tuples_by_id entry (ptr, ptr, ptr, fixed bin (35), fixed bin (35)),
231                  3 get_tuple_by_id  entry (ptr, bit (36) aligned, ptr, ptr, ptr, fixed bin (35)),
232                  3 get_tuples_by_spec entry (ptr, ptr, ptr, ptr, ptr, fixed bin (35)),
233                  3 get_tuple_id     entry (ptr, ptr, ptr, ptr, fixed bin (35)),
234                  3 put_tuple        entry (ptr, ptr, bit (36) aligned, fixed bin (35)),
235                  3 get_count        entry (ptr, ptr, fixed bin (35), fixed bin (35)),
236                  3 get_duplicate_key_count entry (ptr, bit (36) aligned, fixed bin (17), fixed bin (35), fixed bin (35)),
237                  3 get_population   entry (ptr, fixed bin (35), fixed bin (35)),
238                  3 create_relation  entry (char (*), char (*), ptr, ptr, bit (36) aligned, bit (36) aligned, fixed bin (35)),
239                  3 create_index     entry (bit (36) aligned, ptr, bit (36) aligned, fixed bin (17), bit (36) aligned, fixed bin (35)),
240                  3 destroy_relation_by_path entry (char (*), char (*), fixed bin (35)),
241                  3 reserved_entries (5) entry (),
242                2 access_costs,                              /* access costs for permute */
243                  3 total_primary_key_cost float bin,
244                  3 access_cost      float bin,
245                  3 access_overhead  float bin,
246                  3 us_access_cost   float bin,
247                  3 os_access_cost   float bin,
248                2 dbc_uid            bit (36) aligned,       /* uid of the segment containing the dbc structure */
249                2 concurrency_on     bit (1) unal,           /* "1"b implies dmfile concurrency is being used */
250                2 rollback_on        bit (1) unal;           /* "1"b iomplies before journaling is to be done */
251 
252 /* END mrds_dbcb.incl.pl1 */
253 
254