<?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>Libre d'esprit &#187; sql</title> <atom:link href="http://libre-d-esprit.thinking-days.net/tag/sql/feed/" rel="self" type="application/rss+xml" /><link>http://libre-d-esprit.thinking-days.net</link> <description>Logiciels libres, joomla, talend, php, virtuemart, templates Joomla</description> <lastBuildDate>Thu, 28 Oct 2010 11:04:51 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.4</generator> <item><title>Créer une requête SQL qui ne doit pas passer par JoomFish</title><link>http://libre-d-esprit.thinking-days.net/2009/06/creer-une-requete-sql-qui-ne-doit-pas-passer-par-joomfish/</link> <comments>http://libre-d-esprit.thinking-days.net/2009/06/creer-une-requete-sql-qui-ne-doit-pas-passer-par-joomfish/#comments</comments> <pubDate>Mon, 22 Jun 2009 11:58:49 +0000</pubDate> <dc:creator>Antoine</dc:creator> <category><![CDATA[JoomFish]]></category> <category><![CDATA[Joomla]]></category> <category><![CDATA[sql]]></category> <guid
isPermaLink="false">http://libre-d-esprit.thinking-days.net/?p=528</guid> <description><![CDATA[Joomfish, est la solution la plus populaire sous Joomla pour gérer l&#8217;internationalisation d&#8217;un site. Pour récupérer des données localisés, JoomFish va modifier les reqûetes SQL qui sont envoyés à la base de données. Néanmoins, il peut arriver, par exemple pour une question de performance, mais éventuellement pour des raisons fonctionnelles, que l&#8217;on ne veuille pas [...]]]></description> <content:encoded><![CDATA[<p><img
class="alignright size-full wp-image-557" title="f_1213193574" src="http://static-libre-d-esprit.thinking-days.net/uploads/2009/06/f_1213193574.png" alt="f_1213193574" />Joomfish, est la solution la plus populaire sous Joomla pour gérer l&#8217;internationalisation d&#8217;un site.</p><p>Pour récupérer des données localisés, JoomFish va modifier les reqûetes SQL qui sont envoyés à la base de données.</p><p>Néanmoins, il peut arriver, par exemple pour une question de performance, mais éventuellement pour des raisons fonctionnelles, que l&#8217;on ne veuille pas que JoomFish modifie une requête SQL et donc les données retournées.</p><p>C&#8217;est tout à fait possible sous Joomfish si on observe les méthodes de la classe JFDatabase. Voici par exemple la méthode load Object (le fonctionnement est le même pour LoadObjectList, LoadResult) :</p><div
class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009933; font-style: italic;">/**<br
/> * This global function loads the first row of a query into<br
/> * an object<br
/> *<br
/> * If an object is passed to this function, the returned row is<br
/> * bound to the existing elements of &lt;var&gt;object&lt;/var&gt;.<br
/> * If &lt;var&gt;object&lt;/var&gt; has a value of null, then all of the<br
/> * returned query fields returned in the object.<br
/> * @param string The SQL query<br
/> * @param object The address of variable<br
/> */</span><br
/> <span
style="color: #000000; font-weight: bold;">function</span> loadObject<span
style="color: #009900;">&#40;</span> <span
style="color: #000088;">$translate</span><span
style="color: #339933;">=</span><span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$language</span><span
style="color: #339933;">=</span><span
style="color: #009900; font-weight: bold;">null</span> <span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">global</span> <span
style="color: #000088;">$mosConfig_lang</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$_JOOMFISH_MANAGER</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span> <span
style="color: #000088;">$language</span><span
style="color: #339933;">===</span><span
style="color: #009900; font-weight: bold;">null</span><span
style="color: #009900;">&#41;</span> <span
style="color: #000088;">$language</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$mosConfig_lang</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$object</span> &nbsp;<span
style="color: #339933;">=</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>_db<span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>loadObject<span
style="color: #009900;">&#40;</span> <span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span> <span
style="color: #000088;">$translate</span> <span
style="color: #339933;">&amp;</span>amp<span
style="color: #339933;">;&amp;</span>amp<span
style="color: #339933;">;</span> <a
href="http://www.php.net/isset"><span
style="color: #990000;">isset</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$_JOOMFISH_MANAGER</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$doTranslate</span><span
style="color: #339933;">=</span><span
style="color: #009900; font-weight: bold;">false</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$tables</span> <span
style="color: #339933;">=</span><span
style="color: #000088;">$this</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>_getRefTables<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">foreach</span> <span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$tables</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">&quot;fieldTablePairs&quot;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #b1b100;">as</span> <span
style="color: #000088;">$i</span><span
style="color: #339933;">=&amp;</span>gt<span
style="color: #339933;">;</span><span
style="color: #000088;">$table</span><span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #b1b100;">if</span> <span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$this</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>translatedContentAvailable<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$table</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$doTranslate</span><span
style="color: #339933;">=</span><span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">break</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #b1b100;">if</span> <span
style="color: #009900;">&#40;</span> <span
style="color: #000088;">$doTranslate</span><span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> JoomFish<span
style="color: #339933;">::</span><span
style="color: #004000;">translate</span><span
style="color: #009900;">&#40;</span> <span
style="color: #000088;">$object</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>_getTableName<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #000088;">$language</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>_getRefTables<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #b1b100;">return</span> <span
style="color: #000088;">$object</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span></div></div><p>Comme vous pouvez le voir, passez la valeur &laquo;&nbsp;false&nbsp;&raquo; à la variable &laquo;&nbsp;translate&nbsp;&raquo; suffit à ne pas passer par JoomFish.</p> ]]></content:encoded> <wfw:commentRss>http://libre-d-esprit.thinking-days.net/2009/06/creer-une-requete-sql-qui-ne-doit-pas-passer-par-joomfish/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
