List Info

Thread: Using the TTable Edit Error Event




Using the TTable Edit Error Event
user name
2006-04-26 21:06:52

Your post does help me organize my thoughts.  If I understand you
correctly, you don't use Dbaware components but when a user clicks a
button you fetch the data and fill the form with it or Post the changes
to the record.  What code do you use to determine if a record is locked
for editing?

What I am looking for is an example or two on how to handle deadlocks or
other kinds of locks on a record.

Tom Nesler

Live long!...   Code Well!...   and Prosper!...   V


-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
Behalf Of jangita
Sent: Wednesday, April 26, 2006 3:50 PM
To: delphi-en@yahoogroups.com
Subject: Re: [delphi-en] Using the TTable Edit Error Event


Hello

I have done quite a bit of multi user client server programming and the
following is a method i have found that works best

1. when the user wants a list of items; i call a select stored procedure

which returns the information; this is stored in a normal query
component
2. i *never* use data aware components; when the user clicks edit i fill
the
components manualy with what has come from the database.
3. when the user clicks save, i call another stored procedure which
updates
the specified record

This avoids me having to keep any record in "edit" mode at all, leaving
other users able to browse and modify such records. To make it more
effecient ud probaby only update the field that has been changed, but
that's
another story.

Hope any of this is relevant...

J
----- Original Message -----
From: "Nesler, Thomas J" <tnesleramfam.com&gt;
To: <delphi-en@yahoogroups.com>;
Sent: Wednesday, April 26, 2006 7:15 PM
Subject: RE: [delphi-en] Using the TTable Edit Error Event


> Hi Bob!
>
> I am using NexusDb version 1.08 and it does give me an error when a
> record is locked.&nbsp; Unfortunately it does not resolve the conflict by
> preventing the second user from editing the record.&nbsp; Which means that
> the first user can't exit the record and post because the second user
is
> still editing the record.
&gt;
> I am guessing that this is a problem that is tied to the Blob Memo
that
> the user is trying to edit. ; Since Blob memos are handled differently
> than regular records, I am thinking that is why I am getting these
ugly
> error messages.
>
> What do you suggest?
>
> Tom Nesler
&gt;
>
&gt; -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
> Behalf Of j.meierjmeiersoftware.de
&gt; Sent: Wednesday, April 26, 2006 11:00 AM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
&gt; Hi Thomas,
&gt; as usual "it depends&quot;.
> Which Database do you use? A "normal" SQL Client / Server RDB (as
> Firebird or Interbase) is able to handle that automatically.
> So, which Delphi version and which DB you are talking about.
&gt;
> Have fun
> Bob
>
>
>>
>&gt; &nbsp; &nbsp; I am working on a multiuser application.  One of my problems is
> record
&gt;> ; &nbsp;  locking, specifically when one user is editing a blob field and
> another
&gt;>&nbsp; &nbsp;  is editing the same record.
&gt;>
&gt;> ; &nbsp;  I am guessing that I need to put some code in the Edit error
event
> but
>&gt; &nbsp; &nbsp; there is no example in the Delphi help file so I can only guess
>; how to
>&gt; &nbsp; &nbsp; use it correctly.
>>
>>&nbsp; &nbsp;  Can some one give me an example on how to trap a record locking
&gt; error
>;>   ;  using this event?&nbsp; Also what do you recommend for help in
> understanding
>&gt; &nbsp; &nbsp; the complexities of multiuser databases?
>>
>>&nbsp; &nbsp;  Thanks in advance!
>>
&gt;>&nbsp; &nbsp;  Tom Nesler
&gt;> ; &nbsp;  Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;
>>
>>&nbsp;   ; [Non-text portions of this message have been removed]
>>
&gt;>
&gt;>
>;>   ;  -----------------------------------------------------
>>&nbsp; &nbsp;  Home page: http://groups.yahoo.com/group/delphi-en/
>>&nbsp; &nbsp;  To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> &nbsp;   Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>
>;
>
&gt; -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links





Using the TTable Edit Error Event
user name
2006-04-27 03:12:51


-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On Behalf
Of Nesler, Thomas J
Sent: 26 April 2006 22:07
To: delphi-en@yahoogroups.com
Subject: RE: [delphi-en] Using the TTable Edit Error Event

Hi Jangita!

