#1694: nested transaction save points don't rollback
---------------------------------------------------+------------------------
 Reporter:  dominicclifton                         |       Owner:  jwage
     Type:  defect                                 |      Status:  new  
 Priority:  blocker                                |   Milestone:  1.0.5
Component:  Attributes                             |     Version:  1.0.3
 Keywords:  transaction nested rollback savepoint  |    Has_test:  0    
 Mystatus:  Pending Core Response                  |   Has_patch:  0    
---------------------------------------------------+------------------------
 I'm having a problem with nested transactions that don't roll back:

 my scenario in my unit test:

 1) connect
 2) beginTransaction()
 3) clear some table
 4) use loadData() to import a fixture into the table
 5) run the method that the unit test is testing
 6) get connection
 7) issue beginTransaction('savepoint')
 8) insert some data
 9) throw exception so that commit() is NOT called and the program flow
 enters the catch block
 10) catch block calls rollback('savepoint')
 11) control is returned to unit test method
 11) unit test code issues a query to the database to confirm that the
 inserted data was NOT inserted (i.e. that the nested rollback worked)
 12) rollback() is called (with no savepoint)

 here's the mysql query log:

 {{{
 081126 12:21:16     502 Connect     [EMAIL PROTECTED] on mydb
                     502 Query       START TRANSACTION
                     502 Query       DELETE FROM state
 081126 12:21:17     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('1', 'fixture_state_item_1',
 'fixture_state_value_1', '2008-11-26 12:21:17', '2008-11-26 12:21:17')
                     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('2', 'batch_key_1',
 'batch_value_1', '2008-11-26 12:21:17', '2008-11-26 12:21:17')
                     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('2', 'batch_key_2',
 'batch_value_2', '2008-11-26 12:21:17', '2008-11-26 12:21:17')
                     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('2', 'batch_key_3',
 'batch_value_3', '2008-11-26 12:21:17', '2008-11-26 12:21:17')
 081126 12:21:19     502 Query       SAVEPOINT StateService_batchStore
                     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('3', 'key1', 'value1', '2008-11-26
 12:21:19', '2008-11-26 12:21:19')
                     502 Query       INSERT INTO state (owner_id, name,
 value, created_at, modified_at) VALUES ('3', 'key2', 'value2', '2008-11-26
 12:21:19', '2008-11-26 12:21:19')
                     502 Query       SELECT s.name AS s__name, s.value AS
 s__value, s.owner_id AS s__owner_id, s.created_at AS s__created_at,
 s.modified_at AS s__modified_at FROM state s WHERE s.owner_id = '3' AND
 s.name IN ('key1', 'key2', 'key3')
                     502 Query       ROLLBACK
                     502 Quit
 }}}

 I'm using doctrine 1.0.4 but no trac version for 1.0.4 has been created so
 the ticket does not reflect that.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1694>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to