Register
Tuesday, January 06, 2009
Forum
 
Optimistic locking in the beta release
Last Post 14 Oct 2008 05:33 PM by eurowise. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
TerryH
New Member
New Member
Posts:7


--
12 Oct 2008 10:39 PM  
Can you please explain how the optimistic locking option found on the "Configure the project properties" works. The documentation does say that if the tables include a timestamp that optimistic locking can be enforced, but doesn't offer any further insite on this feature.
eurowise
Basic Member
Basic Member
Posts:107


--
13 Oct 2008 07:58 AM  
What it basically does is this. By selecting this option, CodeComplete adds another parameter in the where clause of the update command to check if the timestamp has changed, like this (Projects table in the PTracker)

UPDATE [Projects] SET [Name]=@Name, [Started]=@Started, [Ended]=@Ended, [Description]=@Description Where [Id]=@Id AND [LastChanged]=@LastChanged

Philip
TerryH
New Member
New Member
Posts:7


--
13 Oct 2008 10:49 PM  
How does it know which timestamp field to use in the table ?

Does the field have to be called "LastChanged" ?
eurowise
Basic Member
Basic Member
Posts:107


--
14 Oct 2008 05:33 PM  
That's the magic of Code Complete, it just knows! Seriously, Code Complete just uses the database schema information. It does not have to be called LastChanged.

Philip
You are not authorized to post a reply.

Active Forums 4.0