The program that our campany sells has been a single user app since the day
it began. It is now becoming a multi-user app. I am still new to FoxPro
and I have to start adding some record locking. I had a few questions I was
hoping someone could help with.
Does the table or record I want to lock have to be in the data session?

Is there a time limit I can set on a record/table lock?

What if I forget some code to unlock the record, will it unlock when the
program closes? or if the program errors while I have a lock will that lock
be released?


TIA
Altman

Record locking by Mike

Mike
Mon Nov 03 11:12:24 CST 2003

Hi, I was/am in the same position that your in.

1. Record locks release after to close the problem.
2. Keep in mind that Zaps and Packs cannot be used in a
shared mode.
3. One piece of advice, DON'T FORGET TO CODE IN YOUR
UNLOCK STATEMENTS, Period, trust me.

4. There is no time limit on record locks, providing your
server / workstation can keep the connection live.

>-----Original Message-----
>The program that our campany sells has been a single user
app since the day
>it began. It is now becoming a multi-user app. I am
still new to FoxPro
>and I have to start adding some record locking. I had a
few questions I was
>hoping someone could help with.
>Does the table or record I want to lock have to be in the
data session?
>
>Is there a time limit I can set on a record/table lock?
>
>What if I forget some code to unlock the record, will it
unlock when the
>program closes? or if the program errors while I have a
lock will that lock
>be released?
>
>
>TIA
>Altman
>
>
>.
>

Re: Record locking by Nick

Nick
Mon Nov 03 17:08:13 CST 2003

Hi Altman

> Does the table or record I want to lock have to be in the data session?

Yes

> Is there a time limit I can set on a record/table lock?

No

> What if I forget some code to unlock the record, will it unlock when the
> program closes? or if the program errors while I have a lock will that lock
> be released?

It will unlock when you close the table. However, better to issue an UNLOCK
(either IN <tablename> or ALL) at the end of your "Save" or "Undo" methods.

Just another point, when I call my "Edit" or "Delete" methods, I usually check
if the record (in a parent/child case, only the parent record) is able to be
locked. If not, I inform the user that the current record is being maintained by
another user.

HTH

Nick


Re: Record locking by Stefan

Stefan
Tue Nov 04 03:53:24 CST 2003

> and I have to start adding some record locking.

You can also let Vfp do the locking automatically.
See also "Buffering Data" in help. No code required usually,
except maybe Set Exclusive Off at the beginning of "main.prg"
and/or Open Database your.dbc Shared before the first form
runs.
The multi-user conflict handling then could be to check if
TableUpdate() returns .F. occasionally.
The code of the form wizard's classes contains an example.


-Stefan

"Altman" <NotGiven@SickOfSpam.com> schrieb im Newsbeitrag
news:eeoSKghoDHA.648@TK2MSFTNGP11.phx.gbl...
> The program that our campany sells has been a single user app since the
day
> it began. It is now becoming a multi-user app. I am still new to FoxPro
> and I have to start adding some record locking. I had a few questions I
was
> hoping someone could help with.
> Does the table or record I want to lock have to be in the data session?
>
> Is there a time limit I can set on a record/table lock?
>
> What if I forget some code to unlock the record, will it unlock when the
> program closes? or if the program errors while I have a lock will that
lock
> be released?
>
>
> TIA
> Altman
>
>


Re: Record locking by Tony

Tony
Tue Nov 04 15:32:48 CST 2003

Stefan is on the correct track.
I have a lot of network users using programs that I have sent out and
I just let VFP take care of the locking. You will go nuts trying to
lock and unlock each file when VFP will not let anyone else access the
same record that anyone else is using. The only time I lock a record
is when I use a field as a counter and want to insure the count is
correct so that more than one person cannot use the field before the
counter is updated. I also use the exclusive open when I need to work
on a file to pack it or update it.
Tony

"Stefan Wuebbe" <stefan.wuebbe@gmx.de> wrote in message
news:bo7t0h$19p994$3@ID-13445.news.uni-berlin.de...
> and I have to start adding some record locking.

You can also let Vfp do the locking automatically.
See also "Buffering Data" in help. No code required usually,
except maybe Set Exclusive Off at the beginning of "main.prg"
and/or Open Database your.dbc Shared before the first form
runs.
The multi-user conflict handling then could be to check if
TableUpdate() returns .F. occasionally.
The code of the form wizard's classes contains an example.


-Stefan

"Altman" <NotGiven@SickOfSpam.com> schrieb im Newsbeitrag
news:eeoSKghoDHA.648@TK2MSFTNGP11.phx.gbl...
> The program that our campany sells has been a single user app since
the
day
> it began. It is now becoming a multi-user app. I am still new to
FoxPro
> and I have to start adding some record locking. I had a few
questions I
was
> hoping someone could help with.
> Does the table or record I want to lock have to be in the data
session?
>
> Is there a time limit I can set on a record/table lock?
>
> What if I forget some code to unlock the record, will it unlock when
the
> program closes? or if the program errors while I have a lock will
that
lock
> be released?
>
>
> TIA
> Altman
>
>