Name
with transaction [session object] end [transaction]
Syntax
With transaction (* code statements here *) end transaction
Description
with transaction
is designed to group together its
enclosed statements and commands by assigning each of them a single
transaction id. If a database application supports with transaction
, for instance, than it knows which Apple events
or commands share a transaction and can initiate an appropriate
response, such as locking the particular table from other users until
the transaction is complete. What is a transaction? A transaction
gathers together a group of operations and declares, in essence,
that, “we’re all in this
together—if one of us fails, then we all fail. We
won’t signal a successful completion until we all
succeed.”
The with transaction
statement itself, beyond
assigning the transaction id, does not have any other
transactional-related capabilities such as rolling back all of the
statements if one of the statements (e.g., a statement that updates
or alters a database file) within the transaction fails. Any behavior
that commits or rolls back database changes that are part of a single
transaction would have to be initiated by the database system itself
(the database program that AppleScript is scripting). with transaction
only works with the database programs that
support this statement.
Examples
To show what the with transaction
statement looks like, the following AppleScript requests the first database record from an open FileMaker database. ...
Get AppleScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.