ExclusiveLock Context [ExclusiveLock database list]...WebDNA...[/ExclusiveLock]
New in 4.0
Prevents other threads from simultaneously accessing a group of databases.
SQL/ODBC Note: all database, table, and record locking mechanisms are entirely controlled by the SQL server. [ExclusiveLock] is used only for WebDNA-native databases.

To prevent a group of databases from being modified by other threads (other 'hits' to the server, or other templates or triggers), wrap an [ExclusiveLock] context around the WebDNA code which will be making the important exclusive changes.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[ExclusiveLock db=orders.db&db=lineitems.db&db=accesslog.db]
...search, delete, or modify any of orders.db, lineitems.db, or accesslog.db while being assured that no other threads can modify any of these databases until the closing /ExclusiveLock tag is reached.
[/ExclusiveLock]

The list of database names is first alphabetized so as to maintain a consistent locking order (a technique which prevents internal deadlocks), then each database lock is acquired one at a time until all locks are acquired, then the interior WebDNA is executed. If any lock cannot be acquired, the other databases are unlocked, and the interior WebDNA is not executed.

 Parameter  Description
db
path to first database file, relative to this template.
db
path to second database file, relative to this template.
db
...path to nth database file, relative to this template. Note that all parameters are named exactly the same: "db"

User Contributed Notes
ExclusiveLockContext  

Copyright © 2008 WebDNA Software Corporation, Inc.