Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - dbsort() sort a database http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dbsort()            Sort a database
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func logical dbsort extern
   param const char    cSorted, ;
               alias   sDatabase, ;
               untyped pIdx, ;
         value ulong   pFuncFor, ;
         value ulong   pFuncWhile

 Arguments
   cSorted is the name of the new sorted database.
   sDatabase is the alias for the database whose contents is to be sorted.
   pIdx is an index alias on which the sort is based.
   pFuncFor is a pointer to a function which acts as the for clause in
      database commands. This parameter is currently unused and its
      value must be set to 0.
   pFuncWhile is a pointer to a function which acts as the while clause in
      database commands. This parameter is currently unused and its
      value must be set to 0.

 Return
   A logical indicating if the sorted database has been succesfully created.

 Description
   The dbsort() function copies records from an alias to another database
   file in sorted order. The original database must be opened prior to
   sorting. The function copies all records, except those marked as
   deleted, provided the set delete on command is in effect.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_dbsort
   open "stest.dbf" alias sTest
   ? "First record before sorting", trim( sTest->firstname ), sTest->lastname
   dbsort( "sorted.dbf", sTest, sIdxLN, 0, 0 )
   close sTest
   open "sorted.dbf" alias sTest
   ? "First record after  sorting", trim( sTest->firstname ), sTest->lastname
   close sTest
   erase "sorted.dbf"
   endproc

   proc main
   Test_dbsort()
   endproc

See Also: copy to

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson