| 1 | DINIT2BB ;SFISC/MKO-SQLI FILES ;10:51 AM  30 Mar 1999
 | 
|---|
| 2 |  ;;22.0;VA FileMan;;Mar 30, 1999
 | 
|---|
| 3 |  ;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  F I=1:2 S X=$T(Q+I) Q:X=""  S Y=$E($T(Q+I+1),4,999),X=$E(X,4,999) S:$A(Y)=126 I=I+1,Y=$E(Y,2,999)_$E($T(Q+I+1),5,99) S:$A(Y)=61 Y=$E(Y,2,999) S @X=Y
 | 
|---|
| 5 |  G ^DINIT2BC
 | 
|---|
| 6 | Q Q
 | 
|---|
| 7 |  ;;^DIC(1.5218,0,"GL")
 | 
|---|
| 8 |  ;;=^DMSQ("P",
 | 
|---|
| 9 |  ;;^DIC("B","SQLI_PRIMARY_KEY",1.5218)
 | 
|---|
| 10 |  ;;=
 | 
|---|
| 11 |  ;;^DIC(1.5218,"%D",0)
 | 
|---|
| 12 |  ;;=^^9^9^2970806^^^
 | 
|---|
| 13 |  ;;^DIC(1.5218,"%D",1,0)
 | 
|---|
| 14 |  ;;=A chosen set of columns which uniquely identify a table.
 | 
|---|
| 15 |  ;;^DIC(1.5218,"%D",2,0)
 | 
|---|
| 16 |  ;;=In the relational model (as in set theory) the columns of a primary key
 | 
|---|
| 17 |  ;;^DIC(1.5218,"%D",3,0)
 | 
|---|
| 18 |  ;;=are not ordered. In SQLI they must be, in order to map to the quasi-
 | 
|---|
| 19 |  ;;^DIC(1.5218,"%D",4,0)
 | 
|---|
| 20 |  ;;=hierarchical model of M globals.
 | 
|---|
| 21 |  ;;^DIC(1.5218,"%D",5,0)
 | 
|---|
| 22 |  ;;= 
 | 
|---|
| 23 |  ;;^DIC(1.5218,"%D",6,0)
 | 
|---|
| 24 |  ;;=FileMan subfiles (multiples) have a primary key element for each parent
 | 
|---|
| 25 |  ;;^DIC(1.5218,"%D",7,0)
 | 
|---|
| 26 |  ;;=plus one for the subfile. Each contains a pointer to its primary key table
 | 
|---|
| 27 |  ;;^DIC(1.5218,"%D",8,0)
 | 
|---|
| 28 |  ;;=element (SQLI_TABLE-ELEMENT), a sequence and a column in the local base
 | 
|---|
| 29 |  ;;^DIC(1.5218,"%D",9,0)
 | 
|---|
| 30 |  ;;= table (SQL_COLUMN).
 | 
|---|
| 31 |  ;;^DD(1.5218,0)
 | 
|---|
| 32 |  ;;=FIELD^^7^8
 | 
|---|
| 33 |  ;;^DD(1.5218,0,"DDA")
 | 
|---|
| 34 |  ;;=N
 | 
|---|
| 35 |  ;;^DD(1.5218,0,"DT")
 | 
|---|
| 36 |  ;;=2961014
 | 
|---|
| 37 |  ;;^DD(1.5218,0,"IX","B",1.5218,.01)
 | 
|---|
| 38 |  ;;=
 | 
|---|
| 39 |  ;;^DD(1.5218,0,"IX","C",1.5218,2)
 | 
|---|
| 40 |  ;;=
 | 
|---|
| 41 |  ;;^DD(1.5218,0,"IX","D",1.5218,1)
 | 
|---|
| 42 |  ;;=
 | 
|---|
| 43 |  ;;^DD(1.5218,0,"NM","SQLI_PRIMARY_KEY")
 | 
|---|
| 44 |  ;;=
 | 
|---|
| 45 |  ;;^DD(1.5218,0,"PT",1.5219,1)
 | 
|---|
| 46 |  ;;=
 | 
|---|
| 47 |  ;;^DD(1.5218,0,"VRPK")
 | 
|---|
| 48 |  ;;=DI
 | 
|---|
| 49 |  ;;^DD(1.5218,.01,0)
 | 
|---|
| 50 |  ;;=P_TBL_ELEMENT^RP1.5216'^DMSQ("E",^0;1^Q
 | 
|---|
| 51 |  ;;^DD(1.5218,.01,.1)
 | 
|---|
| 52 |  ;;=Key Element
 | 
|---|
| 53 |  ;;^DD(1.5218,.01,1,0)
 | 
|---|
| 54 |  ;;=^.1
 | 
|---|
| 55 |  ;;^DD(1.5218,.01,1,1,0)
 | 
|---|
| 56 |  ;;=1.5218^B
 | 
|---|
| 57 |  ;;^DD(1.5218,.01,1,1,1)
 | 
|---|
| 58 |  ;;=S ^DMSQ("P","B",$E(X,1,30),DA)=""
 | 
|---|
| 59 |  ;;^DD(1.5218,.01,1,1,2)
 | 
|---|
| 60 |  ;;=K ^DMSQ("P","B",$E(X,1,30),DA)
 | 
|---|
| 61 |  ;;^DD(1.5218,.01,3)
 | 
|---|
| 62 |  ;;=
 | 
|---|
| 63 |  ;;^DD(1.5218,.01,9)
 | 
|---|
| 64 |  ;;=^
 | 
|---|
| 65 |  ;;^DD(1.5218,.01,21,0)
 | 
|---|
| 66 |  ;;=^^1^1^2960926^^
 | 
|---|
| 67 |  ;;^DD(1.5218,.01,21,1,0)
 | 
|---|
| 68 |  ;;=IEN of table element in SQLI_TABLE_ELEMENT
 | 
|---|
| 69 |  ;;^DD(1.5218,.01,"DT")
 | 
|---|
| 70 |  ;;=2960823
 | 
|---|
| 71 |  ;;^DD(1.5218,1,0)
 | 
|---|
| 72 |  ;;=P_COLUMN^RP1.5217'^DMSQ("C",^0;2^Q
 | 
|---|
| 73 |  ;;^DD(1.5218,1,.1)
 | 
|---|
| 74 |  ;;=Column
 | 
|---|
| 75 |  ;;^DD(1.5218,1,1,0)
 | 
|---|
| 76 |  ;;=^.1
 | 
|---|
| 77 |  ;;^DD(1.5218,1,1,1,0)
 | 
|---|
| 78 |  ;;=1.5218^D
 | 
|---|
| 79 |  ;;^DD(1.5218,1,1,1,1)
 | 
|---|
| 80 |  ;;=S ^DMSQ("P","D",$E(X,1,30),DA)=""
 | 
|---|
| 81 |  ;;^DD(1.5218,1,1,1,2)
 | 
|---|
| 82 |  ;;=K ^DMSQ("P","D",$E(X,1,30),DA)
 | 
|---|
| 83 |  ;;^DD(1.5218,1,1,1,"DT")
 | 
|---|
| 84 |  ;;=2960830
 | 
|---|
| 85 |  ;;^DD(1.5218,1,9)
 | 
|---|
| 86 |  ;;=^
 | 
|---|
| 87 |  ;;^DD(1.5218,1,21,0)
 | 
|---|
| 88 |  ;;=^^1^1^2960926^^^
 | 
|---|
| 89 |  ;;^DD(1.5218,1,21,1,0)
 | 
|---|
| 90 |  ;;=IEN of column in SQLI_COLUMN corresponding to this primary key
 | 
|---|
| 91 |  ;;^DD(1.5218,1,"DT")
 | 
|---|
| 92 |  ;;=2960830
 | 
|---|
| 93 |  ;;^DD(1.5218,2,0)
 | 
|---|
| 94 |  ;;=P_SEQUENCE^RNJ1,0^^0;3^K:+X'=X!(X>9)!(X<1)!(X?.E1"."1N.N) X
 | 
|---|
| 95 |  ;;^DD(1.5218,2,.1)
 | 
|---|
| 96 |  ;;=Seq
 | 
|---|
| 97 |  ;;^DD(1.5218,2,1,0)
 | 
|---|
| 98 |  ;;=^.1
 | 
|---|
| 99 |  ;;^DD(1.5218,2,1,1,0)
 | 
|---|
| 100 |  ;;=1.5218^C^MUMPS
 | 
|---|
| 101 |  ;;^DD(1.5218,2,1,1,1)
 | 
|---|
| 102 |  ;;=S ^DMSQ("P","C",$P(^DMSQ("P",DA,0),U),X,DA)=""
 | 
|---|
| 103 |  ;;^DD(1.5218,2,1,1,2)
 | 
|---|
| 104 |  ;;=K ^DMSQ("P","C",$P(^DMSQ("P",DA,0),U),X,DA)
 | 
|---|
| 105 |  ;;^DD(1.5218,2,1,1,"%D",0)
 | 
|---|
| 106 |  ;;=^^1^1^2960827^^
 | 
|---|
| 107 |  ;;^DD(1.5218,2,1,1,"%D",1,0)
 | 
|---|
| 108 |  ;;=Primary key by table by sequence
 | 
|---|
| 109 |  ;;^DD(1.5218,2,1,1,"DT")
 | 
|---|
| 110 |  ;;=2960823
 | 
|---|
| 111 |  ;;^DD(1.5218,2,3)
 | 
|---|
| 112 |  ;;=Type a Number between 1 and 9, 0 Decimal Digits
 | 
|---|
| 113 |  ;;^DD(1.5218,2,9)
 | 
|---|
| 114 |  ;;=^
 | 
|---|
| 115 |  ;;^DD(1.5218,2,21,0)
 | 
|---|
| 116 |  ;;=^^1^1^2960926^
 | 
|---|
| 117 |  ;;^DD(1.5218,2,21,1,0)
 | 
|---|
| 118 |  ;;=Sequence number of primary key
 | 
|---|
| 119 |  ;;^DD(1.5218,2,23,0)
 | 
|---|
| 120 |  ;;=^^1^1^2960926^
 | 
|---|
| 121 |  ;;^DD(1.5218,2,23,1,0)
 | 
|---|
| 122 |  ;;=Sequence is automatically generated and must not be changed.
 | 
|---|
| 123 |  ;;^DD(1.5218,2,"DT")
 | 
|---|
| 124 |  ;;=2960926
 | 
|---|
| 125 |  ;;^DD(1.5218,3,0)
 | 
|---|
| 126 |  ;;=P_START_AT^F^^0;4^K:$L(X)>30!($L(X)<1) X
 | 
|---|
| 127 |  ;;^DD(1.5218,3,.1)
 | 
|---|
| 128 |  ;;=Start
 | 
|---|
| 129 |  ;;^DD(1.5218,3,3)
 | 
|---|
| 130 |  ;;=Answer must be 1-30 characters in length.
 | 
|---|
| 131 |  ;;^DD(1.5218,3,9)
 | 
|---|
| 132 |  ;;=^
 | 
|---|
| 133 |  ;;^DD(1.5218,3,21,0)
 | 
|---|
| 134 |  ;;=^^1^1^2960926^
 | 
|---|
| 135 |  ;;^DD(1.5218,3,21,1,0)
 | 
|---|
| 136 |  ;;=Initial value of key before a $ORDER loop
 | 
|---|
| 137 |  ;;^DD(1.5218,3,"DT")
 | 
|---|
| 138 |  ;;=2960820
 | 
|---|
| 139 |  ;;^DD(1.5218,4,0)
 | 
|---|
| 140 |  ;;=P_END_IF^K^^1;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 | 
|---|
| 141 |  ;;^DD(1.5218,4,.1)
 | 
|---|
| 142 |  ;;=End If
 | 
|---|
| 143 |  ;;^DD(1.5218,4,3)
 | 
|---|
| 144 |  ;;=This is a Standard M expression returning False at end
 | 
|---|
| 145 |  ;;^DD(1.5218,4,9)
 | 
|---|
| 146 |  ;;=^
 | 
|---|
| 147 |  ;;^DD(1.5218,4,21,0)
 | 
|---|
| 148 |  ;;=^^1^1^2960926^
 | 
|---|
| 149 |  ;;^DD(1.5218,4,21,1,0)
 | 
|---|
| 150 |  ;;=M expression in key value, {K}, which, if false, ends the $ORDER loop
 | 
|---|
| 151 |  ;;^DD(1.5218,4,"DT")
 | 
|---|
| 152 |  ;;=2960926
 | 
|---|
| 153 |  ;;^DD(1.5218,5,0)
 | 
|---|
| 154 |  ;;=P_ROW_COUNT^NJ10,2^^0;5^K:+X'=X!(X>9999999)!(X<1)!(X?.E1"."3N.N) X
 | 
|---|
| 155 |  ;;^DD(1.5218,5,.1)
 | 
|---|
| 156 |  ;;=Rows
 | 
|---|
| 157 |  ;;^DD(1.5218,5,3)
 | 
|---|
| 158 |  ;;=Type a Number between 1 and 9999999, 2 Decimal Digits
 | 
|---|
| 159 |  ;;^DD(1.5218,5,9)
 | 
|---|
| 160 |  ;;=^
 | 
|---|
| 161 |  ;;^DD(1.5218,5,21,0)
 | 
|---|
| 162 |  ;;=^^1^1^2960926^^
 | 
|---|
| 163 |  ;;^DD(1.5218,5,21,1,0)
 | 
|---|
| 164 |  ;;=Estimated number of rows per record set at this level
 | 
|---|
| 165 |  ;;^DD(1.5218,5,"DT")
 | 
|---|
| 166 |  ;;=2960926
 | 
|---|
| 167 |  ;;^DD(1.5218,6,0)
 | 
|---|
| 168 |  ;;=P_PRESELECT^K^^2;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 | 
|---|
| 169 |  ;;^DD(1.5218,6,.1)
 | 
|---|
| 170 |  ;;=Preselect M Code
 | 
|---|
| 171 |  ;;^DD(1.5218,6,3)
 | 
|---|
| 172 |  ;;=This is Standard MUMPS code.
 | 
|---|
| 173 |  ;;^DD(1.5218,6,9)
 | 
|---|
| 174 |  ;;=^
 | 
|---|
| 175 |  ;;^DD(1.5218,6,21,0)
 | 
|---|
| 176 |  ;;=^^1^1^2960926^^
 | 
|---|
| 177 |  ;;^DD(1.5218,6,21,1,0)
 | 
|---|
| 178 |  ;;=Code to be executed before selecting this key, before optimization.
 | 
|---|
| 179 |  ;;^DD(1.5218,6,"DT")
 | 
|---|
| 180 |  ;;=2960926
 | 
|---|
| 181 |  ;;^DD(1.5218,7,0)
 | 
|---|
| 182 |  ;;=P_KEY_FORMAT^P1.5213'^DMSQ("KF",^0;6^Q
 | 
|---|
| 183 |  ;;^DD(1.5218,7,9)
 | 
|---|
| 184 |  ;;=^
 | 
|---|
| 185 |  ;;^DD(1.5218,7,21,0)
 | 
|---|
| 186 |  ;;=^^4^4^2961014^
 | 
|---|
| 187 |  ;;^DD(1.5218,7,21,1,0)
 | 
|---|
| 188 |  ;;=Key formats map internal storage values to their value when used as keys.
 | 
|---|
| 189 |  ;;^DD(1.5218,7,21,2,0)
 | 
|---|
| 190 |  ;;=In general, information is lost in the process; they can't be converted
 | 
|---|
| 191 |  ;;^DD(1.5218,7,21,3,0)
 | 
|---|
| 192 |  ;;=back. This means data must be converted to key format before it can be
 | 
|---|
| 193 |  ;;^DD(1.5218,7,21,4,0)
 | 
|---|
| 194 |  ;;=compared to such a key.
 | 
|---|
| 195 |  ;;^DD(1.5218,7,"DT")
 | 
|---|
| 196 |  ;;=2961014
 | 
|---|