<?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: PHP, PDO &amp; Nested Transactions</title>
	<atom:link href="http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/</link>
	<description>Ramblings of a PHP developer</description>
	<lastBuildDate>Sat, 03 Dec 2011 21:35:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Luciano</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-610</link>
		<dc:creator>Luciano</dc:creator>
		<pubDate>Sat, 03 Dec 2011 21:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-610</guid>
		<description>Perfect!</description>
		<content:encoded><![CDATA[<p>Perfect!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diogo</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-407</link>
		<dc:creator>Diogo</dc:creator>
		<pubDate>Mon, 13 Dec 2010 22:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-407</guid>
		<description>Great tip, works like a charm!</description>
		<content:encoded><![CDATA[<p>Great tip, works like a charm!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: desfrenes</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-279</link>
		<dc:creator>desfrenes</dc:creator>
		<pubDate>Tue, 03 Nov 2009 14:26:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-279</guid>
		<description>Very nice tip.
However, beware that some operations (create table...) will call an implicit commit and thus will break the translevel counter.
But still, this is very useful.</description>
		<content:encoded><![CDATA[<p>Very nice tip.<br />
However, beware that some operations (create table&#8230;) will call an implicit commit and thus will break the translevel counter.<br />
But still, this is very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenny Millington</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-231</link>
		<dc:creator>Kenny Millington</dc:creator>
		<pubDate>Thu, 27 Aug 2009 20:49:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-231</guid>
		<description>&lt;a href=&quot;#comment-183&quot; rel=&quot;nofollow&quot;&gt;@Kyosuke&lt;/a&gt; 

I disagree.

Start with the case where transLevel = 0 (e.g. no calls to the transaction functions.)

beginTransaction() increments transLevel to 1.

Calling commit() or rollBack() with your code will try to ROLLBACK or RELEASE the save points where none have been created yet.

However with transLevel---; at the start of the function it will decrement it first then correctly try to call the parent::commit() or parent::rollBack() functions as appropriate.</description>
		<content:encoded><![CDATA[<p><a href="#comment-183" rel="nofollow">@Kyosuke</a> </p>
<p>I disagree.</p>
<p>Start with the case where transLevel = 0 (e.g. no calls to the transaction functions.)</p>
<p>beginTransaction() increments transLevel to 1.</p>
<p>Calling commit() or rollBack() with your code will try to ROLLBACK or RELEASE the save points where none have been created yet.</p>
<p>However with transLevel&#8212;; at the start of the function it will decrement it first then correctly try to call the parent::commit() or parent::rollBack() functions as appropriate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyosuke</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-183</link>
		<dc:creator>Kyosuke</dc:creator>
		<pubDate>Fri, 29 May 2009 09:36:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-183</guid>
		<description>so :

public function rollBack() {

	if(!$this-&gt;nestable() &#124;&#124; $this-&gt;transLevel == 0) {
		parent::rollBack();
	} else {
		$this-&gt;exec(&quot;ROLLBACK TO SAVEPOINT LEVEL{$this-&gt;transLevel}&quot;);
	}
	
	$this-&gt;transLevel--;
}


and :

public function commit() {
	if(!$this-&gt;nestable() &#124;&#124; $this-&gt;transLevel == 0) {
		parent::commit();
	} else {
		$this-&gt;exec(&quot;RELEASE SAVEPOINT LEVEL{$this-&gt;transLevel}&quot;);
	}
	$this-&gt;transLevel--;
}</description>
		<content:encoded><![CDATA[<p>so :</p>
<p>public function rollBack() {</p>
<p>	if(!$this-&gt;nestable() || $this-&gt;transLevel == 0) {<br />
		parent::rollBack();<br />
	} else {<br />
		$this-&gt;exec(&#8220;ROLLBACK TO SAVEPOINT LEVEL{$this-&gt;transLevel}&#8221;);<br />
	}</p>
<p>	$this-&gt;transLevel&#8211;;<br />
}</p>
<p>and :</p>
<p>public function commit() {<br />
	if(!$this-&gt;nestable() || $this-&gt;transLevel == 0) {<br />
		parent::commit();<br />
	} else {<br />
		$this-&gt;exec(&#8220;RELEASE SAVEPOINT LEVEL{$this-&gt;transLevel}&#8221;);<br />
	}<br />
	$this-&gt;transLevel&#8211;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyosuke</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-182</link>
		<dc:creator>Kyosuke</dc:creator>
		<pubDate>Fri, 29 May 2009 09:29:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-182</guid>
		<description>i think that there is a mistake with the managing of $this-&gt;transLevel

in the metods commit and rollback, it could be at the end of the function NOT in front.

Nice script indeed ;)</description>
		<content:encoded><![CDATA[<p>i think that there is a mistake with the managing of $this-&gt;transLevel</p>
<p>in the metods commit and rollback, it could be at the end of the function NOT in front.</p>
<p>Nice script indeed <img src='http://www.kennynet.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jj</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-136</link>
		<dc:creator>jj</dc:creator>
		<pubDate>Mon, 27 Apr 2009 13:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-136</guid>
		<description>naize :)</description>
		<content:encoded><![CDATA[<p>naize <img src='http://www.kennynet.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenny Millington</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-133</link>
		<dc:creator>Kenny Millington</dc:creator>
		<pubDate>Fri, 17 Apr 2009 10:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-133</guid>
		<description>Cheers for pointing that out. It should really version check the DB being used and check the SQL it wants to run is going to work, etc... Just hoping that code gets the basic method/idea across. :)</description>
		<content:encoded><![CDATA[<p>Cheers for pointing that out. It should really version check the DB being used and check the SQL it wants to run is going to work, etc&#8230; Just hoping that code gets the basic method/idea across. <img src='http://www.kennynet.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DerManoMann</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-126</link>
		<dc:creator>DerManoMann</dc:creator>
		<pubDate>Tue, 07 Apr 2009 23:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-126</guid>
		<description>Good stuff - you should perhaps mention that the RELEASE SAVEPOINT statement is only available in MySQ 5.</description>
		<content:encoded><![CDATA[<p>Good stuff &#8211; you should perhaps mention that the RELEASE SAVEPOINT statement is only available in MySQ 5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/comment-page-1/#comment-105</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Fri, 20 Mar 2009 22:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.kennynet.co.uk/?p=38#comment-105</guid>
		<description>Awesome code. Thanks for posing this.</description>
		<content:encoded><![CDATA[<p>Awesome code. Thanks for posing this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

