<?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>Stormwild Interactive &#187; PHP</title>
	<atom:link href="http://blog.stormwild.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stormwild.net</link>
	<description>Web Development</description>
	<lastBuildDate>Wed, 07 Jul 2010 14:59:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Facebook Uses HipHop To Transform PHP to C++</title>
		<link>http://blog.stormwild.net/applications/facebook-uses-hiphop-to-transform-php-to-c/</link>
		<comments>http://blog.stormwild.net/applications/facebook-uses-hiphop-to-transform-php-to-c/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 12:31:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.stormwild.net/?p=106</guid>
		<description><![CDATA[On the Facebook Developers site, Haiping Zhao writes about how Facebook uses HipHop to transform PHP code to C++ and compiles them using g++. In his article titled, HipHop for PHP: Move Fast, he mentions: HipHop for PHP isn&#8217;t technically &#8230; <a href="http://blog.stormwild.net/applications/facebook-uses-hiphop-to-transform-php-to-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On the Facebook Developers site, Haiping Zhao writes about how Facebook uses HipHop to transform PHP code to C++ and compiles them using g++. In his article titled, <a href="http://developers.facebook.com/news.php?blog=1&amp;story=358">HipHop for PHP: Move Fast</a>, he mentions:</p>
<blockquote><p>HipHop for PHP isn&#8217;t technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP&#8217;s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.</p></blockquote>
<p>In his article he describes how this tool helps to allow Facebook to scale to millions of users. He also mentions that HipHop has been released using the open source PHP license.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stormwild.net/applications/facebook-uses-hiphop-to-transform-php-to-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot execute queries while other unbuffered queries are active</title>
		<link>http://blog.stormwild.net/programming/cannot-execute-queries-while-other-unbuffered-queries-are-active/</link>
		<comments>http://blog.stormwild.net/programming/cannot-execute-queries-while-other-unbuffered-queries-are-active/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 13:34:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://stormwild.net/blog/?p=17</guid>
		<description><![CDATA[Cannot execute queries while other unbuffered queries are active Can&#8217;t execute subsequent query after multiple queries from same Pdo_Mysql-&#62;exec() call Can&#8217;t execute multiple stored procedures with Pdo_Mysql Using the following code found in the Zend Framework Quickstart: Create a Model &#8230; <a href="http://blog.stormwild.net/programming/cannot-execute-queries-while-other-unbuffered-queries-are-active/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://bugs.php.net/bug.php?id=44081" target="_blank">Cannot execute queries while other unbuffered queries are active</a></p>
<p><a href="http://framework.zend.com/issues/browse/ZF-5576" target="_blank">Can&#8217;t execute subsequent query after multiple queries from same Pdo_Mysql-&gt;exec() call</a></p>
<p><a href="http://framework.zend.com/issues/browse/ZF-4951" target="_blank">Can&#8217;t execute multiple stored procedures with Pdo_Mysql</a></p>
<p>Using the following code found in the <a href="http://framework.zend.com/docs/quickstart/create-a-model-and-database-table" target="_blank">Zend Framework Quickstart: Create a Model and Database Table</a></p>
<pre><span class="comment">// this block executes the actual statements that were loaded from </span>
<span class="comment">// the schema file.</span>
<span class="keyword">try</span> {
    <span class="variable">$schemaSql</span> = file_get_contents(<span class="string">'./schema.sqlite.sql'</span>);
    <span class="comment">// use the connection directly to load sql in batches</span>
    <span class="variable">$dbAdapter</span>-&gt;getConnection()-&gt;exec(<span class="variable">$schemaSql</span>);
    <span class="keyword">echo</span> PHP_EOL;
    <span class="keyword">echo</span> <span class="string">'Database Created'</span>;
    <span class="keyword">echo</span> PHP_EOL;

    <span class="keyword">if</span> (<span class="variable">$withData</span>) {
        <span class="variable">$dataSql</span> = file_get_contents(<span class="string">'./data.sqlite.sql'</span>);
        <span class="comment">// use the connection directly to load sql in batches</span>
        <span class="variable">$dbAdapter</span>-&gt;getConnection()-&gt;exec(<span class="variable">$dataSql</span>);
        <span class="keyword">echo</span> <span class="string">'Data Loaded.'</span>;
        <span class="keyword">echo</span> PHP_EOL;
    }

} <span class="keyword">catch</span> (<span class="keyword">Exception</span> <span class="variable">$e</span>) {
    <span class="keyword">echo</span> <span class="string">'AN ERROR HAS OCCURED:'</span> . PHP_EOL;
    <span class="keyword">echo</span> <span class="variable">$e</span>-&gt;getMessage() . PHP_EOL;
    <span class="keyword">return</span> false;
}</pre>
<p>Note that $dbAdapter-&gt;getConnection()-&gt;exec() gets called twice.</p>
<p>I encountered this issue when calling Pdo_Mysql-&gt;exec() or in the Zend Framework calling $dbAdapter-&gt;getConnection()-&gt;exec($schemaSql) one after the other.</p>
<p>One way to prevent the error was to call $dbAdapter-&gt;closeConnection() after each exec call. Another way I worked around this problem was to just execute the $schemaSql and the $dataSql in one exec call like below;</p>
<pre>$schemaSql = file_get_contents('schema.sql', 1);
$dataSql = file_get_contents('data.sql', 1);
// use the connection directly to load sql in batches
$dbAdapter-&gt;getConnection()-&gt;exec($schemaSql . $dataSql);</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.stormwild.net/programming/cannot-execute-queries-while-other-unbuffered-queries-are-active/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
