<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>La rolls des blogs &#187; mysql</title>
	<atom:link href="http://my.rails-royce.org/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://my.rails-royce.org</link>
	<description>Another Ruby and Rails blog</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:47:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mysql 4.x and Rails : RELEASE SAVEPOINT issue</title>
		<link>http://my.rails-royce.org/2010/03/11/mysql-4-x-and-rails-release-savepoint-issue/</link>
		<comments>http://my.rails-royce.org/2010/03/11/mysql-4-x-and-rails-release-savepoint-issue/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 09:32:37 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[activerecord]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=140</guid>
		<description><![CDATA[Today with a project using mysql 4.1.22 that I have to implement some tests, I ran this error with rails 2.3.5 and I think for 2.3.x branch. Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#8216;RELEASE SAVEPOINT &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2010/03/11/mysql-4-x-and-rails-release-savepoint-issue/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Today with a project using mysql 4.1.22 that I have to implement some tests, I ran this error with rails 2.3.5 and I think for 2.3.x branch.</p>
<blockquote><p>
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#8216;RELEASE SAVEPOINT active_record_1&#8242; at line 1: RELEASE SAVEPOINT active_record_1
</p></blockquote>
<p>RELEASE SAVEPOINT is for Mysql 5.x</p>
<p>It is also described here <a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/be0bece7cdf052fa?fwc=1">http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/be0bece7cdf052fa?fwc=1</a></p>
<p>I get it resolved when digging into the activerecord code :<br />
ActiveRecord::ConnectionAdapters::AbstractAdapter defines <em>release_savepoint</em> method.</p>
<p>To get around with this, just add the belowing patch after Rails was loaded (at the bottom of your config/environment.rb for instance)</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># As of mysql 4.x does not support &quot;RELEASE SAVEPOINT&quot; statement</span>
<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">connection</span>.<span style="color:#9900CC;">instance_variable_get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@connection&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">get_server_info</span> <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#996600;">'5.0'</span>
  <span style="color:#6666ff; font-weight:bold;">ActiveRecord::ConnectionAdapters::MysqlAdapter</span>.<span style="color:#9900CC;">class_eval</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># Unset release savepoint method </span>
    <span style="color:#9966CC; font-weight:bold;">def</span> release_savepoint
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Hope that this can help !</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2010/03/11/mysql-4-x-and-rails-release-savepoint-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

