Files
harbour-core/harbour/tests/aliaslck.prg
Viktor Szakats 06fe543d39 2012-10-12 11:16 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbgd/gdbarcod.prg
    % AllTrim() removed from around Str( n, 1 )
    * TOFIX? added to gdbarcod.prg in one place where
      Str( n, 1 ) is used and the value can be 10.
    ; Francesco, can you look at it?

  * contrib/gtwvg/tests/dyndlgs.prg
  * extras/hbxlsxml/tests/example.prg
  * tests/ac_test.prg
  * tests/aliaslck.prg
  * tests/gtstdtst.prg
  * tests/rto_get.prg
  * tests/rto_tb.prg
  * tests/teststr.prg
    * *LTRIM(STR()) -> hb_ntos()
      including cases where a size limit was used, but
      it was unnecessary.
      #define added for Clipper where needed.

  * contrib/hbnf/ntow.prg
    % LTrim( Str( n, 0 ) ) -> hb_ntos()
      zero is currected to 10 by runtime.
      Plus minor opt.

  * contrib/hbnf/acctmnth.prg
  * contrib/hbnf/acctqtr.prg
  * contrib/hbnf/acctweek.prg
  * contrib/hbnf/dayofyr.prg
  * contrib/hbnf/month.prg
  * contrib/hbnf/qtr.prg
  * contrib/hbnf/week.prg
    % PAD(*TRIM(STR()),,"0") -> StrZero()

  * extras/hbxlsxml/xlsxml_s.prg
  * extras/hbxlsxml/xlsxml_y.prg
  * extras/hbxlsxml/xlsxml.prg
  * website/samples/dates3.prg.html
  * website/samples/dates4.prg.html
  * website/samples/testcgi.prg.html
  * website/samples/testhtml.prg.html
    * hb_osnewline() -> hb_eol()
2012-10-12 09:27:09 +00:00

116 lines
2.1 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* demonstration/test code for file lock synchronization between
* aliased work areas
*
* Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://harbour-project.org
*
*/
proc main()
local cFile := "_tst"
if !dbExists( cFile )
dbCreate( cFile, { { "F", "C", 10, 0 } } )
use _tst exclusive
while lastRec() < 100
dbAppend()
enddo
close
endif
? "Test exclusive access"
select 1
use _tst exclusive alias tst1
? "neterr->", netErr(), "used->", used(), "alias->", alias()
select 2
use _tst exclusive alias tst2
? "neterr->", netErr(), "used->", used(), "alias->", alias()
if used()
? "Error, exclusive mode in aliased work areas does not work"
else
? "OK"
endif
dbCloseAll()
wait
?
? "Test shared access"
select 1
use _tst shared alias tst1
? "neterr->", netErr(), "used->", used(), "alias->", alias()
setLock(2)
setLock(4)
setLock(6)
setLock(7)
dspLock()
select 2
use _tst shared alias tst2
? "neterr->", netErr(), "used->", used(), "alias->", alias()
setLock(1)
setLock(2)
setLock(3)
setLock(4)
setLock(5)
setLock(6)
setLock(7)
setLock(8)
setLock(9)
dspLock()
wait
?
select 1
? "unlock all in", alias()
dbUnLock()
dspLock()
select 2
? "lock 10 records in", alias()
setLock(1)
setLock(2)
setLock(3)
setLock(4)
setLock(5)
setLock(6)
setLock(7)
setLock(8)
setLock(9)
dspLock()
wait
?
? "unlock 3, 5, 9 in", alias()
dbRUnLock(3)
dbRUnLock(5)
dbRUnLock(9)
dspLock()
select 1
? "lock 10 records in", alias()
setLock(1)
setLock(2)
setLock(3)
setLock(4)
setLock(5)
setLock(6)
setLock(7)
setLock(8)
setLock(9)
dspLock()
wait
dbCloseAll()
hb_dbDrop( cFile )
return
proc setLock( n )
? "locking record: " + hb_ntos( n ) + " ->", dbRLock( n )
return
proc dspLock()
local n
? alias(), "active locks:"
for each n in dbRLockList()
?? "", hb_ntos( n )
next
return