Files
harbour-core/harbour/extras/hbapollo/tests/test20.prg
Viktor Szakats 340318e66d 2012-07-21 19:09 UTC+0200 Viktor Szakats (vszakats syenar.net)
+ extras
  - examples
  * doc/dirstruc.txt
    * renamed 'examples' to what it is more: 'extras'
2012-07-21 17:10:27 +00:00

65 lines
1.7 KiB
Plaintext

/*
* $Id$
*/
/*
index file properties .....
*/
#include "sixapi.ch"
#include "simpleio.ch"
PROCEDURE MAIN()
LOCAL cFile := "sixtest.dbf"
LOCAL aStruct := { { "MYCHAR","C",10,0 }, { "MYDATE","D",8,0 }, { "MYNUM","N",8,0 }, { "MYLOGIC","L",1,0 } }
LOCAL j, n := seconds(), nArea
LOCAL nOrd
SET CENTURY ON
SET DATE ANSI
IF FILE( "sixtest.nsx" )
FERASE( "sixtest.nsx" )
ENDIF
CREATE DBF cFile STRUCT aStruct RDD SDENSX
USE cFile ALIAS MYALIAS RDD SDENSX VAR nArea EXCLUSIVE
? "------------------------------------------------------"
? "Test Appending 10,000 Blank Records and Creating Index"
? "------------------------------------------------------"
? "Area : ", nArea
? "RDD : " + sx_rddDriver( nArea )
? "Start : ", n
FOR j := 1 TO 10000
APPEND BLANK
FieldPut( MYCHAR, "NAME_" + PADL( j, 5, "0" ) )
FieldPut( MYDATE, date() + j )
FieldPut( MYNUM, j )
FieldPut( MYLOGIC, j % 2 == 0 )
NEXT
COMMIT
?
? 'INDEX ON UPPER(MYCHAR) TO SIXTEST FOR MYNUM > 5000'
?
INDEX ON UPPER( MYCHAR ) TO SIXTEST FOR MYNUM > 5000
? "End : ", seconds()
? "Time : ", seconds() - n, "Quick enough ?"
?
? 'sx_IndexCondition() = ', sx_IndexCondition()
? 'sx_IndexKey() = ', sx_IndexKey()
? 'sx_IndexKeyField() = ', sx_IndexKeyField()
? 'nOrd := sx_IndexOrd() = ', nOrd := sx_IndexOrd()
? 'sx_IndexName( nOrd ) = ', sx_IndexName( nOrd )
? 'sx_IndexType() = ', sx_IndexType()
?
? 'sx_IndexType() returns one of the followings:'
? 'INDEX_STANDARD 1'
? 'INDEX_STANDARD_UNIQUE 2'
? 'INDEX_CONDITIONAL 3'
? 'INDEX_CONDITIONAL_UNIQUE 4'