How to rlock 2 records ? 
Author Message
 How to rlock 2 records ?

Hi,

Is it possible for an user to rlock 2 different records in the same dbf ?

I explain : In a function that fix duplicated customers (fusion), I need to
rlock the records of both customers during the time I modify the related
records in the others dbfs (sales, etc...)
Then I delete the 2nd record

But one rlock() unlocks the former locked record
The only solutions I've seen are :
1) flock() custom.dbf (VERY radical !!)
2) delete the 2nd customer BEFORE the update of the related dbfs (ugly and
dangerous : in case of crash, I loose the access at this customer, and have
orphean records in the related dbfs)

Does anybody has better ideas ?

Thanx

--
Sebas,
Alvicerto, Lda



Mon, 11 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?
If you use the SIx RDD, it allows multiple concurrent record locking with
the sx_RLock() function.  You pass it an array of record numbers and it will
attempt to lock all of them.  The default Clipper RDD does not have this
functionality.

Regards,
Dave Holden
Holden Consulting, Abbotsford, BC, Canada


Quote:
> Hi,

> Is it possible for an user to rlock 2 different records in the same dbf ?

> I explain : In a function that fix duplicated customers (fusion), I need
to
> rlock the records of both customers during the time I modify the related
> records in the others dbfs (sales, etc...)
> Then I delete the 2nd record

> But one rlock() unlocks the former locked record
> The only solutions I've seen are :
> 1) flock() custom.dbf (VERY radical !!)
> 2) delete the 2nd customer BEFORE the update of the related dbfs (ugly and
> dangerous : in case of crash, I loose the access at this customer, and
have
> orphean records in the related dbfs)

> Does anybody has better ideas ?

> Thanx

> --
> Sebas,
> Alvicerto, Lda




Mon, 11 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?

Quote:

> Is it possible for an user to rlock 2 different records in the same dbf ?

If you have Clipper 5.3, you can use DBRLOCK( nRecNo ), which allows to
lock a range of records (additive) and DBRUNLOCK( nRecNo ) which release
specified record lock.

Regards
--
Wojciech Moszko



Mon, 11 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?

Quote:

>Hi,

>Is it possible for an user to rlock 2 different records in the same dbf ?

>I explain : In a function that fix duplicated customers (fusion), I need to
>rlock the records of both customers during the time I modify the related
>records in the others dbfs (sales, etc...)
>Then I delete the 2nd record

>But one rlock() unlocks the former locked record
>The only solutions I've seen are :
>1) flock() custom.dbf (VERY radical !!)
>2) delete the 2nd customer BEFORE the update of the related dbfs (ugly and
>dangerous : in case of crash, I loose the access at this customer, and have
>orphean records in the related dbfs)

>Does anybody has better ideas ?

>Thanx

>--
>Sebas,
>Alvicerto, Lda


There is a DbRLock( recno ) function in Clipper 5.2 - check your ng. If you
do not specify recno
previous records locks are going to be released and current record will be
locked (like a standard rlock()).
For unlocking just one record of your multiply locked record list use
dBRUnlock( recno ).
DbRLockList() - returns array list of locked records for the selected table.

Regards,
Dusan Simic

Project Manager
Data Technology Software Integration Ltd.
120 Eglinton Ave. E., Suite 300
Toronto, ON., M4P 1E2
Tel: 1.416.488.6151 Fax: 1-416-486-2169



Mon, 11 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?

Quote:
>Hi,

>Is it possible for an user to rlock 2 different records in the same dbf ?
>...

Hello Sebas

Yes (Clipper 5.x):

Build your own RecordLock UDF using the DBRLock( <nRecNo> ) function. This
function adds the <nRecNo> record to a "Lock List". Later you can inspect
this list with DBRLockList() and/or unlock either individual records by
using DBRUnlock( <nRecNo> ), or all records with DBUnlock().

HTH

Marcos Nogueira
S. Paulo - Brazil



Mon, 11 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?
DBRLOCK() ... off course ! How could I have missed that one !
It's exactly what I was needed, and even more, will resolve my FLOCKs : now
I will be able to lock only the concerned part of a file, not the whole
file !

Many thanks to Marcos, Wojciech and Dusan !
--
Sebas,
Alvicerto, Lda



Tue, 12 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?
I understand that you have a solution now.

The way who I did this, was to open the file a second time with a differend
alias and to lock one record there, one there. This even saved me the efford
of caching the fields :-)


Quote:
>Hi,

>Is it possible for an user to rlock 2 different records in the same dbf ?

>I explain : In a function that fix duplicated customers (fusion), I need to
>rlock the records of both customers during the time I modify the related
>records in the others dbfs (sales, etc...)
>Then I delete the 2nd record

>But one rlock() unlocks the former locked record
>The only solutions I've seen are :
>1) flock() custom.dbf (VERY radical !!)
>2) delete the 2nd customer BEFORE the update of the related dbfs (ugly and
>dangerous : in case of crash, I loose the access at this customer, and have
>orphean records in the related dbfs)

>Does anybody has better ideas ?

>Thanx

>--
>Sebas,
>Alvicerto, Lda




Tue, 12 Feb 2002 03:00:00 GMT  
 How to rlock 2 records ?



Quote:
> I understand that you have a solution now.

> The way who I did this, was to open the file a second time with a
differend
> alias and to lock one record there, one there. This even saved me the
efford
> of caching the fields :-)

Good idea too. But I prefere dbrlock(), because it's generic (and more
elegant too) : you can lock 10 records in payment.dbf (for example) for one
customer. I'm modifying my apps to avoid flock() in those cases.

Thanks.
--
Sebas,
Alvicerto, Lda



Thu, 14 Feb 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. How many RLock()s per file under S'87

2. multiple Rlocks()

3. Different offsets for rlock in comix vs. six3

4. Any problems using multiple RLOCK()'s?

5. Data corruption from failed rlock()

6. RLOCK() Problem Win95/NetWare 3.12

7. Rlock() wonder..

8. Crystal Reports and Rlocks CA-clipper

9. RLock() on Netware over NT Gateway

10. Rlock Error !

11. Rlock()

12. rlock() and dbunlock() in Replaceing DBF

 

 
Powered by phpBB® Forum Software