Your post does help me organize my thoughts.&nbsp; If I understand you
correctly, you don't use Dbaware components but when a user clicks a
button you fetch the data and fill the form with it or Post the changes
to the record.&nbsp; What code do you use to determine if a record is locked
for editing?

What I am looking for is an example or two on how to handle deadlocks or
other kinds of locks on a record.

Tom Nesler

Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V


-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
Behalf Of jangita
Sent: Wednesday, April 26, 2006 3:50 PM
To: delphi-en@yahoogroups.com
Subject: Re: [delphi-en] Using the TTable Edit Error Event


Hello

I have done quite a bit of multi user client server programming and the
following is a method i have found that works best

1. when the user wants a list of items; i call a select stored procedure

which returns the information; this is stored in a normal query
component
2. i *never* use data aware components; when the user clicks edit i fill
the
components manualy with what has come from the database.
3. when the user clicks save, i call another stored procedure which
updates
the specified record

This avoids me having to keep any record in "edit" mode at all, leaving
other users able to browse and modify such records. To make it more
effecient ud probaby only update the field that has been changed, but
that's
another story.

Hope any of this is relevant...

J
----- Original Message -----
From: "Nesler, Thomas J" <tnesleramfam.com&gt;
To: <delphi-en@yahoogroups.com>;
Sent: Wednesday, April 26, 2006 7:15 PM
Subject: RE: [delphi-en] Using the TTable Edit Error Event


> Hi Bob!
>
> I am using NexusDb version 1.08 and it does give me an error when a
> record is locked.&nbsp; Unfortunately it does not resolve the conflict by
> preventing the second user from editing the record.&nbsp; Which means that
> the first user can't exit the record and post because the second user
is
> still editing the record.
&gt;
> I am guessing that this is a problem that is tied to the Blob Memo
that
> the user is trying to edit. ; Since Blob memos are handled differently
> than regular records, I am thinking that is why I am getting these
ugly
> error messages.
>
> What do you suggest?
>
> Tom Nesler
&gt;
>
&gt; -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
> Behalf Of j.meierjmeiersoftware.de
&gt; Sent: Wednesday, April 26, 2006 11:00 AM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
&gt; Hi Thomas,
&gt; as usual "it depends&quot;.
> Which Database do you use? A "normal" SQL Client / Server RDB (as
> Firebird or Interbase) is able to handle that automatically.
> So, which Delphi version and which DB you are talking about.
&gt;
> Have fun
> Bob
>
>
>>
>&gt; &nbsp; &nbsp; I am working on a multiuser application.  One of my problems is
> record
&gt;> ; &nbsp;  locking, specifically when one user is editing a blob field and
> another
&gt;>&nbsp; &nbsp;  is editing the same record.
&gt;>
&gt;> ; &nbsp;  I am guessing that I need to put some code in the Edit error
event
> but
>&gt; &nbsp; &nbsp; there is no example in the Delphi help file so I can only guess
>; how to
>&gt; &nbsp; &nbsp; use it correctly.
>>
>>&nbsp; &nbsp;  Can some one give me an example on how to trap a record locking
&gt; error
>;>   ;  using this event?&nbsp; Also what do you recommend for help in
> understanding
>&gt; &nbsp; &nbsp; the complexities of multiuser databases?
>>
>>&nbsp; &nbsp;  Thanks in advance!
>>
&gt;>&nbsp; &nbsp;  Tom Nesler
&gt;> ; &nbsp;  Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;
>>
>>&nbsp;   ; [Non-text portions of this message have been removed]
>>
&gt;>
&gt;>
>;>   ;  -----------------------------------------------------
>>&nbsp; &nbsp;  Home page: http://groups.yahoo.com/group/delphi-en/
>>&nbsp; &nbsp;  To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> &nbsp;   Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>
>;
>
&gt; -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links







-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links






Using the TTable Edit Error Event
user name
2006-04-27 10:57:00

Using this method; you *rearly* get record lock errors because as the
user is editing the record on his form the actual database record is not
  actually locked; because i've pulled the data from the record using a
select and thrown it into my editing components.

On the instant when the user clicks the post button is where everything
happens; for mission critical applications i change the tag of each edit
control when the data is changed so i know exactly which fields to post
into the database - this prevents one user changing then another user's
data overwriting it.

A simple way would be to do your own locking; adding a fiend called
edit_stat which is normally 0 but changes to 1 when a user is editing
the record. When another user hits edit and the field is 1 it could deny
editing to avoid a deadlock.

