harbour lock function

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

harbour lock function

Post by l3whmg »

Hello to everyone.
I need your help to better understand the operating principle of the LOCK function.

I found that, within the same process or within the same thread of execution
of a program, LOCK does not seem to work well when I perform LOCK, on then same record, more than one time: the record is always LOCKED. If I run the program more than once, the LOCK works well.

Example.
Case 1 - process A function 1 LOCK a record; process B function 1 try to lock the same record, but fails: proper operation
Case 2 - process A function 1 LOCK a record; process A function 2 try and lock the same record: malfunction

I enclose a simple program to test.
- Run the program twice separately and act only on the first button: good operation (Case 1)
- Run the program once and act on the two buttons: operating doubt (Case 2)

I believe that the need to lock the same record (for different reasons or functions) within the same process, is an event not to be overlooked.
It 's just my problem or misunderstanding or should be reported to the developers of Harbour compiler?

Many thanks to everyone.
Best regards
Attachments
testlock.zip
source tester
(1.56 KiB) Downloaded 271 times
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Harbour Lock function

Post by l3whmg »

Hi guys,
is there someone can help me about this ?

Many thanks in advantage.
Luigi from Italy
www.L3W.it
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: harbour lock function

Post by Rathinagiri »

Hi Luigi,

I am not well versed with LOCK functionality.

Hope Esgici or others help you.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: harbour lock function

Post by esgici »

Hi Luigi

Sorry for delay :(

My last days past with some hardware (and sofware) and health problems. Moreover your .zip file doesn't contain .dbf file to test. Afterward I'm noticed it builds their own table, so I'm here :)

Dear Luigi

Your expectation seem reasonable. But I'm thinking that "re-locking" a record already locked doesn't have any problem. Even may be useful under some circumstance. Importance is ACCESS, others than have posed lock, must can't access a locked record.

And this others also important; other users, other applications etc. Does other procedure / module in the same application included restricted things? IMHO no, you may lock a record in one procedure and edit it in other one.

In summary, IMHO the behavior of our compiler is reasonable and correct.

I hope that this explanations will help you.

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: harbour lock function

Post by Rathinagiri »

Thanks for the explanation Esgici and I pray for your well being.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: harbour lock function

Post by l3whmg »

Hi Esgici,
many thanks for your replay, I understand what did you write and I are in (general) agreement with you.
Is a fact that I realized a few days ago, being able to operate with more forms in a program written with HMG.

The case involved a table containing the progress to assign: while maintaining the record locked in a form, I could assign a new number (other table) unless the record is locked. This situation has me a little :o especially thinking about solution much more complex than mine ;) .

Of course that the same user lock a "progress", which will use in other applications, is an unusual case.

Any way, thank you very much again for your invaluable help.

Best Regards.
Luigi from Italy
www.L3W.it
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: harbour lock function

Post by esgici »

Thanks Rathi; we always need prays of our friends.

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: harbour lock function

Post by esgici »

Hi Luigi

What happy times was that DOS days, DOS and Nowell days ;)

For testing a multiuser application we have need a real network; more than one PC, ethernet cards, hubs, routers, cabling etc ...

Now its very simple : run more than one instance of your program and test whatever you want.

Did you tried your TestLock by this way?

I did, and IMHO it run exactly what you expect.

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: harbour lock function

Post by l3whmg »

Hi Esgici,
of course :)
I've tested this program with my little LAN and (on the same PC) I run the program more than one instance: It's work fine like I expected :D
What happy times was that DOS days, DOS and Nowell days
Yes :mrgreen:

What do you thing about the famous Plug&Play or MsWin .dll and register (installed, update, reinstalled, reupdate and deleted....and so on by every program you want use) ?

But behind all of this there are programmers (human) :lol:
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: harbour lock function

Post by l3whmg »

Hi Esgici,
I'm sorry for my ignorance :oops: But why is not there a "DataBase" based upon dbf technique?
We have MySql, PostGreSql, etc. Why Not?

Best regards
Luigi from Italy
www.L3W.it
Post Reply