home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database / CLIPR503.W96 / ORD.C_ / ORD.C
Text File  |  1995-06-26  |  8KB  |  155 lines

  1. /***
  2. *
  3. *  Ord.ch
  4. *
  5. *  Standard definitions for extended Index capabilities (some are supported
  6. *  only by DBFCDX)
  7. *
  8. */
  9.  
  10. #command INDEX ON <key> [TAG <(cOrder)>] TO <(cBag)>                    ;
  11.             [FOR <for>]                                                 ;
  12.             [WHILE <while>]                                             ;
  13.             [<lUnique: UNIQUE>]                                         ;
  14.             [<ascend: ASCENDING>]                                       ;
  15.             [<descend: DESCENDING>]                                     ;
  16.             [<lUsecurrent: USECURRENT>]                                 ;
  17.             [<lAdditive: ADDITIVE>]                                     ;
  18.             [EVAL <eval> [ EVERY <nEvery> ]]                            ;
  19.             [<lCustom: CUSTOM>]                                         ;
  20.             [<lNoOpt: NOOPTIMIZE>]                                                                          ;
  21.     =>  ordCondSet( <"for">, <{for}>,                                   ;
  22.                      nil,                                               ;
  23.                      <{while}>,                                         ;
  24.                      <{eval}>, <nEvery>,                                ;
  25.                      nil, nil, nil,                                     ;
  26.                      nil, [<.descend.>],                                ;
  27.                      nil, <.lAdditive.>, <.lUsecurrent.>, <.lCustom.>,  ;
  28.                      <.lNoOpt.>)                                        ;
  29.         ;  ordCreate(<(cBag)>, <(cOrder)>, <"key">, <{key}>, [<.lUnique.>])
  30.  
  31. #command INDEX ON <key> TAG <(cOrder)> [TO <(cBag)>]                    ;
  32.             [FOR <for>]                                                 ;
  33.             [WHILE <while>]                                             ;
  34.             [<lUnique: UNIQUE>]                                         ;
  35.             [<ascend: ASCENDING>]                                       ;
  36.             [<descend: DESCENDING>]                                     ;
  37.             [<lUsecurrent: USECURRENT>]                                 ;
  38.             [<lAdditive: ADDITIVE>]                                     ;
  39.             [EVAL <eval> [ EVERY <nEvery> ]]                            ;
  40.             [<lCustom: CUSTOM>]                                         ;
  41.             [<lNoOpt: NOOPTIMIZE>]                                                                          ;
  42.     =>  ordCondSet( <"for">, <{for}>,                                   ;
  43.                      nil,                                               ;
  44.                      <{while}>,                                         ;
  45.                      <{eval}>, <nEvery>,                                ;
  46.                      nil, nil, nil,                                     ;
  47.                      nil, [<.descend.>],                                ;
  48.                      nil, <.lAdditive.>, <.lUsecurrent.>, <.lCustom.>,  ;
  49.                      <.lNoOpt.>)                                        ;
  50.         ;  ordCreate(<(cBag)>, <(cOrder)>, <"key">, <{key}>, [<.lUnique.>])
  51.  
  52.  
  53. #define TOPSCOPE            0
  54. #define BOTTOMSCOPE            1
  55.  
  56.  
  57. /* Codes for SELF_ORDINFO() */
  58.  
  59. #define DBOI_CONDITION     1  /* Get the order condition     */
  60. #define DBOI_EXPRESSION    2  /* Get the order expression    */
  61. #define DBOI_POSITION      3  /* Get the order position      */
  62. #define DBOI_RECNO         4  /* Get the order record number */
  63. #define DBOI_NAME          5  /* Get the order list name     */
  64. #define DBOI_NUMBER        6  /* Get the order list position */
  65. #define DBOI_BAGNAME       7  /* Get the order Bag name      */
  66. #define DBOI_BAGEXT        8  /* Get the order Bag Extension */
  67. #define DBOI_INDEXEXT      DBOI_BAGEXT
  68. #define DBOI_INDEXNAME     DBOI_BAGNAME
  69. #define DBOI_ORDERCOUNT    9  /* Get the number of orders in the index file */
  70. #define DBOI_FILEHANDLE   10  /* Get the handle of the index file */
  71. #define DBOI_ISCOND       11  /* Get the flag if the order has a for condition */
  72. #define DBOI_ISDESC       12  /* Get the flag if the order is descending */
  73. #define DBOI_UNIQUE       13  /* Get the flag if the order has the unique attribute set */
  74.  
  75. /* New constants */
  76. #define DBOI_FULLPATH            20    /* Get the order Bag Full Path            */
  77. #define DBOI_KEYTYPE            24    /* Get the keytype of order             */
  78. #define DBOI_KEYSIZE            25    /* Get the keysize of order             */
  79. #define DBOI_KEYCOUNT            26    /* Get the number of keys                */
  80. #define DBOI_SETCODEBLOCK        27    /* Set codeblock for order key            */
  81. #define DBOI_KEYDEC             28    /* Get decimals of order keyt            */
  82. #define DBOI_HPLOCKING            29    /* High performance index locking        */
  83. #define DBOI_LOCKOFFSET         35    /* New locking offset                    */
  84.  
  85. #define DBOI_KEYADD             36    /* Gets/Sets the Key to be added        */
  86. #define DBOI_KEYDELETE            37    /* Gets/Sets the Key to be deleted        */
  87. #define DBOI_KEYVAL             38    /* Get current key value                */
  88. #define DBOI_SCOPETOP            39    /* Gets/Sets top of scope                */
  89. #define DBOI_SCOPEBOTTOM        40    /* Gets/Sets bottom of scope            */
  90. #define DBOI_SCOPETOPCLEAR        41    /* Clears top scope setting             */
  91. #define DBOI_SCOPEBOTTOMCLEAR    42    /* Clears bottom scope setting            */
  92.  
  93. #define DBOI_CUSTOM             45    /* Custom created order                 */
  94. #define DBOI_SKIPUNIQUE         46    /* Flag for skip unique                 */
  95.  
  96. #define DBOI_KEYSINCLUDED        50  /* # of keys included while indexing    */
  97. #define DBOI_KEYGOTO                    DBOI_POSITION   /* keyno                                        */
  98. #define DBOI_KEYNORAW            51  /* keyno ignoring any filter            */
  99. #define DBOI_KEYCOUNTRAW        52    /* keycount ignoring any filter            */
  100. #define DBOI_OPTLEVEL            53  /* Optimization achieved for last query    */
  101.  
  102.     //    Ideally shoud be an entry point that doesn't require an open table
  103. #define DBOI_STRICTREAD            60  /* Get/set read thru RDD when indexing    */
  104. #define DBOI_OPTIMIZE            61    /* Get/set use of query optimization    */
  105. #define DBOI_AUTOOPEN            62    /* Get/set auto open of production index    */
  106. #define DBOI_AUTOORDER            63    /* Get/set default order of production index    */
  107. #define DBOI_AUTOSHARE            64    /* Get/set automatic sharing control    */
  108.  
  109.  
  110. /* Codes for SELF_INFO() */
  111. /* DBI_* are defined in DBINFO.CH */
  112.  
  113.  
  114. /* codes for SELF_RECINFO() */
  115. /* DBRI_* are defined in DBINFO.CH */
  116.  
  117.  
  118. /* codes for SELF_FIELDINFO() */
  119. #define DBS_NAME          1
  120. #define DBS_TYPE          2
  121. #define DBS_LEN           3
  122. #define DBS_DEC           4
  123.  
  124.  
  125. /* SCOPE and related SETS */
  126. #command SET SCOPE TO                                                   ;
  127.     =>  ordScope(0, nil)                                                ;
  128.         ; ordScope(1, nil)
  129.  
  130. #command SET SCOPE TO <xValue>                                          ;
  131.     =>  ordScope(0, <xValue>)                                           ;
  132.         ; ordScope(1, <xValue>)
  133.  
  134. #command SET SCOPE TO <xVal1>, <xVal2>                                  ;
  135.     =>  ordScope(0, <xVal1>)                                            ;
  136.         ; ordScope(1, <xVal2>)
  137.  
  138. #xcommand SET SCOPETOP TO                                               ;
  139.     =>  ordScope(0, nil)
  140.  
  141. #xcommand SET SCOPETOP TO <xValue>                                      ;
  142.     =>  ordScope(0, <xValue>)
  143.  
  144. #xcommand SET SCOPEBOTTOM TO                                            ;
  145.     =>  ordScope(1, nil)
  146.  
  147. #xcommand SET SCOPEBOTTOM TO <xValue>                                   ;
  148.     =>  ordScope(1, <xValue>)
  149.  
  150. #xcommand SET DESCENDING ON                                             ;
  151.     =>  ordDescend(,, .t.)
  152.  
  153. #xcommand SET DESCENDING OFF                                            ;
  154.     =>  ordDescend(,, .f.)
  155.