I have totally zero experience with nexusdb so its kind of a problem
coming up with a solution. Any url?

J

Nesler, Thomas J wrote:
&gt; Hi Jangita!
>
> Your post does help me organize my thoughts.&nbsp; If I understand you
> correctly, you don't use Dbaware components but when a user clicks a
> button you fetch the data and fill the form with it or Post the changes
&gt; to the record.&nbsp; What code do you use to determine if a record is locked
&gt; for editing?
>
> What I am looking for is an example or two on how to handle deadlocks or
> other kinds of locks on a record.
&gt;
> Tom Nesler
&gt;
> Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>
>
> -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
> Behalf Of jangita
&gt; Sent: Wednesday, April 26, 2006 3:50 PM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
> Hello
>;
> I have done quite a bit of multi user client server programming and the
> following is a method i have found that works best
>
> 1. when the user wants a list of items; i call a select stored procedure
>
> which returns the information; this is stored in a normal query
>; component
> 2. i *never* use data aware components; when the user clicks edit i fill
> the
> components manualy with what has come from the database.
> 3. when the user clicks save, i call another stored procedure which
>; updates
> the specified record
&gt;
> This avoids me having to keep any record in "edit" mode at all, leaving
> other users able to browse and modify such records. To make it more
> effecient ud probaby only update the field that has been changed, but
> that's
> another story.
&gt;
> Hope any of this is relevant...
>
> J
> ----- Original Message -----
> From: "Nesler, Thomas J" <tnesleramfam.com&gt;
> To: <delphi-en@yahoogroups.com>;
> Sent: Wednesday, April 26, 2006 7:15 PM
> Subject: RE: [delphi-en] Using the TTable Edit Error Event
>;
>
>> Hi Bob!
>>
>&gt; I am using NexusDb version 1.08 and it does give me an error when a
>>; record is locked.&nbsp; Unfortunately it does not resolve the conflict by
>&gt; preventing the second user from editing the record.&nbsp; Which means that
>> the first user can't exit the record and post because the second user
> is
>&gt; still editing the record.
&gt;>
&gt;> I am guessing that this is a problem that is tied to the Blob Memo
> that
>> the user is trying to edit. ; Since Blob memos are handled differently
>> than regular records, I am thinking that is why I am getting these
>; ugly
>> error messages.
>>
>> What do you suggest?
>>
&gt;> Tom Nesler
&gt;>
>;>
>> -----Original Message-----
>>; From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt; Behalf Of j.meierjmeiersoftware.de
&gt;> Sent: Wednesday, April 26, 2006 11:00 AM
>&gt; To: delphi-en@yahoogroups.com
>&gt; Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt; Hi Thomas,
&gt;> as usual "it depends&quot;.
>&gt; Which Database do you use? A "normal" SQL Client / Server RDB (as
>&gt; Firebird or Interbase) is able to handle that automatically.
>&gt; So, which Delphi version and which DB you are talking about.
&gt;>
>;> Have fun
>&gt; Bob
>&gt;
>&gt;
>>;>   ;  I am working on a multiuser application.  One of my problems is
>&gt; record
&gt;>>&nbsp;   ; locking, specifically when one user is editing a blob field and
>&gt; another
&gt;>>  ; &nbsp; is editing the same record.
&gt;>>
>>&gt; &nbsp; &nbsp; I am guessing that I need to put some code in the Edit error
>; event
>;> but
>&gt;>&nbsp; &nbsp;  there is no example in the Delphi help file so I can only guess
>;> how to
>&gt;> ; &nbsp;  use it correctly.
>>&gt;
>&gt;> ; &nbsp;  Can some one give me an example on how to trap a record locking
&gt;> error
>;>>&nbsp; &nbsp;  using this event?&nbsp; Also what do you recommend for help in
>&gt; understanding
>&gt;> ; &nbsp;  the complexities of multiuser databases?
>>&gt;
>&gt;> ; &nbsp;  Thanks in advance!
>>>;
>>> &nbsp;   Tom Nesler
&gt;>>&nbsp;   ; Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;>
>>>
&gt;>>  ; &nbsp; [Non-text portions of this message have been removed]
>>>;
>>>
>&gt;>
&gt;>>&nbsp;   ; -----------------------------------------------------
>>&gt; &nbsp; &nbsp; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; &nbsp; &nbsp; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>>&nbsp; &nbsp;  Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
>
>&nbsp;
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
>
>&nbsp;
>
>
>
Using the TTable Edit Error Event
user name
2006-04-27 12:44:58

