dbTalk Databases Forums  

asa Stored Procedures and COMMIT

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss asa Stored Procedures and COMMIT in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
handheldmaster
 
Posts: n/a

Default asa Stored Procedures and COMMIT - 05-01-2006 , 12:24 PM






Using ASA 9.0.2

Different questions but kind of related hence in the same posting.

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

2. If not using ATOMIC then how does the commit work

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

4. Any docs or whitepapers on this topic of Stored Procedures how they
manage transactions by default and how-to change its behavior.

TIA



Reply With Quote
  #2  
Old   
Greg Fenton
 
Posts: n/a

Default Re: asa Stored Procedures and COMMIT - 05-01-2006 , 12:48 PM






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/


Reply With Quote
  #3  
Old   
Breck Carter [Team iAnywhere]
 
Posts: n/a

Default Re: asa Stored Procedures and COMMIT - 05-02-2006 , 07:28 AM



On 1 May 2006 10:24:48 -0700, "handheldmaster"
<23989384uruff (AT) 39484948 (DOT) com> wrote:

Quote:
Any docs
Check out my book, it has a lot of material on the subjects you asked
about.

Breck

--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/SQL_Anywhe...ers_Guide.html
breck.carter (AT) risingroad (DOT) com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.