home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / apps / powerbase / Docs / Utilities < prev    next >
Encoding:
Text File  |  1994-10-01  |  10.0 KB  |  185 lines

  1.                         Powerbase Utilities
  2.                         ===================
  3.  
  4. Under this heading we will group a number of things which can be done from
  5. the ‘Utilities’ sub-menu of the icon-bar menu to examine and alter the
  6. structure of an existing database. Note that, if passwords have been set,
  7. you need to open the database with the ‘Manager’-level password to obtain
  8. access to this sub-menu.
  9.  
  10. Changing the Primary Key
  11. ========================
  12. The primary key of a database is determined when it is created, but it is
  13. not fixed for all time. The option provided from the ‘Utilities’ submenu
  14. displays the same dialogue box as is used for creating the primary key in
  15. the first place, but with the addition of two radio buttons, whose function
  16. is described below. The present key structure is shown. Simply alter it to
  17. what you require and click on ‘OK’ or type RETURN. Confirmation is
  18. requested.
  19.  
  20. Normally the first of the two radio buttons is selected, causing the records
  21. to appear in the same subfiles as they did before. In this case, any
  22. additional indices will still be valid.
  23.  
  24. If you deselect this radio button with ADJUST (i.e. have neither button
  25. selected) then all the records will be placed in the currently selected
  26. subfile. 
  27.  
  28. Selecting the second radio button also places the records in the current 
  29. subfile, but has the additional effect of recovering any “deleted” records,
  30. i.e. records which are still lurking in the ‘Database’ file but aren’t in
  31. the primary key index. In fact this mode of operation ignores the existing
  32. primary key altogether. There is one very important circumstance under which
  33. you would need to do this: when the primary key index is lost or corrupted.
  34.  
  35. NOTE: You might have a ‘Database’ file but no ‘PrimaryKey’ file at all. This 
  36. could happen if you have, for example, created a suitable text file and then
  37. set its type to ‘Database’.  To build a primary key for such a file the only
  38. valid setting for the radio buttons is the one just described, i.e. second
  39. button selected.  To enforce this mode both radio buttons are shaded.
  40.  
  41. Adjusting the record format
  42. ===========================
  43. Minor changes to the screen layout can be made without having to rebuild the
  44. database. Choose the ‘Adjust format’ menu option and you will be presented
  45. with the blank record screen. Clicking MENU over this  brings up the same
  46. menu as you used to create the screen originally, but the field-definition
  47. dialogue box has some options shaded. Thus, you can’t delete fields, add new
  48. ones or alter the data lengths, but you can re-position fields, change
  49. descriptors and tags, and alter the visible lengths. When you have finished
  50. the changes, click on the last option on the menu -  ‘Quit design’.
  51.  
  52. Another situation in which your control over the screen design will be
  53. limited as above occurs when you have a ‘Form’ file and a ‘Database’ file
  54. but no ‘PrimaryKey’ file. Since this is not yet a functioning database you
  55. will be placed in “restricted design” mode. The ‘Quit design’ option isn’t
  56. used to end the adjustments in this case. Use ‘Save form file’ instead. 
  57.  
  58. Changing the record format
  59. ==========================
  60. This is a more drastic change to make, but one can’t foresee all future
  61. needs and you may have to introduce a new field into the record or lengthen
  62. an existing one. This involves rebuilding the whole database. You will need
  63. to create a new application shell with the new ‘Form’ file inside it. The
  64. best way to do this is probably to open the new database directory, copy the
  65. old ‘Form’ file into it, then open the new “database”. Since no ‘PrimaryKey’
  66. or ‘Database’ file yet exists you will be able to modify the screen design
  67. as you wish. You should not, however, go on to complete the empty database
  68. (i.e. don’t choose ‘Default database’ or click on the ‘OK’ button in the
  69. primary key dialogue box) - simply save the ‘Form’ file using the menu
  70. choice provided. 
  71.  
  72. With your old database open, choose the ‘Change format’ option from the
  73. icon-bar menu and drag the new database to the large arrow icon in the
  74. displayed  window. The database will then be rebuilt. Make sure you have
  75. plenty of disc space available before doing this since the original database
  76. remains intact so you need room for it and the new one.
  77.  
  78. Data from a field in the old database is copied to a field in the new one
  79. which has the same tag. The new Form file must therefore retain the same 
  80. tags as the old for data which is to be common to both. If a tag exists in
  81. the old Form file but not in the new Powerbase will assume that the relevant
  82. field has been deleted and data present in that field in the old database
  83. will not be transferred. A tag which is present in the new database but not
  84. in the old is assumed to be a newly-introduced field and will therefore be
  85. left blank.
  86.  
  87. Merging a second database
  88. =========================
  89. Two databases may be merged provided they have the same record structure. 
  90. Selecting ‘Merge database’ displays a window like that used for changing the
  91. record format and you simply drag the second database to the arrow icon.
  92. Powerbase will check that the two record formats are identical and report an
  93. error if they aren’t. If the open database has insufficient free space to
  94. hold the merged records it is automatically extended.
  95.  
  96. Two radio buttons are also present, as in the dialogue box for rebuilding
  97. the primary key, and their functions are essentially the same. Thus, having
  98. the first selected will merge records into the same subfiles as those they
  99. occupied in the source database. Having neither selected will merge records
  100. into the current subfile of the open database, regardless of where they are
  101. in the source database. Having the second button selected does the same
  102. thing, but also imports records which were “deleted” in the source database.
  103.  
  104. Changing the Database Length
  105. ============================
  106. Needing to lengthen a database is a common situation. Wanting to shorten one
  107. is less common, but both are easily accomplished. ‘Change length’ leads to a
  108. dialogue box with two writable icons. The first of these is used to specify
  109. the new database length. You will be warned if, when shortening a database,
  110. any of the records being removed are not blank. They may be deleted data,
  111. but then again they may not. You have been warned! The other writable icon
  112. determines the number of records by which the database will be lengthened
  113. each time it becomes full. If this value is zero no automatic lengthening
  114. occurs - a warning message is displayed instead.
  115.  
  116. Balancing index trees
  117. =====================
  118. The tree structures used to hold indices can become very unbalanced, 
  119. especially if you enter a lot of records in key-order. ‘Balance index’ leads
  120. to a submenu with two choices: ‘Automatic’ and ‘Right now’. Choosing the
  121. latter will optimise all subfiles in the current index. Before using it you
  122. are recommended to examine the state of the indices with the ‘Print tree’
  123. option.
  124.  
  125. Choosing the first menu item (‘Automatic’) enables automatic balancing of
  126. all the indices in use every time the number of records entered becomes a
  127. multiple of a set value. This value is initially set to 25, i.e. indices
  128. will be balanced during record entry after each batch of 25 records, and
  129. may be altered via submenu with a single writable item. When automatic
  130. balancing is active the ‘Automatic’ menu choice is ticked. Clicking on it a
  131. second time turns auto-balancing off and removes the tick. Balancing can
  132. take some time, and the time increases with the number of records in the
  133. file. If you are entering records from the keyboard in a fairly haphazard
  134. sequence you should leave the ‘Manual’ option set. If, however, you need to
  135. enter a lot of records in primary key order it might be to your advantage to
  136. make balancing automatic whilst the database is small, returning to ‘Manual’
  137. when a few dozen records have been entered.
  138.  
  139. The most useful application of the ‘Automatic’ option is when you are
  140. importing records via a CSV, or similar, file. Such files frequently come
  141. from other database systems and are very likely to have their records in
  142. primary key order. The data import will become slower and slower as the
  143. number of records increases and, where thousands of records are involved,
  144. can literally take hours. Setting the system up for automatic index
  145. balancing, say every 50 or 100 records, can markedly reduce this time.
  146.  
  147. Printing the Tree Structure
  148. ===========================
  149. This is something you do either out of idle curiosity or to see whether an
  150. index tree needs balancing. ‘Print index’ provides two choices:-
  151.  
  152.    (1) to print the actual keys, positioned according to the level 
  153.        which they occupy in the tree
  154.  
  155.    (2) to print only the number of nodes on each level.
  156.  
  157. The data printed applies to the current subfile of the current key and is
  158. output to a screen window from which it may be saved in the same way as any
  159. other list (see ‘Printing’ - Output destination).
  160.  
  161. If the tree is very deep and straggly it may not be possible to show all of
  162. it. The maximum number of levels which can be shown is in fact 40, including
  163. the root. Using option (1) above causes keys which cannot be displayed in
  164. their correct positions to appear down the left hand side of the window with
  165. a note indicating the level in which they occur.
  166.  
  167. If you choose (1), a double click with SELECT on any of the keys will
  168. display the relevant record with the caret placed in the key field. 
  169.  
  170. Duplicate primary keys
  171. ======================
  172. Wherever possible a primary key should be chosen so as to be unique. Where
  173. duplication of the primary key might occur the designer of the database can
  174. decide either to allow or forbid it. (The switch which controls this is
  175. hidden from prying eyes in the password-setting window and is thus under
  176. ‘Manager’-level control. See ‘Passwords’ for more information.) If duplicate
  177. keys are permitted it is sometimes useful to have a list of them. Such a
  178. list is created by ‘Find duplicates’ and may be saved as a text file.
  179.  
  180. Closely related is the final entry on the ‘Utilities’ sub-menu; ‘Warn of
  181. duplicates’. If ticked this causes a warning message to be displayed each
  182. time a primary key is about to be duplicated. Clicking on this menu choice
  183. toggles the ticked state.
  184.  
  185.