no really need to lock a record just because the user has started inputing
data, which may take couple of seconds or 15 minutes until he clicks OK or
Cancel... As he suggested, fetch the data, let your application offer the
possibility to the user to modify this data and once clicked on OK do the
updating job using stored procedures.

marking the modified fields is even a better and more solid solution but
need a good maintenance. For example 2 users on 2 different machines
modifying the same record will have the following statements executed

User 1:
Update clients
set Phone = 12312312
where clientID = '100'

User 2:
Update clients
Set Mobile = 3452354
where ClientID = '100'

This way you will know that only one field is overriden and not the whole
record



-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com]On Behalf
Of Jangita
Sent: Thursday, April 27, 2006 12:57 PM
To: delphi-en@yahoogroups.com
Subject: Re: [delphi-en] Using the TTable Edit Error Event


Hello Tom,

Using this method; you *rearly* get record lock errors because as the
user is editing the record on his form the actual database record is not
 ; actually locked; because i've pulled the data from the record using a
select and thrown it into my editing components.

On the instant when the user clicks the post button is where everything
happens; for mission critical applications i change the tag of each edit
control when the data is changed so i know exactly which fields to post
into the database - this prevents one user changing then another user's
data overwriting it.

A simple way would be to do your own locking; adding a fiend called
edit_stat which is normally 0 but changes to 1 when a user is editing
the record. When another user hits edit and the field is 1 it could deny
editing to avoid a deadlock.

I have totally zero experience with nexusdb so its kind of a problem
coming up with a solution. Any url?

J

Nesler, Thomas J wrote:
&gt; Hi Jangita!
>
> Your post does help me organize my thoughts.&nbsp; If I understand you
> correctly, you don't use Dbaware components but when a user clicks a
> button you fetch the data and fill the form with it or Post the changes
&gt; to the record.&nbsp; What code do you use to determine if a record is locked
&gt; for editing?
>
> What I am looking for is an example or two on how to handle deadlocks or
> other kinds of locks on a record.
&gt;
> Tom Nesler
&gt;
> Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>
&gt;
> -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
> Behalf Of jangita
&gt; Sent: Wednesday, April 26, 2006 3:50 PM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
&gt; Hello
>;
> I have done quite a bit of multi user client server programming and the
> following is a method i have found that works best
>
> 1. when the user wants a list of items; i call a select stored procedure
>
> which returns the information; this is stored in a normal query
>; component
> 2. i *never* use data aware components; when the user clicks edit i fill
> the
> components manualy with what has come from the database.
> 3. when the user clicks save, i call another stored procedure which
>; updates
&gt; the specified record
&gt;
> This avoids me having to keep any record in "edit" mode at all, leaving
&gt; other users able to browse and modify such records. To make it more
> effecient ud probaby only update the field that has been changed, but
> that's
&gt; another story.
&gt;
> Hope any of this is relevant...
>
&gt; J
> ----- Original Message -----
>; From: "Nesler, Thomas J" <tnesleramfam.com&gt;
> To: <delphi-en@yahoogroups.com>;
> Sent: Wednesday, April 26, 2006 7:15 PM
> Subject: RE: [delphi-en] Using the TTable Edit Error Event
>;
>
&gt;> Hi Bob!
>>
>&gt; I am using NexusDb version 1.08 and it does give me an error when a
>>; record is locked.&nbsp; Unfortunately it does not resolve the conflict by
>&gt; preventing the second user from editing the record.&nbsp; Which means that
>> the first user can't exit the record and post because the second user
> is
>&gt; still editing the record.
&gt;>
&gt;> I am guessing that this is a problem that is tied to the Blob Memo
> that
>> the user is trying to edit. ; Since Blob memos are handled differently
>> than regular records, I am thinking that is why I am getting these
>; ugly
>> error messages.
>>
>> What do you suggest?
>>
&gt;> Tom Nesler
&gt;>
>;>
>> -----Original Message-----
>>; From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt; Behalf Of j.meierjmeiersoftware.de
&gt;> Sent: Wednesday, April 26, 2006 11:00 AM
>&gt; To: delphi-en@yahoogroups.com
>&gt; Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt; Hi Thomas,
&gt;> as usual "it depends&quot;.
>&gt; Which Database do you use? A "normal" SQL Client / Server RDB (as
>&gt; Firebird or Interbase) is able to handle that automatically.
>&gt; So, which Delphi version and which DB you are talking about.
&gt;>
>;> Have fun
>&gt; Bob
>&gt;
>&gt;
>>;>   ;  I am working on a multiuser application.  One of my problems is
>&gt; record
&gt;>>&nbsp;   ; locking, specifically when one user is editing a blob field and
>&gt; another
&gt;>>  ; &nbsp; is editing the same record.
&gt;>>
>>&gt; &nbsp; &nbsp; I am guessing that I need to put some code in the Edit error
>; event
>;> but
>&gt;>&nbsp; &nbsp;  there is no example in the Delphi help file so I can only guess
>;> how to
>&gt;> ; &nbsp;  use it correctly.
>>&gt;
>&gt;> ; &nbsp;  Can some one give me an example on how to trap a record locking
&gt;> error
>;>>&nbsp; &nbsp;  using this event?&nbsp; Also what do you recommend for help in
>&gt; understanding
>&gt;> ; &nbsp;  the complexities of multiuser databases?
>>&gt;
>&gt;> ; &nbsp;  Thanks in advance!
>>>;
>>> &nbsp;   Tom Nesler
&gt;>>&nbsp;   ; Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;>
>>>
&gt;>>  ; &nbsp; [Non-text portions of this message have been removed]
>>>;
>>>
>&gt;>
&gt;>>&nbsp;   ; -----------------------------------------------------
>>&gt; &nbsp; &nbsp; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; &nbsp; &nbsp; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>>&nbsp; &nbsp;  Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>
>
>
>; -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links






