<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Practical Nested Transactions with Zend_Db and MySQL</title>
	<atom:link href="http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/</link>
	<description>Barking on about PHP, MySQL and Zend Framework</description>
	<lastBuildDate>Wed, 11 Jan 2012 16:01:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Anton</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-791</link>
		<dc:creator>Anton</dc:creator>
		<pubDate>Wed, 11 Jan 2012 16:01:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-791</guid>
		<description>The rollback() on nested transaction is a bit useless. 
An exception  will never be raised by a nested transaction because commit() on a nested transaction doesn&#039;t actually do anything.

I suggest you throw an &quot;Not implemented&quot; exception if rollback is called on a nested query. Or at least return false;</description>
		<content:encoded><![CDATA[<p>The rollback() on nested transaction is a bit useless.<br />
An exception  will never be raised by a nested transaction because commit() on a nested transaction doesn&#8217;t actually do anything.</p>
<p>I suggest you throw an &#8220;Not implemented&#8221; exception if rollback is called on a nested query. Or at least return false;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lacy</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-790</link>
		<dc:creator>Brian Lacy</dc:creator>
		<pubDate>Thu, 06 Oct 2011 22:33:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-790</guid>
		<description>This is really excellent work, Steve. I&#039;m impressed. I&#039;m going to work on my boss to implement in our Zend_Db stack pronto!

Really enjoy your work and your blog!</description>
		<content:encoded><![CDATA[<p>This is really excellent work, Steve. I&#8217;m impressed. I&#8217;m going to work on my boss to implement in our Zend_Db stack pronto!</p>
<p>Really enjoy your work and your blog!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-789</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 22 Sep 2011 15:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-789</guid>
		<description>Nowadays, in Java, this problem is resolved by means of request filters and dependency injection. Is there something like that in PHP?</description>
		<content:encoded><![CDATA[<p>Nowadays, in Java, this problem is resolved by means of request filters and dependency injection. Is there something like that in PHP?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: luba</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-783</link>
		<dc:creator>luba</dc:creator>
		<pubDate>Wed, 04 May 2011 00:55:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-783</guid>
		<description>Thanks man. This is awesome. So simple, so functional. Works like a charm for me and made my daily program routine so much easier.

For everybody that wants to use a global db adapter like me for all models, just do the following call in the model class constructor:

$this-&gt;_setAdapter($yourGlobalDbAdapter));

As an alternative, if you don&#039;t wanna add that code to each model you can simply create an abstract class that extends Zend_Db_Table_Abstract and then let the models extend this class instead.

Easy as that, cheers!
Luke</description>
		<content:encoded><![CDATA[<p>Thanks man. This is awesome. So simple, so functional. Works like a charm for me and made my daily program routine so much easier.</p>
<p>For everybody that wants to use a global db adapter like me for all models, just do the following call in the model class constructor:</p>
<p>$this-&gt;_setAdapter($yourGlobalDbAdapter));</p>
<p>As an alternative, if you don&#8217;t wanna add that code to each model you can simply create an abstract class that extends Zend_Db_Table_Abstract and then let the models extend this class instead.</p>
<p>Easy as that, cheers!<br />
Luke</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-37</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 30 Mar 2010 11:15:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-37</guid>
		<description>Thanks for the comment. You&#039;re right - these aren&#039;t &quot;real&quot; nested transactions. 

The idea here is to provide a wrapper around a series of otherwise atomic transactions and get round the automatic COMMIT when a new BEGIN TRANSACTION is issued. For many OO web based apps, that&#039;s all you need: an entire save operation is successful or no changes are committed.

It would be possible to implement something like your pseudo code using Zend_Db/MySQL with InnoDB tables and savepoints. But in practical terms I&#039;m not sure what it achieves. It also potentially leaves the client with no clear idea what data has been saved and what hasn&#039;t. For example, changes to a parent object might be saved but changes to its children aren&#039;t.</description>
		<content:encoded><![CDATA[<p>Thanks for the comment. You&#8217;re right &#8211; these aren&#8217;t &#8220;real&#8221; nested transactions. </p>
<p>The idea here is to provide a wrapper around a series of otherwise atomic transactions and get round the automatic COMMIT when a new BEGIN TRANSACTION is issued. For many OO web based apps, that&#8217;s all you need: an entire save operation is successful or no changes are committed.</p>
<p>It would be possible to implement something like your pseudo code using Zend_Db/MySQL with InnoDB tables and savepoints. But in practical terms I&#8217;m not sure what it achieves. It also potentially leaves the client with no clear idea what data has been saved and what hasn&#8217;t. For example, changes to a parent object might be saved but changes to its children aren&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hlomzik</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-36</link>
		<dc:creator>hlomzik</dc:creator>
		<pubDate>Tue, 30 Mar 2010 10:26:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-36</guid>
		<description>That&#039;s rollback are harmful! You must use rollback flag at least, becose for now your nested rollbacks have not any sence. But it is better to use savepoints and rollbacks to it.
Some pseudocode (without normal actions):
begin () {
  if ($level &gt; 0) {
    exec (&quot;savepoint nested_db_&quot; . $level);
  }
}
rollback () {
  if ($level &gt; 1) {
    exec (&quot;rollback to savepoint nested_db_&quot; . ($level - 1));
  }
}
commit () {
  if ($level &gt; 1) {
    exec (&quot;release savepoint nested_db_&quot; . ($level - 1));
  }
}

PS: I dont know are there savepoints on Zend_DB, sorry.</description>
		<content:encoded><![CDATA[<p>That&#8217;s rollback are harmful! You must use rollback flag at least, becose for now your nested rollbacks have not any sence. But it is better to use savepoints and rollbacks to it.<br />
Some pseudocode (without normal actions):<br />
begin () {<br />
  if ($level &gt; 0) {<br />
    exec (&#8220;savepoint nested_db_&#8221; . $level);<br />
  }<br />
}<br />
rollback () {<br />
  if ($level &gt; 1) {<br />
    exec (&#8220;rollback to savepoint nested_db_&#8221; . ($level &#8211; 1));<br />
  }<br />
}<br />
commit () {<br />
  if ($level &gt; 1) {<br />
    exec (&#8220;release savepoint nested_db_&#8221; . ($level &#8211; 1));<br />
  }<br />
}</p>
<p>PS: I dont know are there savepoints on Zend_DB, sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP-help &#187; Steve Hollis’ Blog: Practical Nested Transactions with Zend_Db and MySQL</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-19</link>
		<dc:creator>PHP-help &#187; Steve Hollis’ Blog: Practical Nested Transactions with Zend_Db and MySQL</dc:creator>
		<pubDate>Thu, 11 Mar 2010 18:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-19</guid>
		<description>[...] Steve Hollis has written an interesting article about how to handle nested transactions with Zend_Db and MySQL. [...]</description>
		<content:encoded><![CDATA[<p>[...] Steve Hollis has written an interesting article about how to handle nested transactions with Zend_Db and MySQL. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-12</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 10 Mar 2010 08:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-12</guid>
		<description>I see how that could work.

Presumably the two begin statements only issue one &quot;real&quot; BEGIN TRANSACTION to the DB though? Otherwise any updates made between the two calls will be committed on the second.</description>
		<content:encoded><![CDATA[<p>I see how that could work.</p>
<p>Presumably the two begin statements only issue one &#8220;real&#8221; BEGIN TRANSACTION to the DB though? Otherwise any updates made between the two calls will be committed on the second.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lxs</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-11</link>
		<dc:creator>lxs</dc:creator>
		<pubDate>Tue, 09 Mar 2010 21:38:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-11</guid>
		<description>I implement something really similar, but with a rollback flag to manage this king of case :
1 - begin, 2 - begin, 3 - rollback, 4 - commit =&gt; the last commit must rollback, so the rollback (3)  flag the transction to be rollbacked, and when commit append, if rollback flag is set, the transaction is rollbacked.</description>
		<content:encoded><![CDATA[<p>I implement something really similar, but with a rollback flag to manage this king of case :<br />
1 &#8211; begin, 2 &#8211; begin, 3 &#8211; rollback, 4 &#8211; commit =&gt; the last commit must rollback, so the rollback (3)  flag the transction to be rollbacked, and when commit append, if rollback flag is set, the transaction is rollbacked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Super-Skinny your Zend Framework Action Controllers (Part One) &#124; stevehollis.com</title>
		<link>http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/comment-page-1/#comment-9</link>
		<dc:creator>Super-Skinny your Zend Framework Action Controllers (Part One) &#124; stevehollis.com</dc:creator>
		<pubDate>Tue, 09 Mar 2010 09:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevehollis.com/?p=35#comment-9</guid>
		<description>[...] Weier O&#8217;Phinney, Pádraic Brady, Wenbert Del Rosario and others for retweeting/linking to my first post     Social [...]</description>
		<content:encoded><![CDATA[<p>[...] Weier O&#8217;Phinney, Pádraic Brady, Wenbert Del Rosario and others for retweeting/linking to my first post     Social [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

