handheldmaster wrote:
Quote:
1. If using BEGIN ATOMIC ....... END for a stored procedure is it so that
once the procedure ends without any errors it will issue commit to end
transaction |
No, you still must perform the COMMIT yourself. The ATOMIC part simply
indicates that if the stored proc has an error that any and all changes
made by that stored proc will be rolled back.
Essentially, ATOMIC wraps the compound statement in a SAVEPOINT. If the
END is reached without errors, then all continues as normal. If an
error occurs, then a ROLLBACK TO SAVEPOINT is done to the point just
before BEGIN ATOMIC started on the current transaction.
In the SQL Anywhere 9.x online docs, see:
ASA SQL User's Guide
Using Procedures, Triggers, and Batches
Control statements
- Atomic compound statements
Quote:
2. If not using ATOMIC then how does the commit work |
Unless you are using a client API (or application) that supports
AUTOCOMMIT, you must always manually commit your transaction (though
note that many DDL statements perform an implicit commit).
Quote:
3. What if the users do not have access to the table but have execute
priviledge on the stored procedure .. assuming they can still execute in a
transperantly |
A stored procedure executes with the permissions of the owner of the
stored proc, not the user of it. Ability to execute the stored
procedure (GRANT EXECUTE) determines which users can execute the stored
proc.
Quote:
4. Any docs or whitepapers on this topic of Stored Procedures how they
manage transactions by default and how-to change its behavior. |
In the SQL Anywhere 9.x online docs see:
ASA SQL User's Guide
Using Transactions and Isolation Levels
Introduction to transactions
- Using transactions
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/