Using the TTable Edit Error Event
user name
2006-04-27 12:53:36
people at the same time, most of who are very very slow typers; and its
a customer related application where a user opens the form and asks the
customer for questions as he or she types in the details; plus most
users are not computer literate

Problem is - a lot more code has to be written meaning more space for
bugs to creep in.

Vahan Yoghoudjian wrote:
&gt; I like Jangita's method
&gt;
> no really need to lock a record just because the user has started inputing
> data, which may take couple of seconds or 15 minutes until he clicks OK or
> Cancel... As he suggested, fetch the data, let your application offer the
> possibility to the user to modify this data and once clicked on OK do the
> updating job using stored procedures.
>
> marking the modified fields is even a better and more solid solution but
> need a good maintenance. For example 2 users on 2 different machines
> modifying the same record will have the following statements executed
>
> User 1:
> Update clients
&gt; set Phone = 12312312
> where clientID = '100'
>;
> User 2:
> Update clients
&gt; Set Mobile = 3452354
&gt; where ClientID = '100'
>;
> This way you will know that only one field is overriden and not the whole
>; record
&gt;
>
>
> -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com]On Behalf
&gt; Of Jangita
&gt; Sent: Thursday, April 27, 2006 12:57 PM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
> Hello Tom,
>
> Using this method; you *rearly* get record lock errors because as the
> user is editing the record on his form the actual database record is not
>&nbsp;  actually locked; because i've pulled the data from the record using a
> select and thrown it into my editing components.
>
> On the instant when the user clicks the post button is where everything
> happens; for mission critical applications i change the tag of each edit
> control when the data is changed so i know exactly which fields to post
> into the database - this prevents one user changing then another user's
&gt; data overwriting it.
>
> A simple way would be to do your own locking; adding a fiend called
&gt; edit_stat which is normally 0 but changes to 1 when a user is editing
&gt; the record. When another user hits edit and the field is 1 it could deny
> editing to avoid a deadlock.
>
> I have totally zero experience with nexusdb so its kind of a problem
&gt; coming up with a solution. Any url?
>
> J
>
> Nesler, Thomas J wrote:
&gt;> Hi Jangita!
>>
&gt;> Your post does help me organize my thoughts.&nbsp; If I understand you
>&gt; correctly, you don't use Dbaware components but when a user clicks a
>>; button you fetch the data and fill the form with it or Post the changes
&gt;> to the record.&nbsp; What code do you use to determine if a record is locked
&gt;> for editing?
>>
&gt;> What I am looking for is an example or two on how to handle deadlocks or
>&gt; other kinds of locks on a record.
&gt;>
&gt;> Tom Nesler
&gt;>
>;> Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;
>>
>> -----Original Message-----
>>; From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt; Behalf Of jangita
&gt;> Sent: Wednesday, April 26, 2006 3:50 PM
>&gt; To: delphi-en@yahoogroups.com
>&gt; Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt; Hello
>;>
>> I have done quite a bit of multi user client server programming and the
>&gt; following is a method i have found that works best
>>
>&gt; 1. when the user wants a list of items; i call a select stored procedure
>>
>> which returns the information; this is stored in a normal query
>;> component
>> 2. i *never* use data aware components; when the user clicks edit i fill
>> the
>&gt; components manualy with what has come from the database.
>> 3. when the user clicks save, i call another stored procedure which
>;> updates
&gt;> the specified record
&gt;>
>;> This avoids me having to keep any record in "edit" mode at all, leaving
&gt;> other users able to browse and modify such records. To make it more
>> effecient ud probaby only update the field that has been changed, but
>&gt; that's
&gt;> another story.
&gt;>
>;> Hope any of this is relevant...
>>
>> J
>>; ----- Original Message -----
>;> From: "Nesler, Thomas J" <tnesleramfam.com&gt;
>&gt; To: <delphi-en@yahoogroups.com>;
>> Sent: Wednesday, April 26, 2006 7:15 PM
>&gt; Subject: RE: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt;> Hi Bob!
>>>
&gt;>> I am using NexusDb version 1.08 and it does give me an error when a
>>;> record is locked.&nbsp; Unfortunately it does not resolve the conflict by
>&gt;> preventing the second user from editing the record.&nbsp; Which means that
>>> the first user can't exit the record and post because the second user
>> is
>&gt;> still editing the record.
&gt;>>
>>&gt; I am guessing that this is a problem that is tied to the Blob Memo
>> that
>>> the user is trying to edit. ; Since Blob memos are handled differently
>>> than regular records, I am thinking that is why I am getting these
>;> ugly
>>> error messages.
>>&gt;
>>;> What do you suggest?
>>>;
>>> Tom Nesler
&gt;>>
>>&gt;
>>;> -----Original Message-----
>>;> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt;> Behalf Of j.meierjmeiersoftware.de
&gt;>> Sent: Wednesday, April 26, 2006 11:00 AM
>&gt;> To: delphi-en@yahoogroups.com
>&gt;> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>>
>>>;
>>> Hi Thomas,
&gt;>> as usual "it depends&quot;.
>&gt;> Which Database do you use? A "normal" SQL Client / Server RDB (as
>&gt;> Firebird or Interbase) is able to handle that automatically.
>&gt;> So, which Delphi version and which DB you are talking about.
&gt;>>
>>&gt; Have fun
>&gt;> Bob
>&gt;>
&gt;>>
>>&gt;> ; &nbsp;  I am working on a multiuser application.  One of my problems is
>&gt;> record
&gt;>>&gt; &nbsp; &nbsp; locking, specifically when one user is editing a blob field and
>&gt;> another
&gt;>>> &nbsp;   is editing the same record.
&gt;>>>
>&gt;>>  ; &nbsp; I am guessing that I need to put some code in the Edit error
>;> event
>;>> but
>&gt;>>  ; &nbsp; there is no example in the Delphi help file so I can only guess
>;>> how to
>&gt;>>&nbsp;   ; use it correctly.
>>&gt;>
&gt;>>&gt; &nbsp; &nbsp; Can some one give me an example on how to trap a record locking
&gt;>> error
>;>>&gt; &nbsp; &nbsp; using this event?&nbsp; Also what do you recommend for help in
>&gt;> understanding
>&gt;>>&nbsp;   ; the complexities of multiuser databases?
>>&gt;>
&gt;>>&gt; &nbsp; &nbsp; Thanks in advance!
>>>;>
>>>>; &nbsp; &nbsp; Tom Nesler
&gt;>>&gt; &nbsp; &nbsp; Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;>>
>>>;>
>>>>; &nbsp; &nbsp; [Non-text portions of this message have been removed]
>>>;>
>>>>;
>>>>
&gt;>>> &nbsp;   -----------------------------------------------------
>>&gt;> ; &nbsp;  Home page: http://groups.yahoo.com/group/delphi-en/
>>>;>   ;  To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>>>; &nbsp; &nbsp; Yahoo! Groups Links
>;>>&gt;
>>;>>
>>>;>
>>>>;
>>>>
&gt;>>>
>&gt;>
&gt;>> -----------------------------------------------------
>>&gt; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>> Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;> -----------------------------------------------------
>>&gt; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>> Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;>
>>
>&gt;
>&gt; -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
>
>
>
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
>
>&nbsp;
>
>
>
Using the TTable Edit Error Event
user name
2006-04-27 14:10:32
people's job easier

