<?php include_once '../doc-typo3-funcs.php'; $doxygen_vars = array( "title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/dbal/handlers/class.tx_dbal_handler_rawmysql.php Source File", "datetime" => "Sat Dec 2 19:22:30 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="nav"> <a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a> » <a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a> » <a class="el" href="dir_57bf1ed8249c1fd5b014486d01bcb27a.html">sysext</a> » <a class="el" href="dir_62e3f3f05add04816814124455979009.html">dbal</a> » <a class="el" href="dir_0daeb6660c23b051a86348f66e921fa7.html">handlers</a></div> <h1>class.tx_dbal_handler_rawmysql.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <?php <a name="l00002"></a>00002 <span class="comment">/***************************************************************</span> <a name="l00003"></a>00003 <span class="comment">* Copyright notice</span> <a name="l00004"></a>00004 <span class="comment">* </span> <a name="l00005"></a>00005 <span class="comment">* (c) 2004 Kasper Skaarhoj (kasper@typo3.com)</span> <a name="l00006"></a>00006 <span class="comment">* All rights reserved</span> <a name="l00007"></a>00007 <span class="comment">*</span> <a name="l00008"></a>00008 <span class="comment">* This script is part of the TYPO3 project. The TYPO3 project is</span> <a name="l00009"></a>00009 <span class="comment">* free software; you can redistribute it and/or modify</span> <a name="l00010"></a>00010 <span class="comment">* it under the terms of the GNU General Public License as published by</span> <a name="l00011"></a>00011 <span class="comment">* the Free Software Foundation; either version 2 of the License, or</span> <a name="l00012"></a>00012 <span class="comment">* (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">*</span> <a name="l00014"></a>00014 <span class="comment">* The GNU General Public License can be found at</span> <a name="l00015"></a>00015 <span class="comment">* http://www.gnu.org/copyleft/gpl.html.</span> <a name="l00016"></a>00016 <span class="comment">* A copy is found in the textfile GPL.txt and important notices to the license</span> <a name="l00017"></a>00017 <span class="comment">* from the author is found in LICENSE.txt distributed with these scripts.</span> <a name="l00018"></a>00018 <span class="comment">*</span> <a name="l00019"></a>00019 <span class="comment">*</span> <a name="l00020"></a>00020 <span class="comment">* This script is distributed in the hope that it will be useful,</span> <a name="l00021"></a>00021 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00022"></a>00022 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00023"></a>00023 <span class="comment">* GNU General Public License for more details.</span> <a name="l00024"></a>00024 <span class="comment">*</span> <a name="l00025"></a>00025 <span class="comment">* This copyright notice MUST APPEAR in all copies of the script!</span> <a name="l00026"></a>00026 <span class="comment">***************************************************************/</span> <a name="l00086"></a><a class="code" href="classtx__dbal__handler__rawmysql.html">00086</a> <span class="keyword">class </span><a class="code" href="classtx__dbal__handler__rawmysql.html">tx_dbal_handler_rawmysql</a> <span class="keyword">extends</span> <a class="code" href="classt3lib__sqlengine.html">t3lib_sqlengine</a> { <a name="l00087"></a>00087 <a name="l00088"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#fe2629a6268cbabaf30fd1dbe7b7fa80">00088</a> var <a class="code" href="classtx__dbal__handler__rawmysql.html#fe2629a6268cbabaf30fd1dbe7b7fa80">$config</a> = array(); <a name="l00089"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#912e815dcd3cd51fbca5bb3bc2bab21f">00089</a> var <a class="code" href="classtx__dbal__handler__rawmysql.html#912e815dcd3cd51fbca5bb3bc2bab21f">$link</a>; <a name="l00090"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#714f6902bbc023e956ecd75599e64b93">00090</a> var <a class="code" href="classtx__dbal__handler__rawmysql.html#714f6902bbc023e956ecd75599e64b93">$pObj</a>; <span class="comment">// Set from DBAL class.</span> <a name="l00091"></a>00091 <a name="l00100"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#5d0061c060e830f0463698dc1c6f0049">00100</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#5d0061c060e830f0463698dc1c6f0049">init</a>(<a class="code" href="classtx__dbal__handler__rawmysql.html#fe2629a6268cbabaf30fd1dbe7b7fa80">$config</a>,&<a class="code" href="classtx__dbal__handler__rawmysql.html#714f6902bbc023e956ecd75599e64b93">$pObj</a>) { <a name="l00101"></a>00101 $this->config = <a class="code" href="classtx__dbal__handler__rawmysql.html#fe2629a6268cbabaf30fd1dbe7b7fa80">$config</a>['config']; <a name="l00102"></a>00102 $this->pObj = &<a class="code" href="classtx__dbal__handler__rawmysql.html#714f6902bbc023e956ecd75599e64b93">$pObj</a>; <a name="l00103"></a>00103 $this->link = mysql_pconnect( <a name="l00104"></a>00104 $this->config['host'], <a name="l00105"></a>00105 $this->config['username'], <a name="l00106"></a>00106 $this->config['password'] <a name="l00107"></a>00107 ); <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="comment">// Select database as well:</span> <a name="l00110"></a>00110 <span class="keywordflow">if</span> (mysql_select_db($this->config['database'], $this->link)) { <a name="l00111"></a>00111 $output = TRUE; <a name="l00112"></a>00112 } <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="keywordflow">return</span> $output; <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <a name="l00124"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#5c0e1e66f56335654eb5cd5d3de037b0">00124</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#5c0e1e66f56335654eb5cd5d3de037b0">exec_INSERTquery</a>($table,$fields_values) { <a name="l00125"></a>00125 <span class="keywordflow">return</span> mysql_query($GLOBALS['TYPO3_DB']->INSERTquery($table,$fields_values), $this->link); <a name="l00126"></a>00126 } <a name="l00127"></a>00127 <a name="l00136"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#3cbd253fdcf12491ad2a03fe32b26a15">00136</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#3cbd253fdcf12491ad2a03fe32b26a15">exec_UPDATEquery</a>($table,$where,$fields_values) { <a name="l00137"></a>00137 <span class="keywordflow">return</span> mysql_query($GLOBALS['TYPO3_DB']->UPDATEquery($table,$where,$fields_values), $this->link); <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00147"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#8487da85b0f4b047342900ce28d86766">00147</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#8487da85b0f4b047342900ce28d86766">exec_DELETEquery</a>($table,$where) { <a name="l00148"></a>00148 <span class="keywordflow">return</span> mysql_query($GLOBALS['TYPO3_DB']->DELETEquery($table,$where), $this->link); <a name="l00149"></a>00149 } <a name="l00150"></a>00150 <a name="l00162"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#aeebaf27c6625f8332ece9a21eb6545f">00162</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#aeebaf27c6625f8332ece9a21eb6545f">exec_SELECTquery</a>($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit) { <a name="l00163"></a>00163 $res = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html">tx_dbal_handler_rawmysql_sqlObj</a>'); <span class="comment">// Create result object</span> <a name="l00164"></a>00164 $this->pObj->lastQuery = $GLOBALS['TYPO3_DB']->SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit); <a name="l00165"></a>00165 $res->result = mysql(TYPO3_db, $this->pObj->lastQuery, $this->link); <span class="comment">// Execute query</span> <a name="l00166"></a>00166 <span class="keywordflow">return</span> $res; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00174"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#6eaae161778e5006f93eb9e2d9f09aa2">00174</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#6eaae161778e5006f93eb9e2d9f09aa2">sql_error</a>() { <a name="l00175"></a>00175 <span class="keywordflow">return</span> mysql_error(); <a name="l00176"></a>00176 } <a name="l00177"></a>00177 <a name="l00183"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#349f46961f9e283a7702cab99e393061">00183</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#349f46961f9e283a7702cab99e393061">sql_insert_id</a>() { <a name="l00184"></a>00184 <span class="keywordflow">return</span> mysql_insert_id(); <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <a name="l00192"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#9b386c4a58797ad4c8f193e6e8e36f51">00192</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#9b386c4a58797ad4c8f193e6e8e36f51">sql_affected_rows</a>() { <a name="l00193"></a>00193 <span class="keywordflow">return</span> mysql_affected_rows(); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 <a name="l00202"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#531b4b9055d5b1eaf87fcd4c423fa562">00202</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#531b4b9055d5b1eaf87fcd4c423fa562">sql_query</a>($query) { <a name="l00203"></a>00203 $res = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html">tx_dbal_handler_rawmysql_sqlObj</a>'); <a name="l00204"></a>00204 $res->result = mysql_query($query, $this->link); <a name="l00205"></a>00205 <span class="keywordflow">return</span> $res; <a name="l00206"></a>00206 } <a name="l00207"></a>00207 <a name="l00214"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#21a301b933e047b78092fe6a4b9113e0">00214</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#21a301b933e047b78092fe6a4b9113e0">quoteStr</a>($str) { <a name="l00215"></a>00215 <span class="keywordflow">return</span> addslashes($str); <a name="l00216"></a>00216 } <a name="l00217"></a>00217 <a name="l00218"></a>00218 <a name="l00219"></a>00219 <a name="l00220"></a>00220 <a name="l00221"></a>00221 <a name="l00222"></a>00222 <a name="l00223"></a>00223 <a name="l00224"></a>00224 <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="comment">/**************************************</span> <a name="l00227"></a>00227 <span class="comment"> *</span> <a name="l00228"></a>00228 <span class="comment"> * SQL admin functions</span> <a name="l00229"></a>00229 <span class="comment"> * (For use in the Install Tool and Extension Manager)</span> <a name="l00230"></a>00230 <span class="comment"> *</span> <a name="l00231"></a>00231 <span class="comment"> **************************************/</span> <a name="l00232"></a>00232 <a name="l00238"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#80f51b7ecf088bfda3d462873fb1aa59">00238</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#80f51b7ecf088bfda3d462873fb1aa59">admin_get_tables</a>() { <a name="l00239"></a>00239 $whichTables = array(); <a name="l00240"></a>00240 $tables_result = mysql_list_tables($this->config['database'], $this->link); <a name="l00241"></a>00241 <span class="keywordflow">if</span> (!mysql_error()) { <a name="l00242"></a>00242 <span class="keywordflow">while</span> ($theTable = mysql_fetch_assoc($tables_result)) { <a name="l00243"></a>00243 $whichTables[current($theTable)] = current($theTable); <a name="l00244"></a>00244 } <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <span class="keywordflow">return</span> $whichTables; <a name="l00247"></a>00247 } <a name="l00248"></a>00248 <a name="l00255"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#4c4bc9fda3bca474478306ea9ce2afc7">00255</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#4c4bc9fda3bca474478306ea9ce2afc7">admin_get_fields</a>($tableName) { <a name="l00256"></a>00256 $output = array(); <a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="keywordflow">if</span> ($columns_res = @mysql_query('SHOW columns FROM '.$tableName, $this->link)) { <a name="l00259"></a>00259 <span class="keywordflow">while</span>($fieldRow = mysql_fetch_assoc($columns_res)) { <a name="l00260"></a>00260 $output[$fieldRow[<span class="stringliteral">"Field"</span>]] = $fieldRow; <a name="l00261"></a>00261 } <a name="l00262"></a>00262 } <a name="l00263"></a>00263 <a name="l00264"></a>00264 <span class="keywordflow">return</span> $output; <a name="l00265"></a>00265 } <a name="l00266"></a>00266 <a name="l00273"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#d9a110bb9e019684eb21624453775074">00273</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#d9a110bb9e019684eb21624453775074">admin_get_keys</a>($tableName) { <a name="l00274"></a>00274 $output = array(); <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="keywordflow">if</span> ($keyRes = @mysql_query('SHOW keys FROM '.$tableName, $this->link)) { <a name="l00277"></a>00277 <span class="keywordflow">while</span>($keyRow = mysql_fetch_assoc($keyRes)) { <a name="l00278"></a>00278 $output[] = $keyRow; <a name="l00279"></a>00279 } <a name="l00280"></a>00280 } <a name="l00281"></a>00281 <a name="l00282"></a>00282 <span class="keywordflow">return</span> $output; <a name="l00283"></a>00283 } <a name="l00284"></a>00284 <a name="l00291"></a><a class="code" href="classtx__dbal__handler__rawmysql.html#7b4a929c8640e48e846303749bf29fbf">00291</a> function <a class="code" href="classtx__dbal__handler__rawmysql.html#7b4a929c8640e48e846303749bf29fbf">admin_query</a>($query) { <a name="l00292"></a>00292 <span class="keywordflow">return</span> $this-><a class="code" href="classtx__dbal__handler__rawmysql.html#531b4b9055d5b1eaf87fcd4c423fa562">sql_query</a>($query); <a name="l00293"></a>00293 } <a name="l00294"></a>00294 } <a name="l00295"></a>00295 <a name="l00296"></a>00296 <a name="l00297"></a>00297 <a name="l00298"></a>00298 <a name="l00299"></a>00299 <a name="l00300"></a>00300 <a name="l00301"></a>00301 <a name="l00309"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html">00309</a> <span class="keyword">class </span><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html">tx_dbal_handler_rawmysql_sqlObj</a> <span class="keyword">extends</span> <a class="code" href="classt3lib__sqlengine__resultobj.html">t3lib_sqlengine_resultobj</a> { <a name="l00310"></a>00310 <a name="l00311"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#f96d791ea58c859f85b1bc1a2736b3cb">00311</a> var <a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#f96d791ea58c859f85b1bc1a2736b3cb">$result</a> = ''; <span class="comment">// Not array here, but resource pointer.</span> <a name="l00312"></a>00312 <a name="l00318"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#bab5876f9d73720767903142eb457ce0">00318</a> function <a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#bab5876f9d73720767903142eb457ce0">sql_num_rows</a>() { <a name="l00319"></a>00319 <span class="keywordflow">return</span> mysql_num_rows($this->result); <a name="l00320"></a>00320 } <a name="l00321"></a>00321 <a name="l00327"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#38f0c0cb570d9151382664c9be75054e">00327</a> function <a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#38f0c0cb570d9151382664c9be75054e">sql_fetch_assoc</a>() { <a name="l00328"></a>00328 <span class="keywordflow">return</span> mysql_fetch_assoc($this->result); <a name="l00329"></a>00329 } <a name="l00330"></a>00330 <a name="l00336"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#7a9d11c16180036c4675a5aa6fbc9168">00336</a> function <a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#7a9d11c16180036c4675a5aa6fbc9168">sql_fetch_row</a>() { <a name="l00337"></a>00337 <span class="keywordflow">return</span> mysql_fetch_row($this->result); <a name="l00338"></a>00338 } <a name="l00339"></a>00339 <a name="l00346"></a><a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#7f78e0dbb39a6a450b323f9f15418ebd">00346</a> function <a class="code" href="classtx__dbal__handler__rawmysql__sqlObj.html#7f78e0dbb39a6a450b323f9f15418ebd">sql_data_seek</a>($pointer) { <a name="l00347"></a>00347 <span class="keywordflow">return</span> mysql_data_seek($this->result,$pointer); <a name="l00348"></a>00348 } <a name="l00349"></a>00349 } <a name="l00350"></a>00350 <a name="l00351"></a>00351 <a name="l00352"></a>00352 <span class="keywordflow">if</span> (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/handlers/<span class="keyword">class</span>.<a class="code" href="classtx__dbal__handler__rawmysql.html">tx_dbal_handler_rawmysql</a>.php']) { <a name="l00353"></a>00353 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/handlers/<span class="keyword">class</span>.<a class="code" href="classtx__dbal__handler__rawmysql.html">tx_dbal_handler_rawmysql</a>.php']); <a name="l00354"></a>00354 } <a name="l00355"></a>00355 ?> </pre></div><?php include_once '../doc-typo3-funcs.php'; get_footer(); ?>