-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com]On Behalf
Of Jangita
Sent: Thursday, April 27, 2006 2:54 PM
To: delphi-en@yahoogroups.com
Subject: Re: [delphi-en] Using the TTable Edit Error Event


It has always worked for me, i have an app being access by 300 (yes 300)
people at the same time, most of who are very very slow typers; and its
a customer related application where a user opens the form and asks the
customer for questions as he or she types in the details; plus most
users are not computer literate

Problem is - a lot more code has to be written meaning more space for
bugs to creep in.

Vahan Yoghoudjian wrote:
&gt; I like Jangita's method
&gt;
> no really need to lock a record just because the user has started inputing
> data, which may take couple of seconds or 15 minutes until he clicks OK or
> Cancel... As he suggested, fetch the data, let your application offer the
> possibility to the user to modify this data and once clicked on OK do the
> updating job using stored procedures.
>
&gt; marking the modified fields is even a better and more solid solution but
> need a good maintenance. For example 2 users on 2 different machines
> modifying the same record will have the following statements executed
>
> User 1:
> Update clients
&gt; set Phone = 12312312
> where clientID = '100'
>;
> User 2:
> Update clients
&gt; Set Mobile = 3452354
&gt; where ClientID = '100'
>;
> This way you will know that only one field is overriden and not the whole
>; record
&gt;
>
&gt;
> -----Original Message-----
> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com]On
Behalf
> Of Jangita
&gt; Sent: Thursday, April 27, 2006 12:57 PM
> To: delphi-en@yahoogroups.com
> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;
>
&gt; Hello Tom,
>
> Using this method; you *rearly* get record lock errors because as the
> user is editing the record on his form the actual database record is not
>&nbsp;  actually locked; because i've pulled the data from the record using a
> select and thrown it into my editing components.
>
&gt; On the instant when the user clicks the post button is where everything
> happens; for mission critical applications i change the tag of each edit
> control when the data is changed so i know exactly which fields to post
> into the database - this prevents one user changing then another user's
&gt; data overwriting it.
>
> A simple way would be to do your own locking; adding a fiend called
&gt; edit_stat which is normally 0 but changes to 1 when a user is editing
&gt; the record. When another user hits edit and the field is 1 it could deny
> editing to avoid a deadlock.
>
> I have totally zero experience with nexusdb so its kind of a problem
&gt; coming up with a solution. Any url?
>
> J
>
&gt; Nesler, Thomas J wrote:
&gt;> Hi Jangita!
>>
&gt;> Your post does help me organize my thoughts.&nbsp; If I understand you
>&gt; correctly, you don't use Dbaware components but when a user clicks a
>>; button you fetch the data and fill the form with it or Post the changes
&gt;> to the record.&nbsp; What code do you use to determine if a record is locked
&gt;> for editing?
>>
&gt;> What I am looking for is an example or two on how to handle deadlocks or
>&gt; other kinds of locks on a record.
&gt;>
&gt;> Tom Nesler
&gt;>
>;> Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;
>>
>> -----Original Message-----
>>; From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt; Behalf Of jangita
&gt;> Sent: Wednesday, April 26, 2006 3:50 PM
>&gt; To: delphi-en@yahoogroups.com
>&gt; Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt; Hello
>;>
>> I have done quite a bit of multi user client server programming and the
>&gt; following is a method i have found that works best
>>
>&gt; 1. when the user wants a list of items; i call a select stored procedure
>>
>> which returns the information; this is stored in a normal query
>;> component
>> 2. i *never* use data aware components; when the user clicks edit i fill
>> the
>&gt; components manualy with what has come from the database.
>> 3. when the user clicks save, i call another stored procedure which
>;> updates
&gt;> the specified record
&gt;>
>;> This avoids me having to keep any record in "edit" mode at all, leaving
&gt;> other users able to browse and modify such records. To make it more
>> effecient ud probaby only update the field that has been changed, but
>&gt; that's
&gt;> another story.
&gt;>
>;> Hope any of this is relevant...
>>
>> J
>>; ----- Original Message -----
>;> From: "Nesler, Thomas J" <tnesleramfam.com&gt;
>&gt; To: <delphi-en@yahoogroups.com>;
>> Sent: Wednesday, April 26, 2006 7:15 PM
>&gt; Subject: RE: [delphi-en] Using the TTable Edit Error Event
>;>
>>
>&gt;> Hi Bob!
>>>
&gt;>> I am using NexusDb version 1.08 and it does give me an error when a
>>;> record is locked.&nbsp; Unfortunately it does not resolve the conflict by
>&gt;> preventing the second user from editing the record.&nbsp; Which means that
>>> the first user can't exit the record and post because the second user
>> is
>&gt;> still editing the record.
&gt;>>
>>&gt; I am guessing that this is a problem that is tied to the Blob Memo
>> that
>>> the user is trying to edit. ; Since Blob memos are handled differently
>>> than regular records, I am thinking that is why I am getting these
>;> ugly
>>> error messages.
>>&gt;
>>;> What do you suggest?
>>>;
>>> Tom Nesler
&gt;>>
>>&gt;
>>;> -----Original Message-----
>>;> From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com] On
>&gt;> Behalf Of j.meierjmeiersoftware.de
&gt;>> Sent: Wednesday, April 26, 2006 11:00 AM
>&gt;> To: delphi-en@yahoogroups.com
>&gt;> Subject: Re: [delphi-en] Using the TTable Edit Error Event
>;>>
>>>;
>>> Hi Thomas,
&gt;>> as usual "it depends&quot;.
>&gt;> Which Database do you use? A "normal" SQL Client / Server RDB (as
>&gt;> Firebird or Interbase) is able to handle that automatically.
>&gt;> So, which Delphi version and which DB you are talking about.
&gt;>>
>>&gt; Have fun
>&gt;> Bob
>&gt;>
&gt;>>
>>&gt;> ; &nbsp;  I am working on a multiuser application.  One of my problems is
>&gt;> record
&gt;>>&gt; &nbsp; &nbsp; locking, specifically when one user is editing a blob field and
>&gt;> another
&gt;>>> &nbsp;   is editing the same record.
&gt;>>>
>&gt;>>  ; &nbsp; I am guessing that I need to put some code in the Edit error
>;> event
>;>> but
>&gt;>>  ; &nbsp; there is no example in the Delphi help file so I can only guess
>;>> how to
>&gt;>>&nbsp;   ; use it correctly.
>>&gt;>
&gt;>>&gt; &nbsp; &nbsp; Can some one give me an example on how to trap a record locking
&gt;>> error
>;>>&gt; &nbsp; &nbsp; using this event?&nbsp; Also what do you recommend for help in
>&gt;> understanding
>&gt;>>&nbsp;   ; the complexities of multiuser databases?
>>&gt;>
&gt;>>&gt; &nbsp; &nbsp; Thanks in advance!
>>>;>
>>>>; &nbsp; &nbsp; Tom Nesler
&gt;>>&gt; &nbsp; &nbsp; Live long!...&nbsp;  Code Well!...&nbsp;  and Prosper!... &nbsp; V
>>;>>
>>>;>
>>>>; &nbsp; &nbsp; [Non-text portions of this message have been removed]
>>>;>
>>>>;
>>>>
&gt;>>> &nbsp;   -----------------------------------------------------
>>&gt;> ; &nbsp;  Home page: http://groups.yahoo.com/group/delphi-en/
>>>;>   ;  To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>>>; &nbsp; &nbsp; Yahoo! Groups Links
>;>>&gt;
>>;>>
>>>;>
>>>>;
>>>>
&gt;>>>
>&gt;>
&gt;>> -----------------------------------------------------
>>&gt; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>> Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;> -----------------------------------------------------
>>&gt; Home page: http://groups.yahoo.com/group/delphi-en/
>>>; To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>>> Yahoo! Groups Links
>;>>
>>>;
>>>
>&gt;>
&gt;>>
>>&gt;
>>;>
>>
>&gt;
>&gt; -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>> -----------------------------------------------------
>> Home page: http://groups.yahoo.com/group/delphi-en/
>> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>> Yahoo! Groups Links
>;>
>>
>&gt;
>&gt;
>>;
>>
>>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
> Yahoo! Groups Links
>;
>
&gt;
>
&gt;
>
>


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links






[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )