Location: PHPKode > projects > PHP on Trax > johnpipi-trax-f599562/trax/doc/__filesource/fsource_PHPonTraxTest__testmockDBDB.php.html
<html>
<head>
<title>File Source for DB.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">PHPonTraxTest</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
  		  [ <a href="../classtrees_PHPonTraxTest.html" class="menu">class tree: PHPonTraxTest</a> ]
		  [ <a href="../elementindex_PHPonTraxTest.html" class="menu">index: PHPonTraxTest</a> ]
		  [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_PHPonTrax.html">PHPonTrax</a><br />
              <a href="../li_PHPonTraxTest.html">PHPonTraxTest</a><br />
            <br /><br />
                  
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file DB.php</h1>
<p>Documentation is available at <a href="../PHPonTraxTest/_test_mockDB_DB_php.html">DB.php</a></p>
<div class="php">
<div class="listing"><pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>
<li><a name="a2"></a><span class="src-doc">/**</span></li>
<li><a name="a3"></a><span class="src-doc"> *  File for mock DB class</span></li>
<li><a name="a4"></a><span class="src-doc"> *</span></li>
<li><a name="a5"></a><span class="src-doc"> *  This file has the same name as the file holding the </span><span class="src-doc-inlinetag">{@link }</span></li>
<li><a name="a6"></a><span class="src-doc"> *  http://pear.php.net/package/DB PEAR DB class}.</span></li>
<li><a name="a7"></a><span class="src-doc"> *  To use the mock DB, put this file in the PHP include path ahead of</span></li>
<li><a name="a8"></a><span class="src-doc"> *  the PEAR library, so that any class which requires DB.php will</span></li>
<li><a name="a9"></a><span class="src-doc"> *  load this version.</span></li>
<li><a name="a10"></a><span class="src-doc"> *</span></li>
<li><a name="a11"></a><span class="src-doc"> * (PHP 5)</span></li>
<li><a name="a12"></a><span class="src-doc"> *</span></li>
<li><a name="a13"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> PHPonTraxTest</span></li>
<li><a name="a14"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://opensource.org/licenses/gpl-license.php GNU Public License</span></li>
<li><a name="a15"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> (c) Walter O. Haas 2006</span></li>
<li><a name="a16"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> $Id: DB.php 198 2006-04-20 16:20:30Z haas $</span></li>
<li><a name="a17"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Walt Haas &lt;hide@address.com&gt;</span></li>
<li><a name="a18"></a><span class="src-doc"> */</span></li>
<li><a name="a19"></a>&nbsp;</li>
<li><a name="a20"></a><span class="src-inc">require_once </span><span class="src-str">'PEAR.php'</span><span class="src-sym">;</span></li>
<li><a name="a21"></a><span class="src-inc">require_once </span><span class="src-str">'PHPUnit2/Framework/Assert.php'</span><span class="src-sym">;</span></li>
<li><a name="a22"></a>&nbsp;</li>
<li><a name="a23"></a><span class="src-doc">/**</span></li>
<li><a name="a24"></a><span class="src-doc"> * The code returned by many methods upon success</span></li>
<li><a name="a25"></a><span class="src-doc"> */</span></li>
<li><a name="a26"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_OK'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a27"></a>&nbsp;</li>
<li><a name="a28"></a><span class="src-doc">/**</span></li>
<li><a name="a29"></a><span class="src-doc"> * Unkown error</span></li>
<li><a name="a30"></a><span class="src-doc"> */</span></li>
<li><a name="a31"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR'</span><span class="src-sym">, </span>-<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a32"></a>&nbsp;</li>
<li><a name="a33"></a><span class="src-doc">/**</span></li>
<li><a name="a34"></a><span class="src-doc"> * Syntax error</span></li>
<li><a name="a35"></a><span class="src-doc"> */</span></li>
<li><a name="a36"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_SYNTAX'</span><span class="src-sym">, </span>-<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a37"></a>&nbsp;</li>
<li><a name="a38"></a><span class="src-doc">/**</span></li>
<li><a name="a39"></a><span class="src-doc"> * Tried to insert a duplicate value into a primary or unique index</span></li>
<li><a name="a40"></a><span class="src-doc"> */</span></li>
<li><a name="a41"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_CONSTRAINT'</span><span class="src-sym">, </span>-<span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a42"></a>&nbsp;</li>
<li><a name="a43"></a><span class="src-doc">/**</span></li>
<li><a name="a44"></a><span class="src-doc"> * An identifier in the query refers to a non-existant object</span></li>
<li><a name="a45"></a><span class="src-doc"> */</span></li>
<li><a name="a46"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOT_FOUND'</span><span class="src-sym">, </span>-<span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a47"></a>&nbsp;</li>
<li><a name="a48"></a><span class="src-doc">/**</span></li>
<li><a name="a49"></a><span class="src-doc"> * Tried to create a duplicate object</span></li>
<li><a name="a50"></a><span class="src-doc"> */</span></li>
<li><a name="a51"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_ALREADY_EXISTS'</span><span class="src-sym">, </span>-<span class="src-num">5</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a52"></a>&nbsp;</li>
<li><a name="a53"></a><span class="src-doc">/**</span></li>
<li><a name="a54"></a><span class="src-doc"> * The current driver does not support the action you attempted</span></li>
<li><a name="a55"></a><span class="src-doc"> */</span></li>
<li><a name="a56"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_UNSUPPORTED'</span><span class="src-sym">, </span>-<span class="src-num">6</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a57"></a>&nbsp;</li>
<li><a name="a58"></a><span class="src-doc">/**</span></li>
<li><a name="a59"></a><span class="src-doc"> * The number of parameters does not match the number of placeholders</span></li>
<li><a name="a60"></a><span class="src-doc"> */</span></li>
<li><a name="a61"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_MISMATCH'</span><span class="src-sym">, </span>-<span class="src-num">7</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a62"></a>&nbsp;</li>
<li><a name="a63"></a><span class="src-doc">/**</span></li>
<li><a name="a64"></a><span class="src-doc"> * A literal submitted did not match the data type expected</span></li>
<li><a name="a65"></a><span class="src-doc"> */</span></li>
<li><a name="a66"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_INVALID'</span><span class="src-sym">, </span>-<span class="src-num">8</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a67"></a>&nbsp;</li>
<li><a name="a68"></a><span class="src-doc">/**</span></li>
<li><a name="a69"></a><span class="src-doc"> * The current DBMS does not support the action you attempted</span></li>
<li><a name="a70"></a><span class="src-doc"> */</span></li>
<li><a name="a71"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOT_CAPABLE'</span><span class="src-sym">, </span>-<span class="src-num">9</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a72"></a>&nbsp;</li>
<li><a name="a73"></a><span class="src-doc">/**</span></li>
<li><a name="a74"></a><span class="src-doc"> * A literal submitted was too long so the end of it was removed</span></li>
<li><a name="a75"></a><span class="src-doc"> */</span></li>
<li><a name="a76"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_TRUNCATED'</span><span class="src-sym">, </span>-<span class="src-num">10</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a77"></a>&nbsp;</li>
<li><a name="a78"></a><span class="src-doc">/**</span></li>
<li><a name="a79"></a><span class="src-doc"> * A literal number submitted did not match the data type expected</span></li>
<li><a name="a80"></a><span class="src-doc"> */</span></li>
<li><a name="a81"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_INVALID_NUMBER'</span><span class="src-sym">, </span>-<span class="src-num">11</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a82"></a>&nbsp;</li>
<li><a name="a83"></a><span class="src-doc">/**</span></li>
<li><a name="a84"></a><span class="src-doc"> * A literal date submitted did not match the data type expected</span></li>
<li><a name="a85"></a><span class="src-doc"> */</span></li>
<li><a name="a86"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_INVALID_DATE'</span><span class="src-sym">, </span>-<span class="src-num">12</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a87"></a>&nbsp;</li>
<li><a name="a88"></a><span class="src-doc">/**</span></li>
<li><a name="a89"></a><span class="src-doc"> * Attempt to divide something by zero</span></li>
<li><a name="a90"></a><span class="src-doc"> */</span></li>
<li><a name="a91"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_DIVZERO'</span><span class="src-sym">, </span>-<span class="src-num">13</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a92"></a>&nbsp;</li>
<li><a name="a93"></a><span class="src-doc">/**</span></li>
<li><a name="a94"></a><span class="src-doc"> * A database needs to be selected</span></li>
<li><a name="a95"></a><span class="src-doc"> */</span></li>
<li><a name="a96"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NODBSELECTED'</span><span class="src-sym">, </span>-<span class="src-num">14</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a97"></a>&nbsp;</li>
<li><a name="a98"></a><span class="src-doc">/**</span></li>
<li><a name="a99"></a><span class="src-doc"> * Could not create the object requested</span></li>
<li><a name="a100"></a><span class="src-doc"> */</span></li>
<li><a name="a101"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_CANNOT_CREATE'</span><span class="src-sym">, </span>-<span class="src-num">15</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a102"></a>&nbsp;</li>
<li><a name="a103"></a><span class="src-doc">/**</span></li>
<li><a name="a104"></a><span class="src-doc"> * Could not drop the database requested because it does not exist</span></li>
<li><a name="a105"></a><span class="src-doc"> */</span></li>
<li><a name="a106"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_CANNOT_DROP'</span><span class="src-sym">, </span>-<span class="src-num">17</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a107"></a>&nbsp;</li>
<li><a name="a108"></a><span class="src-doc">/**</span></li>
<li><a name="a109"></a><span class="src-doc"> * An identifier in the query refers to a non-existant table</span></li>
<li><a name="a110"></a><span class="src-doc"> */</span></li>
<li><a name="a111"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOSUCHTABLE'</span><span class="src-sym">, </span>-<span class="src-num">18</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a112"></a>&nbsp;</li>
<li><a name="a113"></a><span class="src-doc">/**</span></li>
<li><a name="a114"></a><span class="src-doc"> * An identifier in the query refers to a non-existant column</span></li>
<li><a name="a115"></a><span class="src-doc"> */</span></li>
<li><a name="a116"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOSUCHFIELD'</span><span class="src-sym">, </span>-<span class="src-num">19</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a117"></a>&nbsp;</li>
<li><a name="a118"></a><span class="src-doc">/**</span></li>
<li><a name="a119"></a><span class="src-doc"> * The data submitted to the method was inappropriate</span></li>
<li><a name="a120"></a><span class="src-doc"> */</span></li>
<li><a name="a121"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NEED_MORE_DATA'</span><span class="src-sym">, </span>-<span class="src-num">20</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a122"></a>&nbsp;</li>
<li><a name="a123"></a><span class="src-doc">/**</span></li>
<li><a name="a124"></a><span class="src-doc"> * The attempt to lock the table failed</span></li>
<li><a name="a125"></a><span class="src-doc"> */</span></li>
<li><a name="a126"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOT_LOCKED'</span><span class="src-sym">, </span>-<span class="src-num">21</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a127"></a>&nbsp;</li>
<li><a name="a128"></a><span class="src-doc">/**</span></li>
<li><a name="a129"></a><span class="src-doc"> * The number of columns doesn't match the number of values</span></li>
<li><a name="a130"></a><span class="src-doc"> */</span></li>
<li><a name="a131"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_VALUE_COUNT_ON_ROW'</span><span class="src-sym">, </span>-<span class="src-num">22</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a132"></a>&nbsp;</li>
<li><a name="a133"></a><span class="src-doc">/**</span></li>
<li><a name="a134"></a><span class="src-doc"> * The DSN submitted has problems</span></li>
<li><a name="a135"></a><span class="src-doc"> */</span></li>
<li><a name="a136"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_INVALID_DSN'</span><span class="src-sym">, </span>-<span class="src-num">23</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a137"></a>&nbsp;</li>
<li><a name="a138"></a><span class="src-doc">/**</span></li>
<li><a name="a139"></a><span class="src-doc"> * Could not connect to the database</span></li>
<li><a name="a140"></a><span class="src-doc"> */</span></li>
<li><a name="a141"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_CONNECT_FAILED'</span><span class="src-sym">, </span>-<span class="src-num">24</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a142"></a>&nbsp;</li>
<li><a name="a143"></a><span class="src-doc">/**</span></li>
<li><a name="a144"></a><span class="src-doc"> * The PHP extension needed for this DBMS could not be found</span></li>
<li><a name="a145"></a><span class="src-doc"> */</span></li>
<li><a name="a146"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_EXTENSION_NOT_FOUND'</span><span class="src-sym">,</span>-<span class="src-num">25</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a147"></a>&nbsp;</li>
<li><a name="a148"></a><span class="src-doc">/**</span></li>
<li><a name="a149"></a><span class="src-doc"> * The present user has inadequate permissions to perform the task requestd</span></li>
<li><a name="a150"></a><span class="src-doc"> */</span></li>
<li><a name="a151"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_ACCESS_VIOLATION'</span><span class="src-sym">, </span>-<span class="src-num">26</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a152"></a>&nbsp;</li>
<li><a name="a153"></a><span class="src-doc">/**</span></li>
<li><a name="a154"></a><span class="src-doc"> * The database requested does not exist</span></li>
<li><a name="a155"></a><span class="src-doc"> */</span></li>
<li><a name="a156"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_NOSUCHDB'</span><span class="src-sym">, </span>-<span class="src-num">27</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a157"></a>&nbsp;</li>
<li><a name="a158"></a><span class="src-doc">/**</span></li>
<li><a name="a159"></a><span class="src-doc"> * Tried to insert a null value into a column that doesn't allow nulls</span></li>
<li><a name="a160"></a><span class="src-doc"> */</span></li>
<li><a name="a161"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_ERROR_CONSTRAINT_NOT_NULL'</span><span class="src-sym">,</span>-<span class="src-num">29</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a162"></a>&nbsp;</li>
<li><a name="a163"></a><span class="src-doc">/**</span></li>
<li><a name="a164"></a><span class="src-doc"> * Identifiers for the placeholders used in prepared statements.</span></li>
<li><a name="a165"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> prepare()</span></li>
<li><a name="a166"></a><span class="src-doc"> */</span></li>
<li><a name="a167"></a>&nbsp;</li>
<li><a name="a168"></a><span class="src-doc">/**</span></li>
<li><a name="a169"></a><span class="src-doc"> * Indicates a scalar (&lt;kbd&gt;?&lt;/kbd&gt;) placeholder was used</span></li>
<li><a name="a170"></a><span class="src-doc"> *</span></li>
<li><a name="a171"></a><span class="src-doc"> * Quote and escape the value as necessary.</span></li>
<li><a name="a172"></a><span class="src-doc"> */</span></li>
<li><a name="a173"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PARAM_SCALAR'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a174"></a>&nbsp;</li>
<li><a name="a175"></a><span class="src-doc">/**</span></li>
<li><a name="a176"></a><span class="src-doc"> * Indicates an opaque (&lt;kbd&gt;&amp;&lt;/kbd&gt;) placeholder was used</span></li>
<li><a name="a177"></a><span class="src-doc"> *</span></li>
<li><a name="a178"></a><span class="src-doc"> * The value presented is a file name.  Extract the contents of that file</span></li>
<li><a name="a179"></a><span class="src-doc"> * and place them in this column.</span></li>
<li><a name="a180"></a><span class="src-doc"> */</span></li>
<li><a name="a181"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PARAM_OPAQUE'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a182"></a>&nbsp;</li>
<li><a name="a183"></a><span class="src-doc">/**</span></li>
<li><a name="a184"></a><span class="src-doc"> * Indicates a misc (&lt;kbd&gt;!&lt;/kbd&gt;) placeholder was used</span></li>
<li><a name="a185"></a><span class="src-doc"> *</span></li>
<li><a name="a186"></a><span class="src-doc"> * The value should not be quoted or escaped.</span></li>
<li><a name="a187"></a><span class="src-doc"> */</span></li>
<li><a name="a188"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PARAM_MISC'</span><span class="src-sym">,   </span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a189"></a>&nbsp;</li>
<li><a name="a190"></a><span class="src-doc">/**</span></li>
<li><a name="a191"></a><span class="src-doc"> * The different ways of returning binary data from queries.</span></li>
<li><a name="a192"></a><span class="src-doc"> */</span></li>
<li><a name="a193"></a>&nbsp;</li>
<li><a name="a194"></a><span class="src-doc">/**</span></li>
<li><a name="a195"></a><span class="src-doc"> * Sends the fetched data straight through to output</span></li>
<li><a name="a196"></a><span class="src-doc"> */</span></li>
<li><a name="a197"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_BINMODE_PASSTHRU'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a198"></a>&nbsp;</li>
<li><a name="a199"></a><span class="src-doc">/**</span></li>
<li><a name="a200"></a><span class="src-doc"> * Lets you return data as usual</span></li>
<li><a name="a201"></a><span class="src-doc"> */</span></li>
<li><a name="a202"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_BINMODE_RETURN'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a203"></a>&nbsp;</li>
<li><a name="a204"></a><span class="src-doc">/**</span></li>
<li><a name="a205"></a><span class="src-doc"> * Converts the data to hex format before returning it</span></li>
<li><a name="a206"></a><span class="src-doc"> *</span></li>
<li><a name="a207"></a><span class="src-doc"> * For example the string &quot;123&quot; would become &quot;313233&quot;.</span></li>
<li><a name="a208"></a><span class="src-doc"> */</span></li>
<li><a name="a209"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_BINMODE_CONVERT'</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a210"></a>&nbsp;</li>
<li><a name="a211"></a><span class="src-doc">/**</span></li>
<li><a name="a212"></a><span class="src-doc"> * Fetchmode constants</span></li>
<li><a name="a213"></a><span class="src-doc"> */</span></li>
<li><a name="a214"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_FETCHMODE_DEFAULT'</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a215"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_FETCHMODE_ORDERED'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a216"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_FETCHMODE_ASSOC'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a217"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_FETCHMODE_OBJECT'</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a218"></a>&nbsp;</li>
<li><a name="a219"></a><span class="src-doc">/**</span></li>
<li><a name="a220"></a><span class="src-doc"> * For multi-dimensional results, make the column name the first level</span></li>
<li><a name="a221"></a><span class="src-doc"> * of the array and put the row number in the second level of the array</span></li>
<li><a name="a222"></a><span class="src-doc"> *</span></li>
<li><a name="a223"></a><span class="src-doc"> * This is flipped from the normal behavior, which puts the row numbers</span></li>
<li><a name="a224"></a><span class="src-doc"> * in the first level of the array and the column names in the second level.</span></li>
<li><a name="a225"></a><span class="src-doc"> */</span></li>
<li><a name="a226"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_FETCHMODE_FLIPPED'</span><span class="src-sym">, </span><span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a227"></a>&nbsp;</li>
<li><a name="a228"></a><span class="src-doc">/**</span></li>
<li><a name="a229"></a><span class="src-doc"> * Old fetch modes.  Left here for compatibility.</span></li>
<li><a name="a230"></a><span class="src-doc"> */</span></li>
<li><a name="a231"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_GETMODE_ORDERED'</span><span class="src-sym">, </span><span class="src-id">DB_FETCHMODE_ORDERED</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a232"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_GETMODE_ASSOC'</span><span class="src-sym">,   </span><span class="src-id">DB_FETCHMODE_ASSOC</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a233"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_GETMODE_FLIPPED'</span><span class="src-sym">, </span><span class="src-id">DB_FETCHMODE_FLIPPED</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a234"></a>&nbsp;</li>
<li><a name="a235"></a><span class="src-doc">/**</span></li>
<li><a name="a236"></a><span class="src-doc"> * The type of information to return from the tableInfo() method.</span></li>
<li><a name="a237"></a><span class="src-doc"> *</span></li>
<li><a name="a238"></a><span class="src-doc"> * Bitwised constants, so they can be combined using &lt;kbd&gt;|&lt;/kbd&gt;</span></li>
<li><a name="a239"></a><span class="src-doc"> * and removed using &lt;kbd&gt;^&lt;/kbd&gt;.</span></li>
<li><a name="a240"></a><span class="src-doc"> *</span></li>
<li><a name="a241"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> tableInfo()</span></li>
<li><a name="a242"></a><span class="src-doc"> */</span></li>
<li><a name="a243"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_TABLEINFO_ORDER'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a244"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_TABLEINFO_ORDERTABLE'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a245"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_TABLEINFO_FULL'</span><span class="src-sym">, </span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a246"></a>&nbsp;</li>
<li><a name="a247"></a><span class="src-doc">/**</span></li>
<li><a name="a248"></a><span class="src-doc"> * The type of query to create with the automatic query building methods.</span></li>
<li><a name="a249"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> autoPrepare(), autoExecute()</span></li>
<li><a name="a250"></a><span class="src-doc"> */</span></li>
<li><a name="a251"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_AUTOQUERY_INSERT'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a252"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_AUTOQUERY_UPDATE'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a253"></a>&nbsp;</li>
<li><a name="a254"></a><span class="src-doc">/**</span></li>
<li><a name="a255"></a><span class="src-doc"> * Portability Modes.</span></li>
<li><a name="a256"></a><span class="src-doc"> *</span></li>
<li><a name="a257"></a><span class="src-doc"> * Bitwised constants, so they can be combined using &lt;kbd&gt;|&lt;/kbd&gt;</span></li>
<li><a name="a258"></a><span class="src-doc"> * and removed using &lt;kbd&gt;^&lt;/kbd&gt;.</span></li>
<li><a name="a259"></a><span class="src-doc"> *</span></li>
<li><a name="a260"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> setOption()</span></li>
<li><a name="a261"></a><span class="src-doc"> */</span></li>
<li><a name="a262"></a>&nbsp;</li>
<li><a name="a263"></a><span class="src-doc">/**</span></li>
<li><a name="a264"></a><span class="src-doc"> * Turn off all portability features</span></li>
<li><a name="a265"></a><span class="src-doc"> */</span></li>
<li><a name="a266"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_NONE'</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a267"></a>&nbsp;</li>
<li><a name="a268"></a><span class="src-doc">/**</span></li>
<li><a name="a269"></a><span class="src-doc"> * Convert names of tables and fields to lower case</span></li>
<li><a name="a270"></a><span class="src-doc"> * when using the get*(), fetch*() and tableInfo() methods</span></li>
<li><a name="a271"></a><span class="src-doc"> */</span></li>
<li><a name="a272"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_LOWERCASE'</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a273"></a>&nbsp;</li>
<li><a name="a274"></a><span class="src-doc">/**</span></li>
<li><a name="a275"></a><span class="src-doc"> * Right trim the data output by get*() and fetch*()</span></li>
<li><a name="a276"></a><span class="src-doc"> */</span></li>
<li><a name="a277"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_RTRIM'</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a278"></a>&nbsp;</li>
<li><a name="a279"></a><span class="src-doc">/**</span></li>
<li><a name="a280"></a><span class="src-doc"> * Force reporting the number of rows deleted</span></li>
<li><a name="a281"></a><span class="src-doc"> */</span></li>
<li><a name="a282"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_DELETE_COUNT'</span><span class="src-sym">, </span><span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a283"></a>&nbsp;</li>
<li><a name="a284"></a><span class="src-doc">/**</span></li>
<li><a name="a285"></a><span class="src-doc"> * Enable hack that makes numRows() work in Oracle</span></li>
<li><a name="a286"></a><span class="src-doc"> */</span></li>
<li><a name="a287"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_NUMROWS'</span><span class="src-sym">, </span><span class="src-num">8</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a288"></a>&nbsp;</li>
<li><a name="a289"></a><span class="src-doc">/**</span></li>
<li><a name="a290"></a><span class="src-doc"> * Makes certain error messages in certain drivers compatible</span></li>
<li><a name="a291"></a><span class="src-doc"> * with those from other DBMS's</span></li>
<li><a name="a292"></a><span class="src-doc"> *</span></li>
<li><a name="a293"></a><span class="src-doc"> * + mysql, mysqli:  change unique/primary key constraints</span></li>
<li><a name="a294"></a><span class="src-doc"> *   DB_ERROR_ALREADY_EXISTS -&gt; DB_ERROR_CONSTRAINT</span></li>
<li><a name="a295"></a><span class="src-doc"> *</span></li>
<li><a name="a296"></a><span class="src-doc"> * + odbc(access):  MS's ODBC driver reports 'no such field' as code</span></li>
<li><a name="a297"></a><span class="src-doc"> *   07001, which means 'too few parameters.'  When this option is on</span></li>
<li><a name="a298"></a><span class="src-doc"> *   that code gets mapped to DB_ERROR_NOSUCHFIELD.</span></li>
<li><a name="a299"></a><span class="src-doc"> */</span></li>
<li><a name="a300"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_ERRORS'</span><span class="src-sym">, </span><span class="src-num">16</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a301"></a>&nbsp;</li>
<li><a name="a302"></a><span class="src-doc">/**</span></li>
<li><a name="a303"></a><span class="src-doc"> * Convert null values to empty strings in data output by</span></li>
<li><a name="a304"></a><span class="src-doc"> * get*() and fetch*()</span></li>
<li><a name="a305"></a><span class="src-doc"> */</span></li>
<li><a name="a306"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_NULL_TO_EMPTY'</span><span class="src-sym">, </span><span class="src-num">32</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a307"></a>&nbsp;</li>
<li><a name="a308"></a><span class="src-doc">/**</span></li>
<li><a name="a309"></a><span class="src-doc"> * Turn on all portability features</span></li>
<li><a name="a310"></a><span class="src-doc"> */</span></li>
<li><a name="a311"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'DB_PORTABILITY_ALL'</span><span class="src-sym">, </span><span class="src-num">63</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a312"></a>&nbsp;</li>
<li><a name="a313"></a><span class="src-doc">/**</span></li>
<li><a name="a314"></a><span class="src-doc"> *  Mock DB class for testing</span></li>
<li><a name="a315"></a><span class="src-doc"> *</span></li>
<li><a name="a316"></a><span class="src-doc"> *  This class is a mock version of the</span></li>
<li><a name="a317"></a><span class="src-doc"> *  </span><span class="src-doc-inlinetag">{@link http://pear.php.net/package/DB PEAR DB class}</span><span class="src-doc">.  It is</span></li>
<li><a name="a318"></a><span class="src-doc"> *  intended to provide the same interface as the real DB class, plus</span></li>
<li><a name="a319"></a><span class="src-doc"> *  a small database sufficient to test software.</span></li>
<li><a name="a320"></a><span class="src-doc"> */</span></li>
<li><a name="a321"></a>&nbsp;</li>
<li><a name="a322"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB.html">DB</a> <span class="src-sym">{</span></li>
<li><a name="a323"></a>&nbsp;</li>
<li><a name="a324"></a>    <span class="src-doc">/**</span></li>
<li><a name="a325"></a><span class="src-doc">     * Create a new DB object for the specified database type but don't</span></li>
<li><a name="a326"></a><span class="src-doc">     * connect to the database</span></li>
<li><a name="a327"></a><span class="src-doc">     *</span></li>
<li><a name="a328"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$type </span><span class="src-doc">    the database type (eg &quot;mysql&quot;)</span></li>
<li><a name="a329"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$options </span><span class="src-doc"> an associative array of option names and values</span></li>
<li><a name="a330"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">object </span><span class="src-doc"> </span><span class="src-doc-type">a </span><span class="src-doc">new DB object.  A DB_Error object on failure.</span></li>
<li><a name="a331"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption()</span></li>
<li><a name="a332"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB::factory</span></li>
<li><a name="a333"></a><span class="src-doc">     */</span></li>
<li><a name="a334"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB.html#methodfactory">factory</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a335"></a>    <span class="src-sym">{</span></li>
<li><a name="a336"></a><span class="src-comm">//        if (!is_array($options)) {</span></li>
<li><a name="a337"></a><span class="src-comm">//            $options = array('persistent' =&gt; $options);</span></li>
<li><a name="a338"></a><span class="src-comm">//        }</span></li>
<li><a name="a339"></a><span class="src-comm">//</span></li>
<li><a name="a340"></a><span class="src-comm">//        if (isset($options['debug']) &amp;&amp; $options['debug'] &gt;= 2) {</span></li>
<li><a name="a341"></a><span class="src-comm">//            // expose php errors with sufficient debug level</span></li>
<li><a name="a342"></a><span class="src-comm">//            include_once &quot;DB/{$type}.php&quot;;</span></li>
<li><a name="a343"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a344"></a><span class="src-comm">//            @include_once &quot;DB/{$type}.php&quot;;</span></li>
<li><a name="a345"></a><span class="src-comm">//        }</span></li>
<li><a name="a346"></a><span class="src-comm">//</span></li>
<li><a name="a347"></a><span class="src-comm">//        $classname = &quot;DB_${type}&quot;;</span></li>
<li><a name="a348"></a><span class="src-comm">//</span></li>
<li><a name="a349"></a><span class="src-comm">//        if (!class_exists($classname)) {</span></li>
<li><a name="a350"></a><span class="src-comm">//            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,</span></li>
<li><a name="a351"></a><span class="src-comm">//                                    &quot;Unable to include the DB/{$type}.php&quot;</span></li>
<li><a name="a352"></a><span class="src-comm">//                                    . &quot; file for '$dsn'&quot;,</span></li>
<li><a name="a353"></a><span class="src-comm">//                                    'DB_Error', true);</span></li>
<li><a name="a354"></a><span class="src-comm">//            return $tmp;</span></li>
<li><a name="a355"></a><span class="src-comm">//        }</span></li>
<li><a name="a356"></a><span class="src-comm">//</span></li>
<li><a name="a357"></a><span class="src-comm">//        @$obj =&amp; new $classname;</span></li>
<li><a name="a358"></a><span class="src-comm">//</span></li>
<li><a name="a359"></a><span class="src-comm">//        foreach ($options as $option =&gt; $value) {</span></li>
<li><a name="a360"></a><span class="src-comm">//            $test = $obj-&gt;setOption($option, $value);</span></li>
<li><a name="a361"></a><span class="src-comm">//            if (DB::isError($test)) {</span></li>
<li><a name="a362"></a><span class="src-comm">//                return $test;</span></li>
<li><a name="a363"></a><span class="src-comm">//            }</span></li>
<li><a name="a364"></a><span class="src-comm">//        }</span></li>
<li><a name="a365"></a><span class="src-comm">//</span></li>
<li><a name="a366"></a><span class="src-comm">//        return $obj;</span></li>
<li><a name="a367"></a>    <span class="src-sym">}</span></li>
<li><a name="a368"></a>&nbsp;</li>
<li><a name="a369"></a>    <span class="src-doc">/**</span></li>
<li><a name="a370"></a><span class="src-doc">     * Create a new DB object including a connection to the specified database</span></li>
<li><a name="a371"></a><span class="src-doc">     *</span></li>
<li><a name="a372"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$dsn </span><span class="src-doc">     the string &quot;data source name&quot; or array in the</span></li>
<li><a name="a373"></a><span class="src-doc">     *                          format returned by DB::parseDSN()</span></li>
<li><a name="a374"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$options </span><span class="src-doc"> an associative array of option names and values</span></li>
<li><a name="a375"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">object </span><span class="src-doc"> </span><span class="src-doc-type">a </span><span class="src-doc">new DB object.  A DB_Error object on failure.</span></li>
<li><a name="a376"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> DB::parseDSN(), DB_common::setOption(), PEAR::isError()</span></li>
<li><a name="a377"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB::connect</span></li>
<li><a name="a378"></a><span class="src-doc">     */</span></li>
<li><a name="a379"></a>    <span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB.html#methodconnect">connect</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a380"></a>    <span class="src-sym">{</span></li>
<li><a name="a381"></a>        <span class="src-var">$dsninfo </span>= <span class="src-id"><a href="../PHPonTraxTest/DB.html">DB</a></span><span class="src-sym">::</span><a href="../PHPonTraxTest/DB.html#methodparseDSN">parseDSN</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a382"></a>        <span class="src-var">$type </span>= <span class="src-var">$dsninfo</span><span class="src-sym">[</span><span class="src-str">'phptype'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a383"></a>&nbsp;</li>
<li><a name="a384"></a>        <span class="src-comm">// only support MySQL at the moment</span></li>
<li><a name="a385"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">assertEquals</span><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">,</span><span class="src-str">'mysql'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a386"></a>        <span class="src-sym">@</span><span class="src-var">$obj </span>=<span class="src-sym">&amp; </span><span class="src-key">new </span><span class="src-id"><a href="../PHPonTraxTest/DB_mysql.html">DB_mysql</a></span><span class="src-sym">;</span></li>
<li><a name="a387"></a>&nbsp;</li>
<li><a name="a388"></a>        <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$options </span><span class="src-key">as </span><span class="src-var">$option </span>=&gt; <span class="src-var">$value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a389"></a>            <span class="src-var">$test </span>= <span class="src-var">$obj</span><span class="src-sym">-&gt;</span><span class="src-id">setOption</span><span class="src-sym">(</span><span class="src-var">$option</span><span class="src-sym">, </span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a390"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTraxTest/DB.html">DB</a></span><span class="src-sym">::</span><a href="../PHPonTraxTest/DB.html#methodisError">isError</a><span class="src-sym">(</span><span class="src-var">$test</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a391"></a>                <span class="src-key">return </span><span class="src-var">$test</span><span class="src-sym">;</span></li>
<li><a name="a392"></a>            <span class="src-sym">}</span></li>
<li><a name="a393"></a>        <span class="src-sym">}</span></li>
<li><a name="a394"></a>&nbsp;</li>
<li><a name="a395"></a><span class="src-comm">//        $err = $obj-&gt;connect($dsninfo, $obj-&gt;getOption('persistent'));</span></li>
<li><a name="a396"></a><span class="src-comm">//        if (DB::isError($err)) {</span></li>
<li><a name="a397"></a><span class="src-comm">//            $err-&gt;addUserInfo($dsn);</span></li>
<li><a name="a398"></a><span class="src-comm">//            return $err;</span></li>
<li><a name="a399"></a><span class="src-comm">//        }</span></li>
<li><a name="a400"></a><span class="src-comm">//</span></li>
<li><a name="a401"></a>        <span class="src-key">return </span><span class="src-var">$obj</span><span class="src-sym">;</span></li>
<li><a name="a402"></a>    <span class="src-sym">}</span></li>
<li><a name="a403"></a>&nbsp;</li>
<li><a name="a404"></a>    <span class="src-doc">/**</span></li>
<li><a name="a405"></a><span class="src-doc">     * Return the DB API version</span></li>
<li><a name="a406"></a><span class="src-doc">     *</span></li>
<li><a name="a407"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the DB API version number</span></li>
<li><a name="a408"></a><span class="src-doc">     */</span></li>
<li><a name="a409"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methodapiVersion">apiVersion</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a410"></a>    <span class="src-sym">{</span></li>
<li><a name="a411"></a>        <span class="src-key">return </span><span class="src-str">'1.7.6'</span><span class="src-sym">;</span></li>
<li><a name="a412"></a>    <span class="src-sym">}</span></li>
<li><a name="a413"></a>&nbsp;</li>
<li><a name="a414"></a>    <span class="src-doc">/**</span></li>
<li><a name="a415"></a><span class="src-doc">     * Determines if a variable is a DB_Error object</span></li>
<li><a name="a416"></a><span class="src-doc">     *</span></li>
<li><a name="a417"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$value </span><span class="src-doc"> the variable to check</span></li>
<li><a name="a418"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> whether $value is DB_Error object</span></li>
<li><a name="a419"></a><span class="src-doc">     */</span></li>
<li><a name="a420"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methodisError">isError</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span></li>
<li><a name="a421"></a>    <span class="src-sym">{</span></li>
<li><a name="a422"></a>        <span class="src-key">return </span><a href="http://www.php.net/is_a">is_a</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">, </span><span class="src-str">'DB_Error'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a423"></a>    <span class="src-sym">}</span></li>
<li><a name="a424"></a>&nbsp;</li>
<li><a name="a425"></a>    <span class="src-doc">/**</span></li>
<li><a name="a426"></a><span class="src-doc">     * Determines if a value is a DB_&lt;driver&gt; object</span></li>
<li><a name="a427"></a><span class="src-doc">     *</span></li>
<li><a name="a428"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$value </span><span class="src-doc"> the value to test</span></li>
<li><a name="a429"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> whether $value is a DB_&lt;driver&gt; object</span></li>
<li><a name="a430"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB::isConnection</span></li>
<li><a name="a431"></a><span class="src-doc">     */</span></li>
<li><a name="a432"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methodisConnection">isConnection</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span></li>
<li><a name="a433"></a>    <span class="src-sym">{</span></li>
<li><a name="a434"></a><span class="src-comm">//        return (is_object($value) &amp;&amp;</span></li>
<li><a name="a435"></a><span class="src-comm">//                is_subclass_of($value, 'db_common') &amp;&amp;</span></li>
<li><a name="a436"></a><span class="src-comm">//                method_exists($value, 'simpleQuery'));</span></li>
<li><a name="a437"></a>    <span class="src-sym">}</span></li>
<li><a name="a438"></a>&nbsp;</li>
<li><a name="a439"></a>    <span class="src-doc">/**</span></li>
<li><a name="a440"></a><span class="src-doc">     * Tell whether a query is a data manipulation or data definition query</span></li>
<li><a name="a441"></a><span class="src-doc">     *</span></li>
<li><a name="a442"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc"> the query</span></li>
<li><a name="a443"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc"> whether $query is a data manipulation query</span></li>
<li><a name="a444"></a><span class="src-doc">     */</span></li>
<li><a name="a445"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methodisManip">isManip</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">)</span></li>
<li><a name="a446"></a>    <span class="src-sym">{</span></li>
<li><a name="a447"></a>        <span class="src-var">$manips </span>= <span class="src-str">'INSERT|UPDATE|DELETE|REPLACE|'</span></li>
<li><a name="a448"></a>                . <span class="src-str">'CREATE|DROP|'</span></li>
<li><a name="a449"></a>                . <span class="src-str">'LOAD DATA|SELECT .* INTO|COPY|'</span></li>
<li><a name="a450"></a>                . <span class="src-str">'ALTER|GRANT|REVOKE|'</span></li>
<li><a name="a451"></a>                . <span class="src-str">'LOCK|UNLOCK'</span><span class="src-sym">;</span></li>
<li><a name="a452"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/^\s*&quot;?(' </span>. <span class="src-var">$manips </span>. <span class="src-str">')\s+/i'</span><span class="src-sym">, </span><span class="src-var">$query</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a453"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a454"></a>        <span class="src-sym">}</span></li>
<li><a name="a455"></a>        <span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a456"></a>    <span class="src-sym">}</span></li>
<li><a name="a457"></a>&nbsp;</li>
<li><a name="a458"></a>    <span class="src-doc">/**</span></li>
<li><a name="a459"></a><span class="src-doc">     * Return a textual error message for a DB error code</span></li>
<li><a name="a460"></a><span class="src-doc">     *</span></li>
<li><a name="a461"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$value </span><span class="src-doc"> the DB error code</span></li>
<li><a name="a462"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the error message or false if the error code was</span></li>
<li><a name="a463"></a><span class="src-doc">     *                   not recognized</span></li>
<li><a name="a464"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB::errorMessage</span></li>
<li><a name="a465"></a><span class="src-doc">     */</span></li>
<li><a name="a466"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methoderrorMessage">errorMessage</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span></li>
<li><a name="a467"></a>    <span class="src-sym">{</span></li>
<li><a name="a468"></a>        <span class="src-key">static </span><span class="src-var">$errorMessages</span><span class="src-sym">;</span></li>
<li><a name="a469"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$errorMessages</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a470"></a>            <span class="src-var">$errorMessages </span>= <span class="src-key">array</span><span class="src-sym">(</span></li>
<li><a name="a471"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR">DB_ERROR</a>                    </span>=&gt; <span class="src-str">'unknown error'</span><span class="src-sym">,</span></li>
<li><a name="a472"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_ACCESS_VIOLATION">DB_ERROR_ACCESS_VIOLATION</a>   </span>=&gt; <span class="src-str">'insufficient permissions'</span><span class="src-sym">,</span></li>
<li><a name="a473"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_ALREADY_EXISTS">DB_ERROR_ALREADY_EXISTS</a>     </span>=&gt; <span class="src-str">'already exists'</span><span class="src-sym">,</span></li>
<li><a name="a474"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_CANNOT_CREATE">DB_ERROR_CANNOT_CREATE</a>      </span>=&gt; <span class="src-str">'can not create'</span><span class="src-sym">,</span></li>
<li><a name="a475"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_CANNOT_DROP">DB_ERROR_CANNOT_DROP</a>        </span>=&gt; <span class="src-str">'can not drop'</span><span class="src-sym">,</span></li>
<li><a name="a476"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_CONNECT_FAILED">DB_ERROR_CONNECT_FAILED</a>     </span>=&gt; <span class="src-str">'connect failed'</span><span class="src-sym">,</span></li>
<li><a name="a477"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_CONSTRAINT">DB_ERROR_CONSTRAINT</a>         </span>=&gt; <span class="src-str">'constraint violation'</span><span class="src-sym">,</span></li>
<li><a name="a478"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_CONSTRAINT_NOT_NULL">DB_ERROR_CONSTRAINT_NOT_NULL</a></span>=&gt; <span class="src-str">'null value violates not-null constraint'</span><span class="src-sym">,</span></li>
<li><a name="a479"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_DIVZERO">DB_ERROR_DIVZERO</a>            </span>=&gt; <span class="src-str">'division by zero'</span><span class="src-sym">,</span></li>
<li><a name="a480"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_EXTENSION_NOT_FOUND">DB_ERROR_EXTENSION_NOT_FOUND</a></span>=&gt; <span class="src-str">'extension not found'</span><span class="src-sym">,</span></li>
<li><a name="a481"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_INVALID">DB_ERROR_INVALID</a>            </span>=&gt; <span class="src-str">'invalid'</span><span class="src-sym">,</span></li>
<li><a name="a482"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_INVALID_DATE">DB_ERROR_INVALID_DATE</a>       </span>=&gt; <span class="src-str">'invalid date or time'</span><span class="src-sym">,</span></li>
<li><a name="a483"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_INVALID_DSN">DB_ERROR_INVALID_DSN</a>        </span>=&gt; <span class="src-str">'invalid DSN'</span><span class="src-sym">,</span></li>
<li><a name="a484"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_INVALID_NUMBER">DB_ERROR_INVALID_NUMBER</a>     </span>=&gt; <span class="src-str">'invalid number'</span><span class="src-sym">,</span></li>
<li><a name="a485"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_MISMATCH">DB_ERROR_MISMATCH</a>           </span>=&gt; <span class="src-str">'mismatch'</span><span class="src-sym">,</span></li>
<li><a name="a486"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NEED_MORE_DATA">DB_ERROR_NEED_MORE_DATA</a>     </span>=&gt; <span class="src-str">'insufficient data supplied'</span><span class="src-sym">,</span></li>
<li><a name="a487"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NODBSELECTED">DB_ERROR_NODBSELECTED</a>       </span>=&gt; <span class="src-str">'no database selected'</span><span class="src-sym">,</span></li>
<li><a name="a488"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOSUCHDB">DB_ERROR_NOSUCHDB</a>           </span>=&gt; <span class="src-str">'no such database'</span><span class="src-sym">,</span></li>
<li><a name="a489"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOSUCHFIELD">DB_ERROR_NOSUCHFIELD</a>        </span>=&gt; <span class="src-str">'no such field'</span><span class="src-sym">,</span></li>
<li><a name="a490"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOSUCHTABLE">DB_ERROR_NOSUCHTABLE</a>        </span>=&gt; <span class="src-str">'no such table'</span><span class="src-sym">,</span></li>
<li><a name="a491"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOT_CAPABLE">DB_ERROR_NOT_CAPABLE</a>        </span>=&gt; <span class="src-str">'DB backend not capable'</span><span class="src-sym">,</span></li>
<li><a name="a492"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOT_FOUND">DB_ERROR_NOT_FOUND</a>          </span>=&gt; <span class="src-str">'not found'</span><span class="src-sym">,</span></li>
<li><a name="a493"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOT_LOCKED">DB_ERROR_NOT_LOCKED</a>         </span>=&gt; <span class="src-str">'not locked'</span><span class="src-sym">,</span></li>
<li><a name="a494"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_SYNTAX">DB_ERROR_SYNTAX</a>             </span>=&gt; <span class="src-str">'syntax error'</span><span class="src-sym">,</span></li>
<li><a name="a495"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_UNSUPPORTED">DB_ERROR_UNSUPPORTED</a>        </span>=&gt; <span class="src-str">'not supported'</span><span class="src-sym">,</span></li>
<li><a name="a496"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_TRUNCATED">DB_ERROR_TRUNCATED</a>          </span>=&gt; <span class="src-str">'truncated'</span><span class="src-sym">,</span></li>
<li><a name="a497"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_VALUE_COUNT_ON_ROW">DB_ERROR_VALUE_COUNT_ON_ROW</a> </span>=&gt; <span class="src-str">'value count on row'</span><span class="src-sym">,</span></li>
<li><a name="a498"></a>                <span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a>                       </span>=&gt; <span class="src-str">'no error'</span><span class="src-sym">,</span></li>
<li><a name="a499"></a>            <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a500"></a>        <span class="src-sym">}</span></li>
<li><a name="a501"></a>&nbsp;</li>
<li><a name="a502"></a><span class="src-comm">//        if (DB::isError($value)) {</span></li>
<li><a name="a503"></a><span class="src-comm">//            $value = $value-&gt;getCode();</span></li>
<li><a name="a504"></a><span class="src-comm">//        }</span></li>
<li><a name="a505"></a><span class="src-comm">//</span></li>
<li><a name="a506"></a><span class="src-comm">//        return isset($errorMessages[$value]) ? $errorMessages[$value]</span></li>
<li><a name="a507"></a><span class="src-comm">//                     : $errorMessages[DB_ERROR];</span></li>
<li><a name="a508"></a>    <span class="src-sym">}</span></li>
<li><a name="a509"></a>&nbsp;</li>
<li><a name="a510"></a>    <span class="src-doc">/**</span></li>
<li><a name="a511"></a><span class="src-doc">     * Parse a data source name</span></li>
<li><a name="a512"></a><span class="src-doc">     *</span></li>
<li><a name="a513"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$dsn </span><span class="src-doc">Data Source Name to be parsed</span></li>
<li><a name="a514"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc">an associative array with the following keys:</span></li>
<li><a name="a515"></a><span class="src-doc">     *   + phptype:  Database backend used in PHP (mysql, odbc etc.)</span></li>
<li><a name="a516"></a><span class="src-doc">     *   + dbsyntax: Database used with regards to SQL syntax etc.</span></li>
<li><a name="a517"></a><span class="src-doc">     *   + protocol: Communication protocol to use (tcp, unix etc.)</span></li>
<li><a name="a518"></a><span class="src-doc">     *   + hostspec: Host specification (hostname[:port])</span></li>
<li><a name="a519"></a><span class="src-doc">     *   + database: Database to use on the DBMS server</span></li>
<li><a name="a520"></a><span class="src-doc">     *   + username: User name for login</span></li>
<li><a name="a521"></a><span class="src-doc">     *   + password: Password for login</span></li>
<li><a name="a522"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB::parseDSN</span></li>
<li><a name="a523"></a><span class="src-doc">     */</span></li>
<li><a name="a524"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB.html#methodparseDSN">parseDSN</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)</span></li>
<li><a name="a525"></a>    <span class="src-sym">{</span></li>
<li><a name="a526"></a>        <span class="src-var">$parsed </span>= <span class="src-key">array</span><span class="src-sym">(</span></li>
<li><a name="a527"></a>            <span class="src-str">'phptype'  </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a528"></a>            <span class="src-str">'dbsyntax' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a529"></a>            <span class="src-str">'username' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a530"></a>            <span class="src-str">'password' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a531"></a>            <span class="src-str">'protocol' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a532"></a>            <span class="src-str">'hostspec' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a533"></a>            <span class="src-str">'port'     </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a534"></a>            <span class="src-str">'socket'   </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a535"></a>            <span class="src-str">'database' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a536"></a>        <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a537"></a>&nbsp;</li>
<li><a name="a538"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a539"></a>            <span class="src-var">$dsn </span>= <a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$parsed</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a540"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$dsn</span><span class="src-sym">[</span><span class="src-str">'dbsyntax'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a541"></a>                <span class="src-var">$dsn</span><span class="src-sym">[</span><span class="src-str">'dbsyntax'</span><span class="src-sym">] </span>= <span class="src-var">$dsn</span><span class="src-sym">[</span><span class="src-str">'phptype'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a542"></a>            <span class="src-sym">}</span></li>
<li><a name="a543"></a>            <span class="src-key">return </span><span class="src-var">$dsn</span><span class="src-sym">;</span></li>
<li><a name="a544"></a>        <span class="src-sym">}</span></li>
<li><a name="a545"></a>&nbsp;</li>
<li><a name="a546"></a>        <span class="src-comm">// Find phptype and dbsyntax</span></li>
<li><a name="a547"></a>        <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$pos </span>= <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-str">'://'</span><span class="src-sym">)) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a548"></a>            <span class="src-var">$str </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$pos</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a549"></a>            <span class="src-var">$dsn </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$pos </span>+ <span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a550"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a551"></a>            <span class="src-var">$str </span>= <span class="src-var">$dsn</span><span class="src-sym">;</span></li>
<li><a name="a552"></a>            <span class="src-var">$dsn </span>= <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a553"></a>        <span class="src-sym">}</span></li>
<li><a name="a554"></a>&nbsp;</li>
<li><a name="a555"></a>        <span class="src-comm">// Get phptype and dbsyntax</span></li>
<li><a name="a556"></a>        <span class="src-comm">// $str =&gt; phptype(dbsyntax)</span></li>
<li><a name="a557"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'|^(.+?)\((.*?)\)$|'</span><span class="src-sym">, </span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-var">$arr</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a558"></a>            <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'phptype'</span><span class="src-sym">]  </span>= <span class="src-var">$arr</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a559"></a>            <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'dbsyntax'</span><span class="src-sym">] </span>= <span class="src-sym">!</span><span class="src-var">$arr</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>? <span class="src-var">$arr</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">] </span>: <span class="src-var">$arr</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a560"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a561"></a>            <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'phptype'</span><span class="src-sym">]  </span>= <span class="src-var">$str</span><span class="src-sym">;</span></li>
<li><a name="a562"></a>            <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'dbsyntax'</span><span class="src-sym">] </span>= <span class="src-var">$str</span><span class="src-sym">;</span></li>
<li><a name="a563"></a>        <span class="src-sym">}</span></li>
<li><a name="a564"></a>&nbsp;</li>
<li><a name="a565"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a566"></a>            <span class="src-key">return </span><span class="src-var">$parsed</span><span class="src-sym">;</span></li>
<li><a name="a567"></a>        <span class="src-sym">}</span></li>
<li><a name="a568"></a>&nbsp;</li>
<li><a name="a569"></a>        <span class="src-comm">// Get (if found): username and password</span></li>
<li><a name="a570"></a>        <span class="src-comm">// $dsn =&gt; username:hide@address.com+hostspec/database</span></li>
<li><a name="a571"></a>        <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$at </span>= <a href="http://www.php.net/strrpos">strrpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">,</span><span class="src-str">'@'</span><span class="src-sym">)) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a572"></a>            <span class="src-var">$str </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$at</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a573"></a>            <span class="src-var">$dsn </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$at </span>+ <span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a574"></a>            <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$pos </span>= <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-str">':'</span><span class="src-sym">)) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a575"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'username'</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$pos</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a576"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'password'</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">, </span><span class="src-var">$pos </span>+ <span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a577"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a578"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'username'</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a579"></a>            <span class="src-sym">}</span></li>
<li><a name="a580"></a>        <span class="src-sym">}</span></li>
<li><a name="a581"></a>&nbsp;</li>
<li><a name="a582"></a>        <span class="src-comm">// Find protocol and hostspec</span></li>
<li><a name="a583"></a>&nbsp;</li>
<li><a name="a584"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'|^([^(]+)\((.*?)\)/?(.*?)$|'</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$match</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a585"></a>            <span class="src-comm">// $dsn =&gt; proto(proto_opts)/database</span></li>
<li><a name="a586"></a>            <span class="src-var">$proto       </span>= <span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a587"></a>            <span class="src-var">$proto_opts  </span>= <span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>? <span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">] </span>: <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a588"></a>            <span class="src-var">$dsn         </span>= <span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">3</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a589"></a>&nbsp;</li>
<li><a name="a590"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a591"></a>            <span class="src-comm">// $dsn =&gt; protocol+hostspec/database (old format)</span></li>
<li><a name="a592"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-str">'+'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a593"></a>                list<span class="src-sym">(</span><span class="src-var">$proto</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'+'</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a594"></a>            <span class="src-sym">}</span></li>
<li><a name="a595"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-str">'/'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a596"></a>                list<span class="src-sym">(</span><span class="src-var">$proto_opts</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'/'</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a597"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a598"></a>                <span class="src-var">$proto_opts </span>= <span class="src-var">$dsn</span><span class="src-sym">;</span></li>
<li><a name="a599"></a>                <span class="src-var">$dsn </span>= <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a600"></a>            <span class="src-sym">}</span></li>
<li><a name="a601"></a>        <span class="src-sym">}</span></li>
<li><a name="a602"></a>&nbsp;</li>
<li><a name="a603"></a>        <span class="src-comm">// process the different protocol options</span></li>
<li><a name="a604"></a>        <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'protocol'</span><span class="src-sym">] </span>= <span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$proto</span><span class="src-sym">)) </span>? <span class="src-var">$proto </span>: <span class="src-str">'tcp'</span><span class="src-sym">;</span></li>
<li><a name="a605"></a>        <span class="src-var">$proto_opts </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><span class="src-var">$proto_opts</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a606"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'protocol'</span><span class="src-sym">] </span>== <span class="src-str">'tcp'</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a607"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$proto_opts</span><span class="src-sym">, </span><span class="src-str">':'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a608"></a>                list<span class="src-sym">(</span><span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'hostspec'</span><span class="src-sym">]</span><span class="src-sym">,</span></li>
<li><a name="a609"></a>                     <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'port'</span><span class="src-sym">]</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">':'</span><span class="src-sym">, </span><span class="src-var">$proto_opts</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a610"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a611"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'hostspec'</span><span class="src-sym">] </span>= <span class="src-var">$proto_opts</span><span class="src-sym">;</span></li>
<li><a name="a612"></a>            <span class="src-sym">}</span></li>
<li><a name="a613"></a>        <span class="src-sym">} </span><span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'protocol'</span><span class="src-sym">] </span>== <span class="src-str">'unix'</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a614"></a>            <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'socket'</span><span class="src-sym">] </span>= <span class="src-var">$proto_opts</span><span class="src-sym">;</span></li>
<li><a name="a615"></a>        <span class="src-sym">}</span></li>
<li><a name="a616"></a>&nbsp;</li>
<li><a name="a617"></a>        <span class="src-comm">// Get dabase if any</span></li>
<li><a name="a618"></a>        <span class="src-comm">// $dsn =&gt; database</span></li>
<li><a name="a619"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a620"></a>            <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$pos </span>= <a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-str">'?'</span><span class="src-sym">)) </span>=== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a621"></a>                <span class="src-comm">// /database</span></li>
<li><a name="a622"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'database'</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a623"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a624"></a>                <span class="src-comm">// /database?param1=value1&amp;param2=value2</span></li>
<li><a name="a625"></a>                <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-str">'database'</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$pos</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a626"></a>                <span class="src-var">$dsn </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$pos </span>+ <span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a627"></a>                <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-str">'&amp;'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a628"></a>                    <span class="src-var">$opts </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">, </span><span class="src-var">$dsn</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a629"></a>                <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{ </span><span class="src-comm">// database?param1=value1</span></li>
<li><a name="a630"></a>                    <span class="src-var">$opts </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a631"></a>                <span class="src-sym">}</span></li>
<li><a name="a632"></a>                <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$opts </span><span class="src-key">as </span><span class="src-var">$opt</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a633"></a>                    list<span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">, </span><span class="src-var">$value</span><span class="src-sym">) </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'='</span><span class="src-sym">, </span><span class="src-var">$opt</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a634"></a>                    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">]</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a635"></a>                        <span class="src-comm">// don't allow params overwrite</span></li>
<li><a name="a636"></a>                        <span class="src-var">$parsed</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">] </span>= <a href="http://www.php.net/rawurldecode">rawurldecode</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a637"></a>                    <span class="src-sym">}</span></li>
<li><a name="a638"></a>                <span class="src-sym">}</span></li>
<li><a name="a639"></a>            <span class="src-sym">}</span></li>
<li><a name="a640"></a>        <span class="src-sym">}</span></li>
<li><a name="a641"></a>&nbsp;</li>
<li><a name="a642"></a>        <span class="src-key">return </span><span class="src-var">$parsed</span><span class="src-sym">;</span></li>
<li><a name="a643"></a>    <span class="src-sym">}</span></li>
<li><a name="a644"></a><span class="src-sym">}</span></li>
<li><a name="a645"></a>&nbsp;</li>
<li><a name="a646"></a><span class="src-doc">/**</span></li>
<li><a name="a647"></a><span class="src-doc"> *  Mock DB_common for testing</span></li>
<li><a name="a648"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common class</span></li>
<li><a name="a649"></a><span class="src-doc"> */</span></li>
<li><a name="a650"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB_common.html">DB_common</a> <span class="src-key">extends </span><span class="src-id">PEAR </span><span class="src-sym">{</span></li>
<li><a name="a651"></a>&nbsp;</li>
<li><a name="a652"></a>    <span class="src-doc">/**</span></li>
<li><a name="a653"></a><span class="src-doc">     *  Mock Database</span></li>
<li><a name="a654"></a><span class="src-doc">     */</span></li>
<li><a name="a655"></a>    <span class="src-key">protected </span><span class="src-key">static </span><span class="src-var">$database </span>=</li>
<li><a name="a656"></a>        <span class="src-comm">//  Person names table</span></li>
<li><a name="a657"></a>                <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'person_names' </span>=&gt;</li>
<li><a name="a658"></a>              <span class="src-comm">//  Description</span></li>
<li><a name="a659"></a>                            <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'info' </span>=&gt;</li>
<li><a name="a660"></a>                    <span class="src-key">array</span><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a661"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'id'</span><span class="src-sym">,</span></li>
<li><a name="a662"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'int'</span><span class="src-sym">,</span></li>
<li><a name="a663"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a664"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">'primary_key not_null'</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a665"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a666"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'prefix'</span><span class="src-sym">,</span></li>
<li><a name="a667"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'string'</span><span class="src-sym">,</span></li>
<li><a name="a668"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a669"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a670"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a671"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'first_name'</span><span class="src-sym">,</span></li>
<li><a name="a672"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'string'</span><span class="src-sym">,</span></li>
<li><a name="a673"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'40'</span><span class="src-sym">,</span></li>
<li><a name="a674"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a675"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a676"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'mi'</span><span class="src-sym">,</span></li>
<li><a name="a677"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'string'</span><span class="src-sym">,</span></li>
<li><a name="a678"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'1'</span><span class="src-sym">,</span></li>
<li><a name="a679"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a680"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a681"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'last_name'</span><span class="src-sym">,</span></li>
<li><a name="a682"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'string'</span><span class="src-sym">,</span></li>
<li><a name="a683"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'40'</span><span class="src-sym">,</span></li>
<li><a name="a684"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a685"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'table' </span>=&gt; <span class="src-str">'person_names'</span><span class="src-sym">,</span></li>
<li><a name="a686"></a>                                <span class="src-str">'name'  </span>=&gt; <span class="src-str">'suffix'</span><span class="src-sym">,</span></li>
<li><a name="a687"></a>                                <span class="src-str">'type'  </span>=&gt; <span class="src-str">'string'</span><span class="src-sym">,</span></li>
<li><a name="a688"></a>                                <span class="src-str">'len'   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a689"></a>                                <span class="src-str">'flags' </span>=&gt; <span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a690"></a>                          <span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a691"></a>                    <span class="src-str">'data' </span>=&gt;</li>
<li><a name="a692"></a>                    <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a693"></a>                    <span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a694"></a>&nbsp;</li>
<li><a name="a695"></a>              <span class="src-comm">//  Data types table</span></li>
<li><a name="a696"></a>                            <span class="src-str">'data_types' </span>=&gt;</li>
<li><a name="a697"></a>&nbsp;</li>
<li><a name="a698"></a>              <span class="src-comm">//  Description</span></li>
<li><a name="a699"></a>                            <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'info' </span>=&gt;</li>
<li><a name="a700"></a>                    <span class="src-key">array</span><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a701"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;id&quot;</span><span class="src-sym">,</span></li>
<li><a name="a702"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a703"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a704"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;not_null primary_key auto_increment&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a705"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a706"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;bit_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a707"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a708"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'1'</span><span class="src-sym">,</span></li>
<li><a name="a709"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a710"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a711"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;tinyint_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a712"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a713"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'4'</span><span class="src-sym">,</span></li>
<li><a name="a714"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a715"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a716"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;bool_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a717"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a718"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'1'</span><span class="src-sym">,</span></li>
<li><a name="a719"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a720"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a721"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;boolean_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a722"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a723"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'1'</span><span class="src-sym">,</span></li>
<li><a name="a724"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a725"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a726"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;smallint_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a727"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a728"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'6'</span><span class="src-sym">,</span></li>
<li><a name="a729"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a730"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a731"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;mediumint_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a732"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a733"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'9'</span><span class="src-sym">,</span></li>
<li><a name="a734"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a735"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot;   </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a736"></a>                                <span class="src-str">&quot;name&quot;    </span>=&gt;  <span class="src-str">&quot;int_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a737"></a>                                <span class="src-str">&quot;type&quot;    </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a738"></a>                                <span class="src-str">&quot;len&quot;     </span>=&gt;  <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a739"></a>                                <span class="src-str">&quot;flags&quot;   </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a740"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a741"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;integer_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a742"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a743"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a744"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a745"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a746"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;bigint_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a747"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;int&quot;</span><span class="src-sym">,</span></li>
<li><a name="a748"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a749"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a750"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a751"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;float_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a752"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a753"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'12'</span><span class="src-sym">,</span></li>
<li><a name="a754"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a755"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a756"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;double_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a757"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a758"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'22'</span><span class="src-sym">,</span></li>
<li><a name="a759"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a760"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a761"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;double_precision_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a762"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a763"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'22'</span><span class="src-sym">,</span></li>
<li><a name="a764"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a765"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a766"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;decimal_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a767"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a768"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a769"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a770"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt;  <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a771"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt;  <span class="src-str">&quot;dec_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a772"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt;  <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a773"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt;  <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a774"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt;  <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a775"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a776"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;numeric_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a777"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a778"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a779"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a780"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a781"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;fixed_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a782"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;real&quot;</span><span class="src-sym">,</span></li>
<li><a name="a783"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'11'</span><span class="src-sym">,</span></li>
<li><a name="a784"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a785"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a786"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;date_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a787"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;date&quot;</span><span class="src-sym">,</span></li>
<li><a name="a788"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'10'</span><span class="src-sym">,</span></li>
<li><a name="a789"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a790"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a791"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;datetime_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a792"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;datetime&quot;</span><span class="src-sym">,</span></li>
<li><a name="a793"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'19'</span><span class="src-sym">,</span></li>
<li><a name="a794"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a795"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a796"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;timestamp_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a797"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;timestamp&quot;</span><span class="src-sym">,</span></li>
<li><a name="a798"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'19'</span><span class="src-sym">,</span></li>
<li><a name="a799"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;unsigned zerofill binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a800"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a801"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;time_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a802"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;time&quot;</span><span class="src-sym">,</span></li>
<li><a name="a803"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'8'</span><span class="src-sym">,</span></li>
<li><a name="a804"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a805"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a806"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;year_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a807"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;year&quot;</span><span class="src-sym">,</span></li>
<li><a name="a808"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'4'</span><span class="src-sym">,</span></li>
<li><a name="a809"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;unsigned zerofill&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a810"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a811"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;char_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a812"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a813"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a814"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a815"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a816"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;varchar_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a817"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a818"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a819"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a820"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a821"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;nchar_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a822"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a823"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a824"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a825"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a826"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;binary_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a827"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a828"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a829"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a830"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a831"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;varbinary_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a832"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a833"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'20'</span><span class="src-sym">,</span></li>
<li><a name="a834"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a835"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a836"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;tinyblob_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a837"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a838"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'255'</span><span class="src-sym">,</span></li>
<li><a name="a839"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a840"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a841"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;tinytext_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a842"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a843"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'255'</span><span class="src-sym">,</span></li>
<li><a name="a844"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a845"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a846"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;blob_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a847"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a848"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'65535'</span><span class="src-sym">,</span></li>
<li><a name="a849"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a850"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a851"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;text_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a852"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a853"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'65535'</span><span class="src-sym">,</span></li>
<li><a name="a854"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a855"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a856"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;mediumblob_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a857"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a858"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'16777215'</span><span class="src-sym">,</span></li>
<li><a name="a859"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a860"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a861"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;mediumtext_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a862"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a863"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'16777215'</span><span class="src-sym">,</span></li>
<li><a name="a864"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a865"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a866"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;longblob_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a867"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a868"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'-1'</span><span class="src-sym">,</span></li>
<li><a name="a869"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob binary&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a870"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a871"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;longtext_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a872"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">,</span></li>
<li><a name="a873"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'-1'</span><span class="src-sym">,</span></li>
<li><a name="a874"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;blob&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a875"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a876"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;enum_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a877"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a878"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'3'</span><span class="src-sym">,</span></li>
<li><a name="a879"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;enum&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a880"></a>                          <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;table&quot; </span>=&gt; <span class="src-str">&quot;data_types&quot;</span><span class="src-sym">,</span></li>
<li><a name="a881"></a>                                <span class="src-str">&quot;name&quot;  </span>=&gt; <span class="src-str">&quot;set_type&quot;</span><span class="src-sym">,</span></li>
<li><a name="a882"></a>                                <span class="src-str">&quot;type&quot;  </span>=&gt; <span class="src-str">&quot;string&quot;</span><span class="src-sym">,</span></li>
<li><a name="a883"></a>                                <span class="src-str">&quot;len&quot;   </span>=&gt; <span class="src-str">'7'</span><span class="src-sym">,</span></li>
<li><a name="a884"></a>                                <span class="src-str">&quot;flags&quot; </span>=&gt; <span class="src-str">&quot;set&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a885"></a>                          <span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a886"></a>                    <span class="src-str">'data' </span>=&gt;</li>
<li><a name="a887"></a>                    <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a888"></a>                    <span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a889"></a>              <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a890"></a>&nbsp;</li>
<li><a name="a891"></a>    <span class="src-doc">/**</span></li>
<li><a name="a892"></a><span class="src-doc">     * Run-time configuration options</span></li>
<li><a name="a893"></a><span class="src-doc">     *</span></li>
<li><a name="a894"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></li>
<li><a name="a895"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption()</span></li>
<li><a name="a896"></a><span class="src-doc">     */</span></li>
<li><a name="a897"></a>    <span class="src-key">var </span><a href="../PHPonTraxTest/DB_common.html#var$options">$options</a> = <span class="src-key">array</span><span class="src-sym">(</span></li>
<li><a name="a898"></a>        <span class="src-str">'result_buffering' </span>=&gt; <span class="src-num">500</span><span class="src-sym">,</span></li>
<li><a name="a899"></a>        <span class="src-str">'persistent' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a900"></a>        <span class="src-str">'ssl' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a901"></a>        <span class="src-str">'debug' </span>=&gt; <span class="src-num">0</span><span class="src-sym">,</span></li>
<li><a name="a902"></a>        <span class="src-str">'seqname_format' </span>=&gt; <span class="src-str">'%s_seq'</span><span class="src-sym">,</span></li>
<li><a name="a903"></a>        <span class="src-str">'autofree' </span>=&gt; <span class="src-id">false</span><span class="src-sym">,</span></li>
<li><a name="a904"></a>        <span class="src-str">'portability' </span>=&gt; <span class="src-id">DB_PORTABILITY_NONE</span><span class="src-sym">,</span></li>
<li><a name="a905"></a>        <span class="src-str">'optimize' </span>=&gt; <span class="src-str">'performance'</span><span class="src-sym">,  </span><span class="src-comm">// Deprecated.  Use 'portability'.</span></li>
<li><a name="a906"></a>        <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a907"></a>&nbsp;</li>
<li><a name="a908"></a>    <span class="src-doc">/**</span></li>
<li><a name="a909"></a><span class="src-doc">     *  List of expected queries and returns</span></li>
<li><a name="a910"></a><span class="src-doc">     */</span></li>
<li><a name="a911"></a>    <span class="src-key">private </span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">$expected_list</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a912"></a>&nbsp;</li>
<li><a name="a913"></a>    <span class="src-doc">/**</span></li>
<li><a name="a914"></a><span class="src-doc">     *  Cursor in list of expected queries and returns</span></li>
<li><a name="a915"></a><span class="src-doc">     */</span></li>
<li><a name="a916"></a>    <span class="src-key">private </span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">$expected_list_cursor</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a917"></a>&nbsp;</li>
<li><a name="a918"></a>    <span class="src-doc">/**</span></li>
<li><a name="a919"></a><span class="src-doc">     *  Expected query</span></li>
<li><a name="a920"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a921"></a><span class="src-doc">     */</span></li>
<li><a name="a922"></a>    <span class="src-key">private </span><a href="../PHPonTraxTest/DB_common.html#var$expected_query">$expected_query</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a923"></a>&nbsp;</li>
<li><a name="a924"></a>    <span class="src-doc">/**</span></li>
<li><a name="a925"></a><span class="src-doc">     *  Result to be returned from expected query</span></li>
<li><a name="a926"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a927"></a><span class="src-doc">     */</span></li>
<li><a name="a928"></a>    <span class="src-key">private </span><a href="../PHPonTraxTest/DB_common.html#var$expected_result">$expected_result</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a929"></a>&nbsp;</li>
<li><a name="a930"></a>    <span class="src-doc">/**</span></li>
<li><a name="a931"></a><span class="src-doc">     * This constructor calls &lt;kbd&gt;$this-&gt;PEAR('DB_Error')&lt;/kbd&gt;</span></li>
<li><a name="a932"></a><span class="src-doc">     *</span></li>
<li><a name="a933"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a934"></a><span class="src-doc">     */</span></li>
<li><a name="a935"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodDB_common">DB_common</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a936"></a>    <span class="src-sym">{</span></li>
<li><a name="a937"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">PEAR</span><span class="src-sym">(</span><span class="src-str">'DB_Error'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a938"></a>    <span class="src-sym">}</span></li>
<li><a name="a939"></a>&nbsp;</li>
<li><a name="a940"></a>    <span class="src-doc">/**</span></li>
<li><a name="a941"></a><span class="src-doc">     * Automatically indicates which properties should be saved</span></li>
<li><a name="a942"></a><span class="src-doc">     * when PHP's serialize() function is called</span></li>
<li><a name="a943"></a><span class="src-doc">     *</span></li>
<li><a name="a944"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> the array of properties names that should be saved</span></li>
<li><a name="a945"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::__sleep</span></li>
<li><a name="a946"></a><span class="src-doc">     */</span></li>
<li><a name="a947"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#method__sleep">__sleep</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a948"></a>    <span class="src-sym">{</span></li>
<li><a name="a949"></a><span class="src-comm">//        if ($this-&gt;connection) {</span></li>
<li><a name="a950"></a><span class="src-comm">//            // Don't disconnect(), people use serialize() for many reasons</span></li>
<li><a name="a951"></a><span class="src-comm">//            $this-&gt;was_connected = true;</span></li>
<li><a name="a952"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a953"></a><span class="src-comm">//            $this-&gt;was_connected = false;</span></li>
<li><a name="a954"></a><span class="src-comm">//        }</span></li>
<li><a name="a955"></a><span class="src-comm">//        if (isset($this-&gt;autocommit)) {</span></li>
<li><a name="a956"></a><span class="src-comm">//            return array('autocommit',</span></li>
<li><a name="a957"></a><span class="src-comm">//                         'dbsyntax',</span></li>
<li><a name="a958"></a><span class="src-comm">//                         'dsn',</span></li>
<li><a name="a959"></a><span class="src-comm">//                         'features',</span></li>
<li><a name="a960"></a><span class="src-comm">//                         'fetchmode',</span></li>
<li><a name="a961"></a><span class="src-comm">//                         'fetchmode_object_class',</span></li>
<li><a name="a962"></a><span class="src-comm">//                         'options',</span></li>
<li><a name="a963"></a><span class="src-comm">//                         'was_connected',</span></li>
<li><a name="a964"></a><span class="src-comm">//                   );</span></li>
<li><a name="a965"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a966"></a><span class="src-comm">//            return array('dbsyntax',</span></li>
<li><a name="a967"></a><span class="src-comm">//                         'dsn',</span></li>
<li><a name="a968"></a><span class="src-comm">//                         'features',</span></li>
<li><a name="a969"></a><span class="src-comm">//                         'fetchmode',</span></li>
<li><a name="a970"></a><span class="src-comm">//                         'fetchmode_object_class',</span></li>
<li><a name="a971"></a><span class="src-comm">//                         'options',</span></li>
<li><a name="a972"></a><span class="src-comm">//                         'was_connected',</span></li>
<li><a name="a973"></a><span class="src-comm">//                   );</span></li>
<li><a name="a974"></a><span class="src-comm">//        }</span></li>
<li><a name="a975"></a>    <span class="src-sym">}</span></li>
<li><a name="a976"></a>&nbsp;</li>
<li><a name="a977"></a>    <span class="src-doc">/**</span></li>
<li><a name="a978"></a><span class="src-doc">     * Automatically reconnects to the database when PHP's unserialize()</span></li>
<li><a name="a979"></a><span class="src-doc">     * function is called</span></li>
<li><a name="a980"></a><span class="src-doc">     *</span></li>
<li><a name="a981"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a982"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::__wakeup</span></li>
<li><a name="a983"></a><span class="src-doc">     */</span></li>
<li><a name="a984"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#method__wakeup">__wakeup</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a985"></a>    <span class="src-sym">{</span></li>
<li><a name="a986"></a><span class="src-comm">//        if ($this-&gt;was_connected) {</span></li>
<li><a name="a987"></a><span class="src-comm">//            $this-&gt;connect($this-&gt;dsn, $this-&gt;options);</span></li>
<li><a name="a988"></a><span class="src-comm">//        }</span></li>
<li><a name="a989"></a>    <span class="src-sym">}</span></li>
<li><a name="a990"></a>&nbsp;</li>
<li><a name="a991"></a>    <span class="src-doc">/**</span></li>
<li><a name="a992"></a><span class="src-doc">     * Automatic string conversion for PHP 5</span></li>
<li><a name="a993"></a><span class="src-doc">     *</span></li>
<li><a name="a994"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> a string describing the current PEAR DB object</span></li>
<li><a name="a995"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::__toString</span></li>
<li><a name="a996"></a><span class="src-doc">     */</span></li>
<li><a name="a997"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#method__toString">__toString</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a998"></a>    <span class="src-sym">{</span></li>
<li><a name="a999"></a><span class="src-comm">//        $info = strtolower(get_class($this));</span></li>
<li><a name="a1000"></a><span class="src-comm">//        $info .=  ': (phptype=' . $this-&gt;phptype .</span></li>
<li><a name="a1001"></a><span class="src-comm">//                  ', dbsyntax=' . $this-&gt;dbsyntax .</span></li>
<li><a name="a1002"></a><span class="src-comm">//                  ')';</span></li>
<li><a name="a1003"></a><span class="src-comm">//        if ($this-&gt;connection) {</span></li>
<li><a name="a1004"></a><span class="src-comm">//            $info .= ' [connected]';</span></li>
<li><a name="a1005"></a><span class="src-comm">//        }</span></li>
<li><a name="a1006"></a><span class="src-comm">//        return $info;</span></li>
<li><a name="a1007"></a>    <span class="src-sym">}</span></li>
<li><a name="a1008"></a>&nbsp;</li>
<li><a name="a1009"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1010"></a><span class="src-doc">     * Quotes a string so it can be safely used as a table or column name</span></li>
<li><a name="a1011"></a><span class="src-doc">     *</span></li>
<li><a name="a1012"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$str </span><span class="src-doc"> the identifier name to be quoted</span></li>
<li><a name="a1013"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the quoted identifier</span></li>
<li><a name="a1014"></a><span class="src-doc">     */</span></li>
<li><a name="a1015"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodquoteIdentifier">quoteIdentifier</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">)</span></li>
<li><a name="a1016"></a>    <span class="src-sym">{</span></li>
<li><a name="a1017"></a>        <span class="src-key">return </span><span class="src-str">'&quot;' </span>. <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'&quot;'</span><span class="src-sym">, </span><span class="src-str">'&quot;&quot;'</span><span class="src-sym">, </span><span class="src-var">$str</span><span class="src-sym">) </span>. <span class="src-str">'&quot;'</span><span class="src-sym">;</span></li>
<li><a name="a1018"></a>    <span class="src-sym">}</span></li>
<li><a name="a1019"></a>&nbsp;</li>
<li><a name="a1020"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1021"></a><span class="src-doc">     * Formats input so it can be safely used in a query</span></li>
<li><a name="a1022"></a><span class="src-doc">     *</span></li>
<li><a name="a1023"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::escapeSimple()</span></li>
<li><a name="a1024"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::quoteSmart</span></li>
<li><a name="a1025"></a><span class="src-doc">     */</span></li>
<li><a name="a1026"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodquoteSmart">quoteSmart</a><span class="src-sym">(</span><span class="src-var">$in</span><span class="src-sym">)</span></li>
<li><a name="a1027"></a>    <span class="src-sym">{</span></li>
<li><a name="a1028"></a><span class="src-comm">//        if (is_int($in) || is_double($in)) {</span></li>
<li><a name="a1029"></a><span class="src-comm">//            return $in;</span></li>
<li><a name="a1030"></a><span class="src-comm">//        } elseif (is_bool($in)) {</span></li>
<li><a name="a1031"></a><span class="src-comm">//            return $in ? 1 : 0;</span></li>
<li><a name="a1032"></a><span class="src-comm">//        } elseif (is_null($in)) {</span></li>
<li><a name="a1033"></a><span class="src-comm">//            return 'NULL';</span></li>
<li><a name="a1034"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1035"></a><span class="src-comm">//            return &quot;'&quot; . $this-&gt;escapeSimple($in) . &quot;'&quot;;</span></li>
<li><a name="a1036"></a><span class="src-comm">//        }</span></li>
<li><a name="a1037"></a>    <span class="src-sym">}</span></li>
<li><a name="a1038"></a>&nbsp;</li>
<li><a name="a1039"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1040"></a><span class="src-doc">     * Escapes a string according to the current DBMS's standards</span></li>
<li><a name="a1041"></a><span class="src-doc">     *</span></li>
<li><a name="a1042"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$str </span><span class="src-doc"> the string to be escaped</span></li>
<li><a name="a1043"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the escaped string</span></li>
<li><a name="a1044"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::quoteSmart()</span></li>
<li><a name="a1045"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::escapeSimple</span></li>
<li><a name="a1046"></a><span class="src-doc">     */</span></li>
<li><a name="a1047"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodescapeSimple">escapeSimple</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">)</span></li>
<li><a name="a1048"></a>    <span class="src-sym">{</span></li>
<li><a name="a1049"></a><span class="src-comm">//        return str_replace(&quot;'&quot;, &quot;''&quot;, $str);</span></li>
<li><a name="a1050"></a>    <span class="src-sym">}</span></li>
<li><a name="a1051"></a>&nbsp;</li>
<li><a name="a1052"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1053"></a><span class="src-doc">     * Tells whether the present driver supports a given feature</span></li>
<li><a name="a1054"></a><span class="src-doc">     *</span></li>
<li><a name="a1055"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$feature </span><span class="src-doc"> the feature you're curious about</span></li>
<li><a name="a1056"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> whether this driver supports $feature</span></li>
<li><a name="a1057"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::provides</span></li>
<li><a name="a1058"></a><span class="src-doc">     */</span></li>
<li><a name="a1059"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodprovides">provides</a><span class="src-sym">(</span><span class="src-var">$feature</span><span class="src-sym">)</span></li>
<li><a name="a1060"></a>    <span class="src-sym">{</span></li>
<li><a name="a1061"></a><span class="src-comm">//        return $this-&gt;features[$feature];</span></li>
<li><a name="a1062"></a>    <span class="src-sym">}</span></li>
<li><a name="a1063"></a>&nbsp;</li>
<li><a name="a1064"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1065"></a><span class="src-doc">     * Sets the fetch mode that should be used by default for query results</span></li>
<li><a name="a1066"></a><span class="src-doc">     *</span></li>
<li><a name="a1067"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$fetchmode </span><span class="src-doc">   DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC</span></li>
<li><a name="a1068"></a><span class="src-doc">     *                                or DB_FETCHMODE_OBJECT</span></li>
<li><a name="a1069"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$object_class </span><span class="src-doc"> the class name of the object to be returned</span></li>
<li><a name="a1070"></a><span class="src-doc">     *                                by the fetch methods when the</span></li>
<li><a name="a1071"></a><span class="src-doc">     *                                DB_FETCHMODE_OBJECT mode is selected.</span></li>
<li><a name="a1072"></a><span class="src-doc">     *                                If no class is specified by default a cast</span></li>
<li><a name="a1073"></a><span class="src-doc">     *                                to object from the assoc array row will be</span></li>
<li><a name="a1074"></a><span class="src-doc">     *                                done.  There is also the posibility to use</span></li>
<li><a name="a1075"></a><span class="src-doc">     *                                and extend the 'DB_row' class.</span></li>
<li><a name="a1076"></a><span class="src-doc">     *</span></li>
<li><a name="a1077"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT</span></li>
<li><a name="a1078"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::setFetchMode</span></li>
<li><a name="a1079"></a><span class="src-doc">     */</span></li>
<li><a name="a1080"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodsetFetchMode">setFetchMode</a><span class="src-sym">(</span><span class="src-var">$fetchmode</span><span class="src-sym">, </span><span class="src-var">$object_class </span>= <span class="src-str">'stdClass'</span><span class="src-sym">)</span></li>
<li><a name="a1081"></a>    <span class="src-sym">{</span></li>
<li><a name="a1082"></a><span class="src-comm">//        switch ($fetchmode) {</span></li>
<li><a name="a1083"></a><span class="src-comm">//            case DB_FETCHMODE_OBJECT:</span></li>
<li><a name="a1084"></a><span class="src-comm">//                $this-&gt;fetchmode_object_class = $object_class;</span></li>
<li><a name="a1085"></a><span class="src-comm">//            case DB_FETCHMODE_ORDERED:</span></li>
<li><a name="a1086"></a><span class="src-comm">//            case DB_FETCHMODE_ASSOC:</span></li>
<li><a name="a1087"></a><span class="src-comm">//                $this-&gt;fetchmode = $fetchmode;</span></li>
<li><a name="a1088"></a><span class="src-comm">//                break;</span></li>
<li><a name="a1089"></a><span class="src-comm">//            default:</span></li>
<li><a name="a1090"></a><span class="src-comm">//                return $this-&gt;raiseError('invalid fetchmode mode');</span></li>
<li><a name="a1091"></a><span class="src-comm">//        }</span></li>
<li><a name="a1092"></a>    <span class="src-sym">}</span></li>
<li><a name="a1093"></a>&nbsp;</li>
<li><a name="a1094"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1095"></a><span class="src-doc">     * Sets run-time configuration options for PEAR DB</span></li>
<li><a name="a1096"></a><span class="src-doc">     *</span></li>
<li><a name="a1097"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$option </span><span class="src-doc">option name</span></li>
<li><a name="a1098"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$value </span><span class="src-doc">value for the option</span></li>
<li><a name="a1099"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a1100"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::$options</span></li>
<li><a name="a1101"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::setOption</span></li>
<li><a name="a1102"></a><span class="src-doc">     */</span></li>
<li><a name="a1103"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodsetOption">setOption</a><span class="src-sym">(</span><span class="src-var">$option</span><span class="src-sym">, </span><span class="src-var">$value</span><span class="src-sym">)</span></li>
<li><a name="a1104"></a>    <span class="src-sym">{</span></li>
<li><a name="a1105"></a>        <span class="src-key">if </span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$options">options</a><span class="src-sym">[</span><span class="src-var">$option</span><span class="src-sym">]</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1106"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$options">options</a><span class="src-sym">[</span><span class="src-var">$option</span><span class="src-sym">] </span>= <span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a1107"></a>            <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a1108"></a>        <span class="src-sym">}</span></li>
<li><a name="a1109"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB_common::setOption called&quot;</span></li>
<li><a name="a1110"></a>                                        .<span class="src-str">&quot;</span><span class="src-str"> <span class="src-id">with</span> <span class="src-id">unknown</span> <span class="src-id">option</span> <span class="src-var">$option</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1111"></a>    <span class="src-sym">}</span></li>
<li><a name="a1112"></a>&nbsp;</li>
<li><a name="a1113"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1114"></a><span class="src-doc">     * Returns the value of an option</span></li>
<li><a name="a1115"></a><span class="src-doc">     *</span></li>
<li><a name="a1116"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$option </span><span class="src-doc"> the option name you're curious about</span></li>
<li><a name="a1117"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> the option's value</span></li>
<li><a name="a1118"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getOption</span></li>
<li><a name="a1119"></a><span class="src-doc">     */</span></li>
<li><a name="a1120"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodgetOption">getOption</a><span class="src-sym">(</span><span class="src-var">$option</span><span class="src-sym">)</span></li>
<li><a name="a1121"></a>    <span class="src-sym">{</span></li>
<li><a name="a1122"></a><span class="src-comm">//        if (isset($this-&gt;options[$option])) {</span></li>
<li><a name="a1123"></a><span class="src-comm">//            return $this-&gt;options[$option];</span></li>
<li><a name="a1124"></a><span class="src-comm">//        }</span></li>
<li><a name="a1125"></a><span class="src-comm">//        return $this-&gt;raiseError(&quot;unknown option $option&quot;);</span></li>
<li><a name="a1126"></a>    <span class="src-sym">}</span></li>
<li><a name="a1127"></a>&nbsp;</li>
<li><a name="a1128"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1129"></a><span class="src-doc">     * Prepares a query for multiple execution with execute()</span></li>
<li><a name="a1130"></a><span class="src-doc">     *</span></li>
<li><a name="a1131"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc"> the query to be prepared</span></li>
<li><a name="a1132"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> DB statement resource on success. A DB_Error object</span></li>
<li><a name="a1133"></a><span class="src-doc">     *                  on failure.</span></li>
<li><a name="a1134"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::execute()</span></li>
<li><a name="a1135"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::prepare</span></li>
<li><a name="a1136"></a><span class="src-doc">     */</span></li>
<li><a name="a1137"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodprepare">prepare</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">)</span></li>
<li><a name="a1138"></a>    <span class="src-sym">{</span></li>
<li><a name="a1139"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1140"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1141"></a><span class="src-comm">//        $tokens   = preg_split('/((?&lt;!\\\)[&amp;?!])/', $query, -1,</span></li>
<li><a name="a1142"></a><span class="src-comm">//                               PREG_SPLIT_DELIM_CAPTURE);</span></li>
<li><a name="a1143"></a><span class="src-comm">//        $token     = 0;</span></li>
<li><a name="a1144"></a><span class="src-comm">//        $types     = array();</span></li>
<li><a name="a1145"></a><span class="src-comm">//        $newtokens = array();</span></li>
<li><a name="a1146"></a><span class="src-comm">//</span></li>
<li><a name="a1147"></a><span class="src-comm">//        foreach ($tokens as $val) {</span></li>
<li><a name="a1148"></a><span class="src-comm">//            switch ($val) {</span></li>
<li><a name="a1149"></a><span class="src-comm">//                case '?':</span></li>
<li><a name="a1150"></a><span class="src-comm">//                    $types[$token++] = DB_PARAM_SCALAR;</span></li>
<li><a name="a1151"></a><span class="src-comm">//                    break;</span></li>
<li><a name="a1152"></a><span class="src-comm">//                case '&amp;':</span></li>
<li><a name="a1153"></a><span class="src-comm">//                    $types[$token++] = DB_PARAM_OPAQUE;</span></li>
<li><a name="a1154"></a><span class="src-comm">//                    break;</span></li>
<li><a name="a1155"></a><span class="src-comm">//                case '!':</span></li>
<li><a name="a1156"></a><span class="src-comm">//                    $types[$token++] = DB_PARAM_MISC;</span></li>
<li><a name="a1157"></a><span class="src-comm">//                    break;</span></li>
<li><a name="a1158"></a><span class="src-comm">//                default:</span></li>
<li><a name="a1159"></a><span class="src-comm">//                    $newtokens[] = preg_replace('/\\\([&amp;?!])/', &quot;\\1&quot;, $val);</span></li>
<li><a name="a1160"></a><span class="src-comm">//            }</span></li>
<li><a name="a1161"></a><span class="src-comm">//        }</span></li>
<li><a name="a1162"></a><span class="src-comm">//</span></li>
<li><a name="a1163"></a><span class="src-comm">//        $this-&gt;prepare_tokens[] = &amp;$newtokens;</span></li>
<li><a name="a1164"></a><span class="src-comm">//        end($this-&gt;prepare_tokens);</span></li>
<li><a name="a1165"></a><span class="src-comm">//</span></li>
<li><a name="a1166"></a><span class="src-comm">//        $k = key($this-&gt;prepare_tokens);</span></li>
<li><a name="a1167"></a><span class="src-comm">//        $this-&gt;prepare_types[$k] = $types;</span></li>
<li><a name="a1168"></a><span class="src-comm">//        $this-&gt;prepared_queries[$k] = implode(' ', $newtokens);</span></li>
<li><a name="a1169"></a><span class="src-comm">//</span></li>
<li><a name="a1170"></a><span class="src-comm">//        return $k;</span></li>
<li><a name="a1171"></a>    <span class="src-sym">}</span></li>
<li><a name="a1172"></a>&nbsp;</li>
<li><a name="a1173"></a>&nbsp;</li>
<li><a name="a1174"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1175"></a><span class="src-doc">     * Automaticaly generates an insert or update query and pass it to</span></li>
<li><a name="a1176"></a><span class="src-doc">     * prepare()</span></li>
<li><a name="a1177"></a><span class="src-doc">     *</span></li>
<li><a name="a1178"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$table </span><span class="src-doc">        the table name</span></li>
<li><a name="a1179"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$table_fields </span><span class="src-doc"> the array of field names</span></li>
<li><a name="a1180"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$mode </span><span class="src-doc">         a type of query to make:</span></li>
<li><a name="a1181"></a><span class="src-doc">     *                                DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE</span></li>
<li><a name="a1182"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$where </span><span class="src-doc">        for update queries: the WHERE clause to</span></li>
<li><a name="a1183"></a><span class="src-doc">     *                                append to the SQL statement.  Don't</span></li>
<li><a name="a1184"></a><span class="src-doc">     *                                include the &quot;WHERE&quot; keyword.</span></li>
<li><a name="a1185"></a><span class="src-doc">     *</span></li>
<li><a name="a1186"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">resource </span><span class="src-doc"> the query handle</span></li>
<li><a name="a1187"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> DB_common::prepare(), DB_common::buildManipSQL()</span></li>
<li><a name="a1188"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::autoPrepare</span></li>
<li><a name="a1189"></a><span class="src-doc">     */</span></li>
<li><a name="a1190"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodautoPrepare">autoPrepare</a><span class="src-sym">(</span><span class="src-var">$table</span><span class="src-sym">, </span><span class="src-var">$table_fields</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">DB_AUTOQUERY_INSERT</span><span class="src-sym">,</span></li>
<li><a name="a1191"></a>                         <span class="src-var">$where </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a1192"></a>    <span class="src-sym">{</span></li>
<li><a name="a1193"></a><span class="src-comm">//        $query = $this-&gt;buildManipSQL($table, $table_fields, $mode, $where);</span></li>
<li><a name="a1194"></a><span class="src-comm">//        if (DB::isError($query)) {</span></li>
<li><a name="a1195"></a><span class="src-comm">//            return $query;</span></li>
<li><a name="a1196"></a><span class="src-comm">//        }</span></li>
<li><a name="a1197"></a><span class="src-comm">//        return $this-&gt;prepare($query);</span></li>
<li><a name="a1198"></a>    <span class="src-sym">}</span></li>
<li><a name="a1199"></a>&nbsp;</li>
<li><a name="a1200"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1201"></a><span class="src-doc">     * Automaticaly generates an insert or update query and call prepare()</span></li>
<li><a name="a1202"></a><span class="src-doc">     * and execute() with it</span></li>
<li><a name="a1203"></a><span class="src-doc">     *</span></li>
<li><a name="a1204"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$table </span><span class="src-doc">        the table name</span></li>
<li><a name="a1205"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$fields_values </span><span class="src-doc">the associative array where $key is a</span></li>
<li><a name="a1206"></a><span class="src-doc">     *                                field name and $value its value</span></li>
<li><a name="a1207"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$mode </span><span class="src-doc">         a type of query to make:</span></li>
<li><a name="a1208"></a><span class="src-doc">     *                                DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE</span></li>
<li><a name="a1209"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$where </span><span class="src-doc">        for update queries: the WHERE clause to</span></li>
<li><a name="a1210"></a><span class="src-doc">     *                                append to the SQL statement.  Don't</span></li>
<li><a name="a1211"></a><span class="src-doc">     *                                include the &quot;WHERE&quot; keyword.</span></li>
<li><a name="a1212"></a><span class="src-doc">     *</span></li>
<li><a name="a1213"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> a new DB_result object for successful SELECT queries</span></li>
<li><a name="a1214"></a><span class="src-doc">     *                  or DB_OK for successul data manipulation queries.</span></li>
<li><a name="a1215"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1216"></a><span class="src-doc">     *</span></li>
<li><a name="a1217"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> DB_common::autoPrepare(), DB_common::execute()</span></li>
<li><a name="a1218"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::autoExecute</span></li>
<li><a name="a1219"></a><span class="src-doc">     */</span></li>
<li><a name="a1220"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodautoExecute">autoExecute</a><span class="src-sym">(</span><span class="src-var">$table</span><span class="src-sym">, </span><span class="src-var">$fields_values</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">DB_AUTOQUERY_INSERT</span><span class="src-sym">,</span></li>
<li><a name="a1221"></a>                         <span class="src-var">$where </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a1222"></a>    <span class="src-sym">{</span></li>
<li><a name="a1223"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1224"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1225"></a><span class="src-comm">//        $sth = $this-&gt;autoPrepare($table, array_keys($fields_values), $mode,</span></li>
<li><a name="a1226"></a><span class="src-comm">//                                  $where);</span></li>
<li><a name="a1227"></a><span class="src-comm">//        if (DB::isError($sth)) {</span></li>
<li><a name="a1228"></a><span class="src-comm">//            return $sth;</span></li>
<li><a name="a1229"></a><span class="src-comm">//        }</span></li>
<li><a name="a1230"></a><span class="src-comm">//        $ret =&amp; $this-&gt;execute($sth, array_values($fields_values));</span></li>
<li><a name="a1231"></a><span class="src-comm">//        $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1232"></a><span class="src-comm">//        return $ret;</span></li>
<li><a name="a1233"></a>    <span class="src-sym">}</span></li>
<li><a name="a1234"></a>&nbsp;</li>
<li><a name="a1235"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1236"></a><span class="src-doc">     * Produces an SQL query string for autoPrepare()</span></li>
<li><a name="a1237"></a><span class="src-doc">     *</span></li>
<li><a name="a1238"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$table </span><span class="src-doc">        the table name</span></li>
<li><a name="a1239"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$table_fields </span><span class="src-doc"> the array of field names</span></li>
<li><a name="a1240"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$mode </span><span class="src-doc">         a type of query to make:</span></li>
<li><a name="a1241"></a><span class="src-doc">     *                                DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE</span></li>
<li><a name="a1242"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$where </span><span class="src-doc">        for update queries: the WHERE clause to</span></li>
<li><a name="a1243"></a><span class="src-doc">     *                                append to the SQL statement.  Don't</span></li>
<li><a name="a1244"></a><span class="src-doc">     *                                include the &quot;WHERE&quot; keyword.</span></li>
<li><a name="a1245"></a><span class="src-doc">     *</span></li>
<li><a name="a1246"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the sql query for autoPrepare()</span></li>
<li><a name="a1247"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::buildManipSQL</span></li>
<li><a name="a1248"></a><span class="src-doc">     */</span></li>
<li><a name="a1249"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodbuildManipSQL">buildManipSQL</a><span class="src-sym">(</span><span class="src-var">$table</span><span class="src-sym">, </span><span class="src-var">$table_fields</span><span class="src-sym">, </span><span class="src-var">$mode</span><span class="src-sym">, </span><span class="src-var">$where </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a1250"></a>    <span class="src-sym">{</span></li>
<li><a name="a1251"></a><span class="src-comm">//        if (count($table_fields) == 0) {</span></li>
<li><a name="a1252"></a><span class="src-comm">//            return $this-&gt;raiseError(DB_ERROR_NEED_MORE_DATA);</span></li>
<li><a name="a1253"></a><span class="src-comm">//        }</span></li>
<li><a name="a1254"></a><span class="src-comm">//        $first = true;</span></li>
<li><a name="a1255"></a><span class="src-comm">//        switch ($mode) {</span></li>
<li><a name="a1256"></a><span class="src-comm">//            case DB_AUTOQUERY_INSERT:</span></li>
<li><a name="a1257"></a><span class="src-comm">//                $values = '';</span></li>
<li><a name="a1258"></a><span class="src-comm">//                $names = '';</span></li>
<li><a name="a1259"></a><span class="src-comm">//                foreach ($table_fields as $value) {</span></li>
<li><a name="a1260"></a><span class="src-comm">//                    if ($first) {</span></li>
<li><a name="a1261"></a><span class="src-comm">//                        $first = false;</span></li>
<li><a name="a1262"></a><span class="src-comm">//                    } else {</span></li>
<li><a name="a1263"></a><span class="src-comm">//                        $names .= ',';</span></li>
<li><a name="a1264"></a><span class="src-comm">//                        $values .= ',';</span></li>
<li><a name="a1265"></a><span class="src-comm">//                    }</span></li>
<li><a name="a1266"></a><span class="src-comm">//                    $names .= $value;</span></li>
<li><a name="a1267"></a><span class="src-comm">//                    $values .= '?';</span></li>
<li><a name="a1268"></a><span class="src-comm">//                }</span></li>
<li><a name="a1269"></a><span class="src-comm">//                return &quot;INSERT INTO $table ($names) VALUES ($values)&quot;;</span></li>
<li><a name="a1270"></a><span class="src-comm">//            case DB_AUTOQUERY_UPDATE:</span></li>
<li><a name="a1271"></a><span class="src-comm">//                $set = '';</span></li>
<li><a name="a1272"></a><span class="src-comm">//                foreach ($table_fields as $value) {</span></li>
<li><a name="a1273"></a><span class="src-comm">//                    if ($first) {</span></li>
<li><a name="a1274"></a><span class="src-comm">//                        $first = false;</span></li>
<li><a name="a1275"></a><span class="src-comm">//                    } else {</span></li>
<li><a name="a1276"></a><span class="src-comm">//                        $set .= ',';</span></li>
<li><a name="a1277"></a><span class="src-comm">//                    }</span></li>
<li><a name="a1278"></a><span class="src-comm">//                    $set .= &quot;$value = ?&quot;;</span></li>
<li><a name="a1279"></a><span class="src-comm">//                }</span></li>
<li><a name="a1280"></a><span class="src-comm">//                $sql = &quot;UPDATE $table SET $set&quot;;</span></li>
<li><a name="a1281"></a><span class="src-comm">//                if ($where) {</span></li>
<li><a name="a1282"></a><span class="src-comm">//                    $sql .= &quot; WHERE $where&quot;;</span></li>
<li><a name="a1283"></a><span class="src-comm">//                }</span></li>
<li><a name="a1284"></a><span class="src-comm">//                return $sql;</span></li>
<li><a name="a1285"></a><span class="src-comm">//            default:</span></li>
<li><a name="a1286"></a><span class="src-comm">//                return $this-&gt;raiseError(DB_ERROR_SYNTAX);</span></li>
<li><a name="a1287"></a><span class="src-comm">//        }</span></li>
<li><a name="a1288"></a>    <span class="src-sym">}</span></li>
<li><a name="a1289"></a>&nbsp;</li>
<li><a name="a1290"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1291"></a><span class="src-doc">     * Executes a DB statement prepared with prepare()</span></li>
<li><a name="a1292"></a><span class="src-doc">     *</span></li>
<li><a name="a1293"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$stmt </span><span class="src-doc"> a DB statement resource returned from prepare()</span></li>
<li><a name="a1294"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc">   </span><span class="src-doc-var">$data </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1295"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1296"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1297"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1298"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1299"></a><span class="src-doc">     *</span></li>
<li><a name="a1300"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> a new DB_result object for successful SELECT queries</span></li>
<li><a name="a1301"></a><span class="src-doc">     *                  or DB_OK for successul data manipulation queries.</span></li>
<li><a name="a1302"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1303"></a><span class="src-doc">     *</span></li>
<li><a name="a1304"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::prepare()</span></li>
<li><a name="a1305"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::execute</span></li>
<li><a name="a1306"></a><span class="src-doc">     */</span></li>
<li><a name="a1307"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodexecute">execute</a><span class="src-sym">(</span><span class="src-var">$stmt</span><span class="src-sym">, </span><span class="src-var">$data </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1308"></a>    <span class="src-sym">{</span></li>
<li><a name="a1309"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1310"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1311"></a><span class="src-comm">//        $realquery = $this-&gt;executeEmulateQuery($stmt, $data);</span></li>
<li><a name="a1312"></a><span class="src-comm">//        if (DB::isError($realquery)) {</span></li>
<li><a name="a1313"></a><span class="src-comm">//            return $realquery;</span></li>
<li><a name="a1314"></a><span class="src-comm">//        }</span></li>
<li><a name="a1315"></a><span class="src-comm">//        $result = $this-&gt;simpleQuery($realquery);</span></li>
<li><a name="a1316"></a><span class="src-comm">//</span></li>
<li><a name="a1317"></a><span class="src-comm">//        if ($result === DB_OK || DB::isError($result)) {</span></li>
<li><a name="a1318"></a><span class="src-comm">//            return $result;</span></li>
<li><a name="a1319"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1320"></a><span class="src-comm">//            $tmp =&amp; new DB_result($this, $result);</span></li>
<li><a name="a1321"></a><span class="src-comm">//            return $tmp;</span></li>
<li><a name="a1322"></a><span class="src-comm">//        }</span></li>
<li><a name="a1323"></a>    <span class="src-sym">}</span></li>
<li><a name="a1324"></a>&nbsp;</li>
<li><a name="a1325"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1326"></a><span class="src-doc">     * Emulates executing prepared statements if the DBMS not support them</span></li>
<li><a name="a1327"></a><span class="src-doc">     *</span></li>
<li><a name="a1328"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$stmt </span><span class="src-doc"> a DB statement resource returned from execute()</span></li>
<li><a name="a1329"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc">   </span><span class="src-doc-var">$data </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1330"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1331"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1332"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1333"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1334"></a><span class="src-doc">     *</span></li>
<li><a name="a1335"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> a string containing the real query run when emulating</span></li>
<li><a name="a1336"></a><span class="src-doc">     *                  prepare/execute.  A DB_Error object on failure.</span></li>
<li><a name="a1337"></a><span class="src-doc">     *</span></li>
<li><a name="a1338"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::execute()</span></li>
<li><a name="a1339"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::executeEmulateQuery</span></li>
<li><a name="a1340"></a><span class="src-doc">     */</span></li>
<li><a name="a1341"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodexecuteEmulateQuery">executeEmulateQuery</a><span class="src-sym">(</span><span class="src-var">$stmt</span><span class="src-sym">, </span><span class="src-var">$data </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1342"></a>    <span class="src-sym">{</span></li>
<li><a name="a1343"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1344"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1345"></a><span class="src-comm">//        $stmt = (int)$stmt;</span></li>
<li><a name="a1346"></a><span class="src-comm">//        $data = (array)$data;</span></li>
<li><a name="a1347"></a><span class="src-comm">//        $this-&gt;last_parameters = $data;</span></li>
<li><a name="a1348"></a><span class="src-comm">//</span></li>
<li><a name="a1349"></a><span class="src-comm">//        if (count($this-&gt;prepare_types[$stmt]) != count($data)) {</span></li>
<li><a name="a1350"></a><span class="src-comm">//            $this-&gt;last_query = $this-&gt;prepared_queries[$stmt];</span></li>
<li><a name="a1351"></a><span class="src-comm">//            return $this-&gt;raiseError(DB_ERROR_MISMATCH);</span></li>
<li><a name="a1352"></a><span class="src-comm">//        }</span></li>
<li><a name="a1353"></a><span class="src-comm">//</span></li>
<li><a name="a1354"></a><span class="src-comm">//        $realquery = $this-&gt;prepare_tokens[$stmt][0];</span></li>
<li><a name="a1355"></a><span class="src-comm">//</span></li>
<li><a name="a1356"></a><span class="src-comm">//        $i = 0;</span></li>
<li><a name="a1357"></a><span class="src-comm">//        foreach ($data as $value) {</span></li>
<li><a name="a1358"></a><span class="src-comm">//            if ($this-&gt;prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {</span></li>
<li><a name="a1359"></a><span class="src-comm">//                $realquery .= $this-&gt;quoteSmart($value);</span></li>
<li><a name="a1360"></a><span class="src-comm">//            } elseif ($this-&gt;prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {</span></li>
<li><a name="a1361"></a><span class="src-comm">//                $fp = @fopen($value, 'rb');</span></li>
<li><a name="a1362"></a><span class="src-comm">//                if (!$fp) {</span></li>
<li><a name="a1363"></a><span class="src-comm">//                    return $this-&gt;raiseError(DB_ERROR_ACCESS_VIOLATION);</span></li>
<li><a name="a1364"></a><span class="src-comm">//                }</span></li>
<li><a name="a1365"></a><span class="src-comm">//                $realquery .= $this-&gt;quoteSmart(fread($fp, filesize($value)));</span></li>
<li><a name="a1366"></a><span class="src-comm">//                fclose($fp);</span></li>
<li><a name="a1367"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a1368"></a><span class="src-comm">//                $realquery .= $value;</span></li>
<li><a name="a1369"></a><span class="src-comm">//            }</span></li>
<li><a name="a1370"></a><span class="src-comm">//</span></li>
<li><a name="a1371"></a><span class="src-comm">//            $realquery .= $this-&gt;prepare_tokens[$stmt][++$i];</span></li>
<li><a name="a1372"></a><span class="src-comm">//        }</span></li>
<li><a name="a1373"></a><span class="src-comm">//</span></li>
<li><a name="a1374"></a><span class="src-comm">//        return $realquery;</span></li>
<li><a name="a1375"></a>    <span class="src-sym">}</span></li>
<li><a name="a1376"></a>&nbsp;</li>
<li><a name="a1377"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1378"></a><span class="src-doc">     * Performs several execute() calls on the same statement handle</span></li>
<li><a name="a1379"></a><span class="src-doc">     *</span></li>
<li><a name="a1380"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$stmt </span><span class="src-doc"> query handle from prepare()</span></li>
<li><a name="a1381"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc">   </span><span class="src-doc-var">$data </span><span class="src-doc"> numeric array containing the</span></li>
<li><a name="a1382"></a><span class="src-doc">     *                          data to insert into the query</span></li>
<li><a name="a1383"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a1384"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::prepare(), DB_common::execute()</span></li>
<li><a name="a1385"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::executeMultiple</span></li>
<li><a name="a1386"></a><span class="src-doc">     */</span></li>
<li><a name="a1387"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodexecuteMultiple">executeMultiple</a><span class="src-sym">(</span><span class="src-var">$stmt</span><span class="src-sym">, </span><span class="src-var">$data</span><span class="src-sym">)</span></li>
<li><a name="a1388"></a>    <span class="src-sym">{</span></li>
<li><a name="a1389"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1390"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1391"></a><span class="src-comm">//        foreach ($data as $value) {</span></li>
<li><a name="a1392"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($stmt, $value);</span></li>
<li><a name="a1393"></a><span class="src-comm">//            if (DB::isError($res)) {</span></li>
<li><a name="a1394"></a><span class="src-comm">//                return $res;</span></li>
<li><a name="a1395"></a><span class="src-comm">//            }</span></li>
<li><a name="a1396"></a><span class="src-comm">//        }</span></li>
<li><a name="a1397"></a><span class="src-comm">//        return DB_OK;</span></li>
<li><a name="a1398"></a>    <span class="src-sym">}</span></li>
<li><a name="a1399"></a>&nbsp;</li>
<li><a name="a1400"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1401"></a><span class="src-doc">     * Frees the internal resources associated with a prepared query</span></li>
<li><a name="a1402"></a><span class="src-doc">     *</span></li>
<li><a name="a1403"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$stmt </span><span class="src-doc">          the prepared statement's PHP resource</span></li>
<li><a name="a1404"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc">    </span><span class="src-doc-var">$free_resource </span><span class="src-doc"> should the PHP resource be freed too?</span></li>
<li><a name="a1405"></a><span class="src-doc">     *                                   Use false if you need to get data</span></li>
<li><a name="a1406"></a><span class="src-doc">     *                                   from the result set later.</span></li>
<li><a name="a1407"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> TRUE on success, FALSE if $result is invalid</span></li>
<li><a name="a1408"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::prepare()</span></li>
<li><a name="a1409"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::freePrepared</span></li>
<li><a name="a1410"></a><span class="src-doc">     */</span></li>
<li><a name="a1411"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodfreePrepared">freePrepared</a><span class="src-sym">(</span><span class="src-var">$stmt</span><span class="src-sym">, </span><span class="src-var">$free_resource </span>= <span class="src-id">true</span><span class="src-sym">)</span></li>
<li><a name="a1412"></a>    <span class="src-sym">{</span></li>
<li><a name="a1413"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1414"></a>                                        . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1415"></a><span class="src-comm">//        $stmt = (int)$stmt;</span></li>
<li><a name="a1416"></a><span class="src-comm">//        if (isset($this-&gt;prepare_tokens[$stmt])) {</span></li>
<li><a name="a1417"></a><span class="src-comm">//            unset($this-&gt;prepare_tokens[$stmt]);</span></li>
<li><a name="a1418"></a><span class="src-comm">//            unset($this-&gt;prepare_types[$stmt]);</span></li>
<li><a name="a1419"></a><span class="src-comm">//            unset($this-&gt;prepared_queries[$stmt]);</span></li>
<li><a name="a1420"></a><span class="src-comm">//            return true;</span></li>
<li><a name="a1421"></a><span class="src-comm">//        }</span></li>
<li><a name="a1422"></a><span class="src-comm">//        return false;</span></li>
<li><a name="a1423"></a>    <span class="src-sym">}</span></li>
<li><a name="a1424"></a>&nbsp;</li>
<li><a name="a1425"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1426"></a><span class="src-doc">     * Changes a query string for various DBMS specific reasons</span></li>
<li><a name="a1427"></a><span class="src-doc">     *</span></li>
<li><a name="a1428"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc"> the query string to modify</span></li>
<li><a name="a1429"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the modified query string</span></li>
<li><a name="a1430"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),</span></li>
<li><a name="a1431"></a><span class="src-doc">     *       DB_sqlite::modifyQuery()</span></li>
<li><a name="a1432"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::modifyQuery</span></li>
<li><a name="a1433"></a><span class="src-doc">     */</span></li>
<li><a name="a1434"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodmodifyQuery">modifyQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">)</span></li>
<li><a name="a1435"></a>    <span class="src-sym">{</span></li>
<li><a name="a1436"></a><span class="src-comm">//        return $query;</span></li>
<li><a name="a1437"></a>    <span class="src-sym">}</span></li>
<li><a name="a1438"></a>&nbsp;</li>
<li><a name="a1439"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1440"></a><span class="src-doc">     * Adds LIMIT clauses to a query string according to current DBMS standards</span></li>
<li><a name="a1441"></a><span class="src-doc">     *</span></li>
<li><a name="a1442"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the query to modify</span></li>
<li><a name="a1443"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$from </span><span class="src-doc">   the row to start to fetching (0 = the first row)</span></li>
<li><a name="a1444"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$count </span><span class="src-doc">  the numbers of rows to fetch</span></li>
<li><a name="a1445"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1446"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1447"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1448"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1449"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1450"></a><span class="src-doc">     *</span></li>
<li><a name="a1451"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the query string with LIMIT clauses added</span></li>
<li><a name="a1452"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::modifyLimitQuery</span></li>
<li><a name="a1453"></a><span class="src-doc">     */</span></li>
<li><a name="a1454"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodmodifyLimitQuery">modifyLimitQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$from</span><span class="src-sym">, </span><span class="src-var">$count</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1455"></a>    <span class="src-sym">{</span></li>
<li><a name="a1456"></a><span class="src-comm">//        return $query;</span></li>
<li><a name="a1457"></a>    <span class="src-sym">}</span></li>
<li><a name="a1458"></a>&nbsp;</li>
<li><a name="a1459"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1460"></a><span class="src-doc">     *  Set expected query and return</span></li>
<li><a name="a1461"></a><span class="src-doc">     *</span></li>
<li><a name="a1462"></a><span class="src-doc">     *  This is a test routine that does not exist in the PEAR DB package.</span></li>
<li><a name="a1463"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$expected </span><span class="src-doc">Expected query</span></li>
<li><a name="a1464"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$result </span><span class="src-doc">Result to be returned when expected</span></li>
<li><a name="a1465"></a><span class="src-doc">     *   query is received.</span></li>
<li><a name="a1466"></a><span class="src-doc">     */</span></li>
<li><a name="a1467"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodexpect_query">expect_query</a><span class="src-sym">(</span><span class="src-var">$expected</span><span class="src-sym">, </span><span class="src-var">$result</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1468"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_query">expected_query</a> = <span class="src-var">$expected</span><span class="src-sym">;</span></li>
<li><a name="a1469"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_result">expected_result</a> = <span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a1470"></a>    <span class="src-sym">}</span></li>
<li><a name="a1471"></a>&nbsp;</li>
<li><a name="a1472"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1473"></a><span class="src-doc">     *  Set list of expected queries and returns</span></li>
<li><a name="a1474"></a><span class="src-doc">     *</span></li>
<li><a name="a1475"></a><span class="src-doc">     *  This is a test routine that does not exist in the PEAR DB package.</span></li>
<li><a name="a1476"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$list </span><span class="src-doc">Expected queries and returns</span></li>
<li><a name="a1477"></a><span class="src-doc">     */</span></li>
<li><a name="a1478"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodexpect_queries">expect_queries</a><span class="src-sym">(</span><span class="src-var">$list</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1479"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a> = <span class="src-var">$list</span><span class="src-sym">;</span></li>
<li><a name="a1480"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a> = <span class="src-num">0</span><span class="src-sym">;</span></li>
<li><a name="a1481"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#methodexpect_query">expect_query</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'query'</span><span class="src-sym">]</span><span class="src-sym">,</span></li>
<li><a name="a1482"></a>                            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'result'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1483"></a>    <span class="src-sym">}</span></li>
<li><a name="a1484"></a>&nbsp;</li>
<li><a name="a1485"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1486"></a><span class="src-doc">     *  Verify that all expected queries have been received</span></li>
<li><a name="a1487"></a><span class="src-doc">     *</span></li>
<li><a name="a1488"></a><span class="src-doc">     *  This is a test routine that does not exist in the PEAR DB package.</span></li>
<li><a name="a1489"></a><span class="src-doc">     */</span></li>
<li><a name="a1490"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodtally_queries">tally_queries</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1491"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a> &lt; <a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1492"></a>            <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB_mysql::expected query was&quot;</span></li>
<li><a name="a1493"></a>                          .<span class="src-str">&quot;</span><span class="src-str"> <span class="src-id">not</span> <span class="src-id">received</span>. <span class="src-id">expected</span> <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_query">expected_query</a><span class="src-str">"</span></span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1494"></a>        <span class="src-sym">}</span></li>
<li><a name="a1495"></a>    <span class="src-sym">}</span></li>
<li><a name="a1496"></a>&nbsp;</li>
<li><a name="a1497"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1498"></a><span class="src-doc">     * Sends a query to the database server</span></li>
<li><a name="a1499"></a><span class="src-doc">     *</span></li>
<li><a name="a1500"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the SQL query or the statement to prepare</span></li>
<li><a name="a1501"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1502"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1503"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1504"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1505"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1506"></a><span class="src-doc">     *</span></li>
<li><a name="a1507"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> a new DB_result object for successful SELECT queries</span></li>
<li><a name="a1508"></a><span class="src-doc">     *                  or DB_OK for successul data manipulation queries.</span></li>
<li><a name="a1509"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1510"></a><span class="src-doc">     *</span></li>
<li><a name="a1511"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_result, DB_common::prepare(), DB_common::execute()</span></li>
<li><a name="a1512"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::query</span></li>
<li><a name="a1513"></a><span class="src-doc">     */</span></li>
<li><a name="a1514"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodquery">query</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1515"></a>    <span class="src-sym">{</span></li>
<li><a name="a1516"></a>        <span class="src-var">$params </span>= (array)<span class="src-var">$params</span><span class="src-sym">;</span></li>
<li><a name="a1517"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1518"></a>            <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB does not support&quot;</span></li>
<li><a name="a1519"></a>                                            . <span class="src-str">&quot; multiple execution&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1520"></a>        <span class="src-sym">}</span></li>
<li><a name="a1521"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1522"></a>            <span class="src-comm">//  We are working through a list of queries.  If the</span></li>
<li><a name="a1523"></a>            <span class="src-comm">//  number of queries received is greater than the number</span></li>
<li><a name="a1524"></a>            <span class="src-comm">//  on the list, that's an error</span></li>
<li><a name="a1525"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a> &gt;= <a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1526"></a>                <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span></li>
<li><a name="a1527"></a>                              <span class="src-str">&quot;DB_mysql::query called with&quot;</span></li>
<li><a name="a1528"></a>                             .<span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$query</span>, <span class="src-id">exceeding</span> <span class="src-id">number</span> <span class="src-id">of</span> <span class="src-id">queries</span> <span class="src-id">expected</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1529"></a>                <span class="src-sym">}            </span></li>
<li><a name="a1530"></a>        <span class="src-sym">}</span></li>
<li><a name="a1531"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$query </span>!= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_query">expected_query</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1532"></a>            <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">'DB_mysql::query() called with'</span></li>
<li><a name="a1533"></a>                 .<span class="src-str">' &quot;'</span>.<span class="src-var">$query</span>.<span class="src-str">'&quot;, expected &quot;'</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_query">expected_query</a>.<span class="src-str">'&quot;'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1534"></a>        <span class="src-sym">}</span></li>
<li><a name="a1535"></a>        <span class="src-var">$result </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_result">expected_result</a><span class="src-sym">;</span></li>
<li><a name="a1536"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1537"></a>            <span class="src-comm">//  More queries are expected.  Advance the cursor</span></li>
<li><a name="a1538"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a>++<span class="src-sym">;</span></li>
<li><a name="a1539"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#methodexpect_query">expect_query</a><span class="src-sym">(</span></li>
<li><a name="a1540"></a>              <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'query'</span><span class="src-sym">]</span><span class="src-sym">,</span></li>
<li><a name="a1541"></a>              <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list">expected_list</a><span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#var$expected_list_cursor">expected_list_cursor</a><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'result'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1542"></a>        <span class="src-sym">}</span></li>
<li><a name="a1543"></a>        <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a1544"></a><span class="src-comm">//        if (sizeof($params) &gt; 0) {</span></li>
<li><a name="a1545"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1546"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1547"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1548"></a><span class="src-comm">//            }</span></li>
<li><a name="a1549"></a><span class="src-comm">//            $ret =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1550"></a><span class="src-comm">//            $this-&gt;freePrepared($sth, false);</span></li>
<li><a name="a1551"></a><span class="src-comm">//            return $ret;</span></li>
<li><a name="a1552"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1553"></a><span class="src-comm">//            $this-&gt;last_parameters = array();</span></li>
<li><a name="a1554"></a><span class="src-comm">//            $result = $this-&gt;simpleQuery($query);</span></li>
<li><a name="a1555"></a><span class="src-comm">//            if ($result === DB_OK || DB::isError($result)) {</span></li>
<li><a name="a1556"></a><span class="src-comm">//                return $result;</span></li>
<li><a name="a1557"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a1558"></a><span class="src-comm">//                $tmp =&amp; new DB_result($this, $result);</span></li>
<li><a name="a1559"></a><span class="src-comm">//                return $tmp;</span></li>
<li><a name="a1560"></a><span class="src-comm">//            }</span></li>
<li><a name="a1561"></a><span class="src-comm">//        }</span></li>
<li><a name="a1562"></a>    <span class="src-sym">}</span></li>
<li><a name="a1563"></a>&nbsp;</li>
<li><a name="a1564"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1565"></a><span class="src-doc">     * Generates and executes a LIMIT query</span></li>
<li><a name="a1566"></a><span class="src-doc">     *</span></li>
<li><a name="a1567"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the query</span></li>
<li><a name="a1568"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">intr </span><span class="src-doc">  </span><span class="src-doc-var">$from </span><span class="src-doc">   the row to start to fetching (0 = the first row)</span></li>
<li><a name="a1569"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$count </span><span class="src-doc">  the numbers of rows to fetch</span></li>
<li><a name="a1570"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1571"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1572"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1573"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1574"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1575"></a><span class="src-doc">     *</span></li>
<li><a name="a1576"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> a new DB_result object for successful SELECT queries</span></li>
<li><a name="a1577"></a><span class="src-doc">     *                  or DB_OK for successul data manipulation queries.</span></li>
<li><a name="a1578"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1579"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::limitQuery</span></li>
<li><a name="a1580"></a><span class="src-doc">     */</span></li>
<li><a name="a1581"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodlimitQuery">limitQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$from</span><span class="src-sym">, </span><span class="src-var">$count</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1582"></a>    <span class="src-sym">{</span></li>
<li><a name="a1583"></a><span class="src-comm">//        $query = $this-&gt;modifyLimitQuery($query, $from, $count, $params);</span></li>
<li><a name="a1584"></a><span class="src-comm">//        if (DB::isError($query)){</span></li>
<li><a name="a1585"></a><span class="src-comm">//            return $query;</span></li>
<li><a name="a1586"></a><span class="src-comm">//        }</span></li>
<li><a name="a1587"></a><span class="src-comm">//        $result =&amp; $this-&gt;query($query, $params);</span></li>
<li><a name="a1588"></a><span class="src-comm">//        if (is_a($result, 'DB_result')) {</span></li>
<li><a name="a1589"></a><span class="src-comm">//            $result-&gt;setOption('limit_from', $from);</span></li>
<li><a name="a1590"></a><span class="src-comm">//            $result-&gt;setOption('limit_count', $count);</span></li>
<li><a name="a1591"></a><span class="src-comm">//        }</span></li>
<li><a name="a1592"></a><span class="src-comm">//        return $result;</span></li>
<li><a name="a1593"></a>    <span class="src-sym">}</span></li>
<li><a name="a1594"></a>&nbsp;</li>
<li><a name="a1595"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1596"></a><span class="src-doc">     * Fetches the first column of the first row from a query result</span></li>
<li><a name="a1597"></a><span class="src-doc">     *</span></li>
<li><a name="a1598"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the SQL query</span></li>
<li><a name="a1599"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1600"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1601"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1602"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1603"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1604"></a><span class="src-doc">     *</span></li>
<li><a name="a1605"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> the returned value of the query.</span></li>
<li><a name="a1606"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1607"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getOne</span></li>
<li><a name="a1608"></a><span class="src-doc">     */</span></li>
<li><a name="a1609"></a>    <span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodgetOne">getOne</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1610"></a>    <span class="src-sym">{</span></li>
<li><a name="a1611"></a>        <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#methodquery">query</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">,</span><span class="src-var">$params</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1612"></a>&nbsp;</li>
<li><a name="a1613"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1614"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1615"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1616"></a><span class="src-comm">//            }</span></li>
<li><a name="a1617"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1618"></a><span class="src-comm">//            $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1619"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1620"></a><span class="src-comm">//            $res =&amp; $this-&gt;query($query);</span></li>
<li><a name="a1621"></a><span class="src-comm">//        }</span></li>
<li><a name="a1622"></a><span class="src-comm">//</span></li>
<li><a name="a1623"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a1624"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a1625"></a><span class="src-comm">//        }</span></li>
<li><a name="a1626"></a><span class="src-comm">//</span></li>
<li><a name="a1627"></a><span class="src-comm">//        $err = $res-&gt;fetchInto($row, DB_FETCHMODE_ORDERED);</span></li>
<li><a name="a1628"></a><span class="src-comm">//        $res-&gt;free();</span></li>
<li><a name="a1629"></a><span class="src-comm">//</span></li>
<li><a name="a1630"></a><span class="src-comm">//        if ($err !== DB_OK) {</span></li>
<li><a name="a1631"></a><span class="src-comm">//            return $err;</span></li>
<li><a name="a1632"></a><span class="src-comm">//        }</span></li>
<li><a name="a1633"></a><span class="src-comm">//</span></li>
<li><a name="a1634"></a><span class="src-comm">//        return $row[0];</span></li>
<li><a name="a1635"></a>    <span class="src-sym">}</span></li>
<li><a name="a1636"></a>&nbsp;</li>
<li><a name="a1637"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1638"></a><span class="src-doc">     * Fetches the first row of data returned from a query result</span></li>
<li><a name="a1639"></a><span class="src-doc">     *</span></li>
<li><a name="a1640"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the SQL query</span></li>
<li><a name="a1641"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1642"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1643"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1644"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1645"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1646"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$fetchmode </span><span class="src-doc"> the fetch mode to use</span></li>
<li><a name="a1647"></a><span class="src-doc">     *</span></li>
<li><a name="a1648"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> the first row of results as an array.</span></li>
<li><a name="a1649"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a1650"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getRow</span></li>
<li><a name="a1651"></a><span class="src-doc">     */</span></li>
<li><a name="a1652"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodgetRow">getRow</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a1653"></a>                     <span class="src-var">$fetchmode </span>= <span class="src-id">DB_FETCHMODE_DEFAULT</span><span class="src-sym">)</span></li>
<li><a name="a1654"></a>    <span class="src-sym">{</span></li>
<li><a name="a1655"></a><span class="src-comm">//        // compat check, the params and fetchmode parameters used to</span></li>
<li><a name="a1656"></a><span class="src-comm">//        // have the opposite order</span></li>
<li><a name="a1657"></a><span class="src-comm">//        if (!is_array($params)) {</span></li>
<li><a name="a1658"></a><span class="src-comm">//            if (is_array($fetchmode)) {</span></li>
<li><a name="a1659"></a><span class="src-comm">//                if ($params === null) {</span></li>
<li><a name="a1660"></a><span class="src-comm">//                    $tmp = DB_FETCHMODE_DEFAULT;</span></li>
<li><a name="a1661"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a1662"></a><span class="src-comm">//                    $tmp = $params;</span></li>
<li><a name="a1663"></a><span class="src-comm">//                }</span></li>
<li><a name="a1664"></a><span class="src-comm">//                $params = $fetchmode;</span></li>
<li><a name="a1665"></a><span class="src-comm">//                $fetchmode = $tmp;</span></li>
<li><a name="a1666"></a><span class="src-comm">//            } elseif ($params !== null) {</span></li>
<li><a name="a1667"></a><span class="src-comm">//                $fetchmode = $params;</span></li>
<li><a name="a1668"></a><span class="src-comm">//                $params = array();</span></li>
<li><a name="a1669"></a><span class="src-comm">//            }</span></li>
<li><a name="a1670"></a><span class="src-comm">//        }</span></li>
<li><a name="a1671"></a><span class="src-comm">//        // modifyLimitQuery() would be nice here, but it causes BC issues</span></li>
<li><a name="a1672"></a><span class="src-comm">//        if (sizeof($params) &gt; 0) {</span></li>
<li><a name="a1673"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1674"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1675"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1676"></a><span class="src-comm">//            }</span></li>
<li><a name="a1677"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1678"></a><span class="src-comm">//            $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1679"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1680"></a><span class="src-comm">//            $res =&amp; $this-&gt;query($query);</span></li>
<li><a name="a1681"></a><span class="src-comm">//        }</span></li>
<li><a name="a1682"></a><span class="src-comm">//</span></li>
<li><a name="a1683"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a1684"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a1685"></a><span class="src-comm">//        }</span></li>
<li><a name="a1686"></a><span class="src-comm">//</span></li>
<li><a name="a1687"></a><span class="src-comm">//        $err = $res-&gt;fetchInto($row, $fetchmode);</span></li>
<li><a name="a1688"></a><span class="src-comm">//</span></li>
<li><a name="a1689"></a><span class="src-comm">//        $res-&gt;free();</span></li>
<li><a name="a1690"></a><span class="src-comm">//</span></li>
<li><a name="a1691"></a><span class="src-comm">//        if ($err !== DB_OK) {</span></li>
<li><a name="a1692"></a><span class="src-comm">//            return $err;</span></li>
<li><a name="a1693"></a><span class="src-comm">//        }</span></li>
<li><a name="a1694"></a><span class="src-comm">//</span></li>
<li><a name="a1695"></a><span class="src-comm">//        return $row;</span></li>
<li><a name="a1696"></a>    <span class="src-sym">}</span></li>
<li><a name="a1697"></a>&nbsp;</li>
<li><a name="a1698"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1699"></a><span class="src-doc">     * Fetches a single column from a query result and returns it as an</span></li>
<li><a name="a1700"></a><span class="src-doc">     * indexed array</span></li>
<li><a name="a1701"></a><span class="src-doc">     *</span></li>
<li><a name="a1702"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the SQL query</span></li>
<li><a name="a1703"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$col </span><span class="src-doc">    which column to return (integer [column number,</span></li>
<li><a name="a1704"></a><span class="src-doc">     *                          starting at 0] or string [column name])</span></li>
<li><a name="a1705"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a1706"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a1707"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a1708"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a1709"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a1710"></a><span class="src-doc">     *</span></li>
<li><a name="a1711"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> the results as an array.  A DB_Error object on failure.</span></li>
<li><a name="a1712"></a><span class="src-doc">     *</span></li>
<li><a name="a1713"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::query()</span></li>
<li><a name="a1714"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getCol</span></li>
<li><a name="a1715"></a><span class="src-doc">     */</span></li>
<li><a name="a1716"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodgetCol">getCol</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$col </span>= <span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a1717"></a>    <span class="src-sym">{</span></li>
<li><a name="a1718"></a><span class="src-comm">//        $params = (array)$params;</span></li>
<li><a name="a1719"></a><span class="src-comm">//        if (sizeof($params) &gt; 0) {</span></li>
<li><a name="a1720"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1721"></a><span class="src-comm">//</span></li>
<li><a name="a1722"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1723"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1724"></a><span class="src-comm">//            }</span></li>
<li><a name="a1725"></a><span class="src-comm">//</span></li>
<li><a name="a1726"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1727"></a><span class="src-comm">//            $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1728"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1729"></a><span class="src-comm">//            $res =&amp; $this-&gt;query($query);</span></li>
<li><a name="a1730"></a><span class="src-comm">//        }</span></li>
<li><a name="a1731"></a><span class="src-comm">//</span></li>
<li><a name="a1732"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a1733"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a1734"></a><span class="src-comm">//        }</span></li>
<li><a name="a1735"></a><span class="src-comm">//</span></li>
<li><a name="a1736"></a><span class="src-comm">//        $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;</span></li>
<li><a name="a1737"></a><span class="src-comm">//</span></li>
<li><a name="a1738"></a><span class="src-comm">//        if (!is_array($row = $res-&gt;fetchRow($fetchmode))) {</span></li>
<li><a name="a1739"></a><span class="src-comm">//            $ret = array();</span></li>
<li><a name="a1740"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1741"></a><span class="src-comm">//            if (!array_key_exists($col, $row)) {</span></li>
<li><a name="a1742"></a><span class="src-comm">//                $ret =&amp; $this-&gt;raiseError(DB_ERROR_NOSUCHFIELD);</span></li>
<li><a name="a1743"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a1744"></a><span class="src-comm">//                $ret = array($row[$col]);</span></li>
<li><a name="a1745"></a><span class="src-comm">//                while (is_array($row = $res-&gt;fetchRow($fetchmode))) {</span></li>
<li><a name="a1746"></a><span class="src-comm">//                    $ret[] = $row[$col];</span></li>
<li><a name="a1747"></a><span class="src-comm">//                }</span></li>
<li><a name="a1748"></a><span class="src-comm">//            }</span></li>
<li><a name="a1749"></a><span class="src-comm">//        }</span></li>
<li><a name="a1750"></a><span class="src-comm">//</span></li>
<li><a name="a1751"></a><span class="src-comm">//        $res-&gt;free();</span></li>
<li><a name="a1752"></a><span class="src-comm">//</span></li>
<li><a name="a1753"></a><span class="src-comm">//        if (DB::isError($row)) {</span></li>
<li><a name="a1754"></a><span class="src-comm">//            $ret = $row;</span></li>
<li><a name="a1755"></a><span class="src-comm">//        }</span></li>
<li><a name="a1756"></a><span class="src-comm">//</span></li>
<li><a name="a1757"></a><span class="src-comm">//        return $ret;</span></li>
<li><a name="a1758"></a>    <span class="src-sym">}</span></li>
<li><a name="a1759"></a>&nbsp;</li>
<li><a name="a1760"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1761"></a><span class="src-doc">     * Fetches an entire query result and returns it as an</span></li>
<li><a name="a1762"></a><span class="src-doc">     * associative array using the first column as the key</span></li>
<li><a name="a1763"></a><span class="src-doc">     *</span></li>
<li><a name="a1764"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">       the SQL query</span></li>
<li><a name="a1765"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc">  </span><span class="src-doc-var">$force_array </span><span class="src-doc"> used only when the query returns</span></li>
<li><a name="a1766"></a><span class="src-doc">     *                               exactly two columns.  If true, the values</span></li>
<li><a name="a1767"></a><span class="src-doc">     *                               of the returned array will be one-element</span></li>
<li><a name="a1768"></a><span class="src-doc">     *                               arrays instead of scalars.</span></li>
<li><a name="a1769"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc">      array, string or numeric data to be used in</span></li>
<li><a name="a1770"></a><span class="src-doc">     *                               execution of the statement.  Quantity of</span></li>
<li><a name="a1771"></a><span class="src-doc">     *                               items passed must match quantity of</span></li>
<li><a name="a1772"></a><span class="src-doc">     *                               placeholders in query:  meaning 1</span></li>
<li><a name="a1773"></a><span class="src-doc">     *                               placeholder for non-array parameters or</span></li>
<li><a name="a1774"></a><span class="src-doc">     *                               1 placeholder per array element.</span></li>
<li><a name="a1775"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">  </span><span class="src-doc-var">$fetchmode </span><span class="src-doc">    the fetch mode to use</span></li>
<li><a name="a1776"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc"> </span><span class="src-doc-var">$group </span><span class="src-doc">        if true, the values of the returned array</span></li>
<li><a name="a1777"></a><span class="src-doc">     *                               is wrapped in another array.  If the same</span></li>
<li><a name="a1778"></a><span class="src-doc">     *                               key value (in the first column) repeats</span></li>
<li><a name="a1779"></a><span class="src-doc">     *                               itself, the values will be appended to</span></li>
<li><a name="a1780"></a><span class="src-doc">     *                               this array instead of overwriting the</span></li>
<li><a name="a1781"></a><span class="src-doc">     *                               existing values.</span></li>
<li><a name="a1782"></a><span class="src-doc">     *</span></li>
<li><a name="a1783"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> the associative array containing the query results.</span></li>
<li><a name="a1784"></a><span class="src-doc">     *                 A DB_Error object on failure.</span></li>
<li><a name="a1785"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getAssoc</span></li>
<li><a name="a1786"></a><span class="src-doc">     */</span></li>
<li><a name="a1787"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodgetAssoc">getAssoc</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$force_array </span>= <span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a1788"></a>                       <span class="src-var">$fetchmode </span>= <span class="src-id">DB_FETCHMODE_DEFAULT</span><span class="src-sym">, </span><span class="src-var">$group </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a1789"></a>    <span class="src-sym">{</span></li>
<li><a name="a1790"></a><span class="src-comm">//        $params = (array)$params;</span></li>
<li><a name="a1791"></a><span class="src-comm">//        if (sizeof($params) &gt; 0) {</span></li>
<li><a name="a1792"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1793"></a><span class="src-comm">//</span></li>
<li><a name="a1794"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1795"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1796"></a><span class="src-comm">//            }</span></li>
<li><a name="a1797"></a><span class="src-comm">//</span></li>
<li><a name="a1798"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1799"></a><span class="src-comm">//            $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1800"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1801"></a><span class="src-comm">//            $res =&amp; $this-&gt;query($query);</span></li>
<li><a name="a1802"></a><span class="src-comm">//        }</span></li>
<li><a name="a1803"></a><span class="src-comm">//</span></li>
<li><a name="a1804"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a1805"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a1806"></a><span class="src-comm">//        }</span></li>
<li><a name="a1807"></a><span class="src-comm">//        if ($fetchmode == DB_FETCHMODE_DEFAULT) {</span></li>
<li><a name="a1808"></a><span class="src-comm">//            $fetchmode = $this-&gt;fetchmode;</span></li>
<li><a name="a1809"></a><span class="src-comm">//        }</span></li>
<li><a name="a1810"></a><span class="src-comm">//        $cols = $res-&gt;numCols();</span></li>
<li><a name="a1811"></a><span class="src-comm">//</span></li>
<li><a name="a1812"></a><span class="src-comm">//        if ($cols &lt; 2) {</span></li>
<li><a name="a1813"></a><span class="src-comm">//            $tmp =&amp; $this-&gt;raiseError(DB_ERROR_TRUNCATED);</span></li>
<li><a name="a1814"></a><span class="src-comm">//            return $tmp;</span></li>
<li><a name="a1815"></a><span class="src-comm">//        }</span></li>
<li><a name="a1816"></a><span class="src-comm">//</span></li>
<li><a name="a1817"></a><span class="src-comm">//        $results = array();</span></li>
<li><a name="a1818"></a><span class="src-comm">//</span></li>
<li><a name="a1819"></a><span class="src-comm">//        if ($cols &gt; 2 || $force_array) {</span></li>
<li><a name="a1820"></a><span class="src-comm">//            // return array values</span></li>
<li><a name="a1821"></a><span class="src-comm">//            // XXX this part can be optimized</span></li>
<li><a name="a1822"></a><span class="src-comm">//            if ($fetchmode == DB_FETCHMODE_ASSOC) {</span></li>
<li><a name="a1823"></a><span class="src-comm">//                while (is_array($row = $res-&gt;fetchRow(DB_FETCHMODE_ASSOC))) {</span></li>
<li><a name="a1824"></a><span class="src-comm">//                    reset($row);</span></li>
<li><a name="a1825"></a><span class="src-comm">//                    $key = current($row);</span></li>
<li><a name="a1826"></a><span class="src-comm">//                    unset($row[key($row)]);</span></li>
<li><a name="a1827"></a><span class="src-comm">//                    if ($group) {</span></li>
<li><a name="a1828"></a><span class="src-comm">//                        $results[$key][] = $row;</span></li>
<li><a name="a1829"></a><span class="src-comm">//                    } else {</span></li>
<li><a name="a1830"></a><span class="src-comm">//                        $results[$key] = $row;</span></li>
<li><a name="a1831"></a><span class="src-comm">//                    }</span></li>
<li><a name="a1832"></a><span class="src-comm">//                }</span></li>
<li><a name="a1833"></a><span class="src-comm">//            } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {</span></li>
<li><a name="a1834"></a><span class="src-comm">//                while ($row = $res-&gt;fetchRow(DB_FETCHMODE_OBJECT)) {</span></li>
<li><a name="a1835"></a><span class="src-comm">//                    $arr = get_object_vars($row);</span></li>
<li><a name="a1836"></a><span class="src-comm">//                    $key = current($arr);</span></li>
<li><a name="a1837"></a><span class="src-comm">//                    if ($group) {</span></li>
<li><a name="a1838"></a><span class="src-comm">//                        $results[$key][] = $row;</span></li>
<li><a name="a1839"></a><span class="src-comm">//                    } else {</span></li>
<li><a name="a1840"></a><span class="src-comm">//                        $results[$key] = $row;</span></li>
<li><a name="a1841"></a><span class="src-comm">//                    }</span></li>
<li><a name="a1842"></a><span class="src-comm">//                }</span></li>
<li><a name="a1843"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a1844"></a><span class="src-comm">//                while (is_array($row = $res-&gt;fetchRow(DB_FETCHMODE_ORDERED))) {</span></li>
<li><a name="a1845"></a><span class="src-comm">//                    // we shift away the first element to get</span></li>
<li><a name="a1846"></a><span class="src-comm">//                    // indices running from 0 again</span></li>
<li><a name="a1847"></a><span class="src-comm">//                    $key = array_shift($row);</span></li>
<li><a name="a1848"></a><span class="src-comm">//                    if ($group) {</span></li>
<li><a name="a1849"></a><span class="src-comm">//                        $results[$key][] = $row;</span></li>
<li><a name="a1850"></a><span class="src-comm">//                    } else {</span></li>
<li><a name="a1851"></a><span class="src-comm">//                        $results[$key] = $row;</span></li>
<li><a name="a1852"></a><span class="src-comm">//                    }</span></li>
<li><a name="a1853"></a><span class="src-comm">//                }</span></li>
<li><a name="a1854"></a><span class="src-comm">//            }</span></li>
<li><a name="a1855"></a><span class="src-comm">//            if (DB::isError($row)) {</span></li>
<li><a name="a1856"></a><span class="src-comm">//                $results = $row;</span></li>
<li><a name="a1857"></a><span class="src-comm">//            }</span></li>
<li><a name="a1858"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1859"></a><span class="src-comm">//            // return scalar values</span></li>
<li><a name="a1860"></a><span class="src-comm">//            while (is_array($row = $res-&gt;fetchRow(DB_FETCHMODE_ORDERED))) {</span></li>
<li><a name="a1861"></a><span class="src-comm">//                if ($group) {</span></li>
<li><a name="a1862"></a><span class="src-comm">//                    $results[$row[0]][] = $row[1];</span></li>
<li><a name="a1863"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a1864"></a><span class="src-comm">//                    $results[$row[0]] = $row[1];</span></li>
<li><a name="a1865"></a><span class="src-comm">//                }</span></li>
<li><a name="a1866"></a><span class="src-comm">//            }</span></li>
<li><a name="a1867"></a><span class="src-comm">//            if (DB::isError($row)) {</span></li>
<li><a name="a1868"></a><span class="src-comm">//                $results = $row;</span></li>
<li><a name="a1869"></a><span class="src-comm">//            }</span></li>
<li><a name="a1870"></a><span class="src-comm">//        }</span></li>
<li><a name="a1871"></a><span class="src-comm">//</span></li>
<li><a name="a1872"></a><span class="src-comm">//        $res-&gt;free();</span></li>
<li><a name="a1873"></a><span class="src-comm">//</span></li>
<li><a name="a1874"></a><span class="src-comm">//        return $results;</span></li>
<li><a name="a1875"></a>    <span class="src-sym">}</span></li>
<li><a name="a1876"></a>&nbsp;</li>
<li><a name="a1877"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1878"></a><span class="src-doc">     * Fetches all of the rows from a query result</span></li>
<li><a name="a1879"></a><span class="src-doc">     *</span></li>
<li><a name="a1880"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">     the SQL query</span></li>
<li><a name="a1881"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc">    array, string or numeric data to be used in</span></li>
<li><a name="a1882"></a><span class="src-doc">     *                             execution of the statement.  Quantity of</span></li>
<li><a name="a1883"></a><span class="src-doc">     *                             items passed must match quantity of</span></li>
<li><a name="a1884"></a><span class="src-doc">     *                             placeholders in query:  meaning 1</span></li>
<li><a name="a1885"></a><span class="src-doc">     *                             placeholder for non-array parameters or</span></li>
<li><a name="a1886"></a><span class="src-doc">     *                             1 placeholder per array element.</span></li>
<li><a name="a1887"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$fetchmode </span><span class="src-doc"> the fetch mode to use:</span></li>
<li><a name="a1888"></a><span class="src-doc">     *                             + DB_FETCHMODE_ORDERED</span></li>
<li><a name="a1889"></a><span class="src-doc">     *                             + DB_FETCHMODE_ASSOC</span></li>
<li><a name="a1890"></a><span class="src-doc">     *                             + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED</span></li>
<li><a name="a1891"></a><span class="src-doc">     *                             + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED</span></li>
<li><a name="a1892"></a><span class="src-doc">     *</span></li>
<li><a name="a1893"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> the nested array.  A DB_Error object on failure.</span></li>
<li><a name="a1894"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getAll</span></li>
<li><a name="a1895"></a><span class="src-doc">     */</span></li>
<li><a name="a1896"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodgetAll">getAll</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a1897"></a>                     <span class="src-var">$fetchmode </span>= <span class="src-id">DB_FETCHMODE_DEFAULT</span><span class="src-sym">)</span></li>
<li><a name="a1898"></a>    <span class="src-sym">{</span></li>
<li><a name="a1899"></a><span class="src-comm">//        // compat check, the params and fetchmode parameters used to</span></li>
<li><a name="a1900"></a><span class="src-comm">//        // have the opposite order</span></li>
<li><a name="a1901"></a><span class="src-comm">//        if (!is_array($params)) {</span></li>
<li><a name="a1902"></a><span class="src-comm">//            if (is_array($fetchmode)) {</span></li>
<li><a name="a1903"></a><span class="src-comm">//                if ($params === null) {</span></li>
<li><a name="a1904"></a><span class="src-comm">//                    $tmp = DB_FETCHMODE_DEFAULT;</span></li>
<li><a name="a1905"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a1906"></a><span class="src-comm">//                    $tmp = $params;</span></li>
<li><a name="a1907"></a><span class="src-comm">//                }</span></li>
<li><a name="a1908"></a><span class="src-comm">//                $params = $fetchmode;</span></li>
<li><a name="a1909"></a><span class="src-comm">//                $fetchmode = $tmp;</span></li>
<li><a name="a1910"></a><span class="src-comm">//            } elseif ($params !== null) {</span></li>
<li><a name="a1911"></a><span class="src-comm">//                $fetchmode = $params;</span></li>
<li><a name="a1912"></a><span class="src-comm">//                $params = array();</span></li>
<li><a name="a1913"></a><span class="src-comm">//            }</span></li>
<li><a name="a1914"></a><span class="src-comm">//        }</span></li>
<li><a name="a1915"></a><span class="src-comm">//</span></li>
<li><a name="a1916"></a><span class="src-comm">//        if (sizeof($params) &gt; 0) {</span></li>
<li><a name="a1917"></a><span class="src-comm">//            $sth = $this-&gt;prepare($query);</span></li>
<li><a name="a1918"></a><span class="src-comm">//</span></li>
<li><a name="a1919"></a><span class="src-comm">//            if (DB::isError($sth)) {</span></li>
<li><a name="a1920"></a><span class="src-comm">//                return $sth;</span></li>
<li><a name="a1921"></a><span class="src-comm">//            }</span></li>
<li><a name="a1922"></a><span class="src-comm">//</span></li>
<li><a name="a1923"></a><span class="src-comm">//            $res =&amp; $this-&gt;execute($sth, $params);</span></li>
<li><a name="a1924"></a><span class="src-comm">//            $this-&gt;freePrepared($sth);</span></li>
<li><a name="a1925"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a1926"></a><span class="src-comm">//            $res =&amp; $this-&gt;query($query);</span></li>
<li><a name="a1927"></a><span class="src-comm">//        }</span></li>
<li><a name="a1928"></a><span class="src-comm">//</span></li>
<li><a name="a1929"></a><span class="src-comm">//        if ($res === DB_OK || DB::isError($res)) {</span></li>
<li><a name="a1930"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a1931"></a><span class="src-comm">//        }</span></li>
<li><a name="a1932"></a><span class="src-comm">//</span></li>
<li><a name="a1933"></a><span class="src-comm">//        $results = array();</span></li>
<li><a name="a1934"></a><span class="src-comm">//        while (DB_OK === $res-&gt;fetchInto($row, $fetchmode)) {</span></li>
<li><a name="a1935"></a><span class="src-comm">//            if ($fetchmode &amp; DB_FETCHMODE_FLIPPED) {</span></li>
<li><a name="a1936"></a><span class="src-comm">//                foreach ($row as $key =&gt; $val) {</span></li>
<li><a name="a1937"></a><span class="src-comm">//                    $results[$key][] = $val;</span></li>
<li><a name="a1938"></a><span class="src-comm">//                }</span></li>
<li><a name="a1939"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a1940"></a><span class="src-comm">//                $results[] = $row;</span></li>
<li><a name="a1941"></a><span class="src-comm">//            }</span></li>
<li><a name="a1942"></a><span class="src-comm">//        }</span></li>
<li><a name="a1943"></a><span class="src-comm">//</span></li>
<li><a name="a1944"></a><span class="src-comm">//        $res-&gt;free();</span></li>
<li><a name="a1945"></a><span class="src-comm">//</span></li>
<li><a name="a1946"></a><span class="src-comm">//        if (DB::isError($row)) {</span></li>
<li><a name="a1947"></a><span class="src-comm">//            $tmp =&amp; $this-&gt;raiseError($row);</span></li>
<li><a name="a1948"></a><span class="src-comm">//            return $tmp;</span></li>
<li><a name="a1949"></a><span class="src-comm">//        }</span></li>
<li><a name="a1950"></a><span class="src-comm">//        return $results;</span></li>
<li><a name="a1951"></a>    <span class="src-sym">}</span></li>
<li><a name="a1952"></a>&nbsp;</li>
<li><a name="a1953"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1954"></a><span class="src-doc">     * Enables or disables automatic commits</span></li>
<li><a name="a1955"></a><span class="src-doc">     *</span></li>
<li><a name="a1956"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc-var">$onoff </span><span class="src-doc"> true turns it on, false turns it off</span></li>
<li><a name="a1957"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object if the driver</span></li>
<li><a name="a1958"></a><span class="src-doc">     *                doesn't support auto-committing transactions.</span></li>
<li><a name="a1959"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::autoCommit</span></li>
<li><a name="a1960"></a><span class="src-doc">     */</span></li>
<li><a name="a1961"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodautoCommit">autoCommit</a><span class="src-sym">(</span><span class="src-var">$onoff </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a1962"></a>    <span class="src-sym">{</span></li>
<li><a name="a1963"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a1964"></a>    <span class="src-sym">}</span></li>
<li><a name="a1965"></a>&nbsp;</li>
<li><a name="a1966"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1967"></a><span class="src-doc">     * Commits the current transaction</span></li>
<li><a name="a1968"></a><span class="src-doc">     *</span></li>
<li><a name="a1969"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a1970"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::commit</span></li>
<li><a name="a1971"></a><span class="src-doc">     */</span></li>
<li><a name="a1972"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodcommit">commit</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a1973"></a>    <span class="src-sym">{</span></li>
<li><a name="a1974"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a1975"></a>    <span class="src-sym">}</span></li>
<li><a name="a1976"></a>&nbsp;</li>
<li><a name="a1977"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1978"></a><span class="src-doc">     * Reverts the current transaction</span></li>
<li><a name="a1979"></a><span class="src-doc">     *</span></li>
<li><a name="a1980"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a1981"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::rollback</span></li>
<li><a name="a1982"></a><span class="src-doc">     */</span></li>
<li><a name="a1983"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodrollback">rollback</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a1984"></a>    <span class="src-sym">{</span></li>
<li><a name="a1985"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a1986"></a>    <span class="src-sym">}</span></li>
<li><a name="a1987"></a>&nbsp;</li>
<li><a name="a1988"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1989"></a><span class="src-doc">     * Determines the number of rows in a query result</span></li>
<li><a name="a1990"></a><span class="src-doc">     *</span></li>
<li><a name="a1991"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc"> the query result idenifier produced by PHP</span></li>
<li><a name="a1992"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of rows.  A DB_Error object on failure.</span></li>
<li><a name="a1993"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::numRows</span></li>
<li><a name="a1994"></a><span class="src-doc">     */</span></li>
<li><a name="a1995"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodnumRows">numRows</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a1996"></a>    <span class="src-sym">{</span></li>
<li><a name="a1997"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a1998"></a>    <span class="src-sym">}</span></li>
<li><a name="a1999"></a>&nbsp;</li>
<li><a name="a2000"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2001"></a><span class="src-doc">     * Determines the number of rows affected by a data maniuplation query</span></li>
<li><a name="a2002"></a><span class="src-doc">     *</span></li>
<li><a name="a2003"></a><span class="src-doc">     * 0 is returned for queries that don't manipulate data.</span></li>
<li><a name="a2004"></a><span class="src-doc">     *</span></li>
<li><a name="a2005"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of rows.  A DB_Error object on failure.</span></li>
<li><a name="a2006"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::affectedRows</span></li>
<li><a name="a2007"></a><span class="src-doc">     */</span></li>
<li><a name="a2008"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodaffectedRows">affectedRows</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2009"></a>    <span class="src-sym">{</span></li>
<li><a name="a2010"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a2011"></a>    <span class="src-sym">}</span></li>
<li><a name="a2012"></a>&nbsp;</li>
<li><a name="a2013"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2014"></a><span class="src-doc">     * Generates the name used inside the database for a sequence</span></li>
<li><a name="a2015"></a><span class="src-doc">     *</span></li>
<li><a name="a2016"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$sqn </span><span class="src-doc"> the sequence's public name</span></li>
<li><a name="a2017"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the sequence's name in the backend</span></li>
<li><a name="a2018"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::createSequence(), DB_common::dropSequence(),</span></li>
<li><a name="a2019"></a><span class="src-doc">     *       DB_common::nextID(), DB_common::setOption()</span></li>
<li><a name="a2020"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getSequenceName</span></li>
<li><a name="a2021"></a><span class="src-doc">     */</span></li>
<li><a name="a2022"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodgetSequenceName">getSequenceName</a><span class="src-sym">(</span><span class="src-var">$sqn</span><span class="src-sym">)</span></li>
<li><a name="a2023"></a>    <span class="src-sym">{</span></li>
<li><a name="a2024"></a><span class="src-comm">//        return sprintf($this-&gt;getOption('seqname_format'),</span></li>
<li><a name="a2025"></a><span class="src-comm">//                       preg_replace('/[^a-z0-9_.]/i', '_', $sqn));</span></li>
<li><a name="a2026"></a>    <span class="src-sym">}</span></li>
<li><a name="a2027"></a>&nbsp;</li>
<li><a name="a2028"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2029"></a><span class="src-doc">     * Returns the next free id in a sequence</span></li>
<li><a name="a2030"></a><span class="src-doc">     *</span></li>
<li><a name="a2031"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the sequence</span></li>
<li><a name="a2032"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">boolean </span><span class="src-doc-var">$ondemand </span><span class="src-doc"> when true, the seqence is automatically</span></li>
<li><a name="a2033"></a><span class="src-doc">     *                             created if it does not exist</span></li>
<li><a name="a2034"></a><span class="src-doc">     *</span></li>
<li><a name="a2035"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the next id number in the sequence.</span></li>
<li><a name="a2036"></a><span class="src-doc">     *                A DB_Error object on failure.</span></li>
<li><a name="a2037"></a><span class="src-doc">     *</span></li>
<li><a name="a2038"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::createSequence(), DB_common::dropSequence(),</span></li>
<li><a name="a2039"></a><span class="src-doc">     *       DB_common::getSequenceName()</span></li>
<li><a name="a2040"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::nextID</span></li>
<li><a name="a2041"></a><span class="src-doc">     */</span></li>
<li><a name="a2042"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodnextId">nextId</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">, </span><span class="src-var">$ondemand </span>= <span class="src-id">true</span><span class="src-sym">)</span></li>
<li><a name="a2043"></a>    <span class="src-sym">{</span></li>
<li><a name="a2044"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a2045"></a>    <span class="src-sym">}</span></li>
<li><a name="a2046"></a>&nbsp;</li>
<li><a name="a2047"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2048"></a><span class="src-doc">     * Creates a new sequence</span></li>
<li><a name="a2049"></a><span class="src-doc">     *</span></li>
<li><a name="a2050"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the new sequence</span></li>
<li><a name="a2051"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a2052"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::dropSequence(), DB_common::getSequenceName(),</span></li>
<li><a name="a2053"></a><span class="src-doc">     *       DB_common::nextID()</span></li>
<li><a name="a2054"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::createSequence</span></li>
<li><a name="a2055"></a><span class="src-doc">     */</span></li>
<li><a name="a2056"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodcreateSequence">createSequence</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">)</span></li>
<li><a name="a2057"></a>    <span class="src-sym">{</span></li>
<li><a name="a2058"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a2059"></a>    <span class="src-sym">}</span></li>
<li><a name="a2060"></a>&nbsp;</li>
<li><a name="a2061"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2062"></a><span class="src-doc">     * Deletes a sequence</span></li>
<li><a name="a2063"></a><span class="src-doc">     *</span></li>
<li><a name="a2064"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the sequence to be deleted</span></li>
<li><a name="a2065"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a2066"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::createSequence(), DB_common::getSequenceName(),</span></li>
<li><a name="a2067"></a><span class="src-doc">     *       DB_common::nextID()</span></li>
<li><a name="a2068"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::dropSequence</span></li>
<li><a name="a2069"></a><span class="src-doc">     */</span></li>
<li><a name="a2070"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methoddropSequence">dropSequence</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">)</span></li>
<li><a name="a2071"></a>    <span class="src-sym">{</span></li>
<li><a name="a2072"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a2073"></a>    <span class="src-sym">}</span></li>
<li><a name="a2074"></a>&nbsp;</li>
<li><a name="a2075"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2076"></a><span class="src-doc">     * Communicates an error and invoke error callbacks, etc</span></li>
<li><a name="a2077"></a><span class="src-doc">     *</span></li>
<li><a name="a2078"></a><span class="src-doc">     * Basically a wrapper for PEAR::raiseError without the message string.</span></li>
<li><a name="a2079"></a><span class="src-doc">     *</span></li>
<li><a name="a2080"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc">  integer error code, or a PEAR error object (all</span></li>
<li><a name="a2081"></a><span class="src-doc">     *                  other parameters are ignored if this parameter is</span></li>
<li><a name="a2082"></a><span class="src-doc">     *                  an object</span></li>
<li><a name="a2083"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">    error mode, see PEAR_Error docs</span></li>
<li><a name="a2084"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc">  if error mode is PEAR_ERROR_TRIGGER, this is the</span></li>
<li><a name="a2085"></a><span class="src-doc">     *                  error level (E_USER_NOTICE etc).  If error mode is</span></li>
<li><a name="a2086"></a><span class="src-doc">     *                  PEAR_ERROR_CALLBACK, this is the callback function,</span></li>
<li><a name="a2087"></a><span class="src-doc">     *                  either as a function name, or as an array of an</span></li>
<li><a name="a2088"></a><span class="src-doc">     *                  object and method name.  For other error modes this</span></li>
<li><a name="a2089"></a><span class="src-doc">     *                  parameter is ignored.</span></li>
<li><a name="a2090"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc"> extra debug information.  Defaults to the last</span></li>
<li><a name="a2091"></a><span class="src-doc">     *                  query and native error code.</span></li>
<li><a name="a2092"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc">  native error code, integer or string depending the</span></li>
<li><a name="a2093"></a><span class="src-doc">     *                  backend</span></li>
<li><a name="a2094"></a><span class="src-doc">     *</span></li>
<li><a name="a2095"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">object </span><span class="src-doc"> </span><span class="src-doc-type">the </span><span class="src-doc">PEAR_Error object</span></li>
<li><a name="a2096"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> PEAR_Error</span></li>
<li><a name="a2097"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::raiseError</span></li>
<li><a name="a2098"></a><span class="src-doc">     */</span></li>
<li><a name="a2099"></a>    <span class="src-key">public </span><span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_common.html#methodraiseError">raiseError</a><span class="src-sym">(</span><span class="src-var">$code </span>= <span class="src-id">DB_ERROR</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">null</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-id">null</span><span class="src-sym">,</span></li>
<li><a name="a2100"></a>                         <span class="src-var">$userinfo </span>= <span class="src-id">null</span><span class="src-sym">, </span><span class="src-var">$nativecode </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2101"></a>    <span class="src-sym">{</span></li>
<li><a name="a2102"></a><span class="src-comm">//        // The error is yet a DB error object</span></li>
<li><a name="a2103"></a><span class="src-comm">//        if (is_object($code)) {</span></li>
<li><a name="a2104"></a><span class="src-comm">//            // because we the static PEAR::raiseError, our global</span></li>
<li><a name="a2105"></a><span class="src-comm">//            // handler should be used if it is set</span></li>
<li><a name="a2106"></a><span class="src-comm">//            if ($mode === null &amp;&amp; !empty($this-&gt;_default_error_mode)) {</span></li>
<li><a name="a2107"></a><span class="src-comm">//                $mode    = $this-&gt;_default_error_mode;</span></li>
<li><a name="a2108"></a><span class="src-comm">//                $options = $this-&gt;_default_error_options;</span></li>
<li><a name="a2109"></a><span class="src-comm">//            }</span></li>
<li><a name="a2110"></a><span class="src-comm">//            $tmp = PEAR::raiseError($code, null, $mode, $options,</span></li>
<li><a name="a2111"></a><span class="src-comm">//                                    null, null, true);</span></li>
<li><a name="a2112"></a><span class="src-comm">//            return $tmp;</span></li>
<li><a name="a2113"></a><span class="src-comm">//        }</span></li>
<li><a name="a2114"></a><span class="src-comm">//</span></li>
<li><a name="a2115"></a><span class="src-comm">//        if ($userinfo === null) {</span></li>
<li><a name="a2116"></a><span class="src-comm">//            $userinfo = $this-&gt;last_query;</span></li>
<li><a name="a2117"></a><span class="src-comm">//        }</span></li>
<li><a name="a2118"></a><span class="src-comm">//</span></li>
<li><a name="a2119"></a><span class="src-comm">//        if ($nativecode) {</span></li>
<li><a name="a2120"></a><span class="src-comm">//            $userinfo .= ' [nativecode=' . trim($nativecode) . ']';</span></li>
<li><a name="a2121"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2122"></a><span class="src-comm">//            $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';</span></li>
<li><a name="a2123"></a><span class="src-comm">//        }</span></li>
<li><a name="a2124"></a><span class="src-comm">//</span></li>
<li><a name="a2125"></a><span class="src-comm">//        $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,</span></li>
<li><a name="a2126"></a><span class="src-comm">//                                'DB_Error', true);</span></li>
<li><a name="a2127"></a><span class="src-comm">//        return $tmp;</span></li>
<li><a name="a2128"></a>    <span class="src-sym">}</span></li>
<li><a name="a2129"></a>&nbsp;</li>
<li><a name="a2130"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2131"></a><span class="src-doc">     * Gets the DBMS' native error code produced by the last query</span></li>
<li><a name="a2132"></a><span class="src-doc">     *</span></li>
<li><a name="a2133"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> the DBMS' error code.  A DB_Error object on failure.</span></li>
<li><a name="a2134"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::errorNative</span></li>
<li><a name="a2135"></a><span class="src-doc">     */</span></li>
<li><a name="a2136"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methoderrorNative">errorNative</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2137"></a>    <span class="src-sym">{</span></li>
<li><a name="a2138"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_NOT_CAPABLE);</span></li>
<li><a name="a2139"></a>    <span class="src-sym">}</span></li>
<li><a name="a2140"></a>&nbsp;</li>
<li><a name="a2141"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2142"></a><span class="src-doc">     * Maps native error codes to DB's portable ones</span></li>
<li><a name="a2143"></a><span class="src-doc">     *</span></li>
<li><a name="a2144"></a><span class="src-doc">     * Uses the &lt;var&gt;$errorcode_map&lt;/var&gt; property defined in each driver.</span></li>
<li><a name="a2145"></a><span class="src-doc">     *</span></li>
<li><a name="a2146"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string</span><span class="src-doc">|</span><span class="src-doc-type">int</span><span class="src-doc-var">$nativecode </span><span class="src-doc"> the error code returned by the DBMS</span></li>
<li><a name="a2147"></a><span class="src-doc">     *</span></li>
<li><a name="a2148"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the portable DB error code.  Return DB_ERROR if the</span></li>
<li><a name="a2149"></a><span class="src-doc">     *                current driver doesn't have a mapping for the</span></li>
<li><a name="a2150"></a><span class="src-doc">     *                $nativecode submitted.</span></li>
<li><a name="a2151"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::errorCode</span></li>
<li><a name="a2152"></a><span class="src-doc">     */</span></li>
<li><a name="a2153"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methoderrorCode">errorCode</a><span class="src-sym">(</span><span class="src-var">$nativecode</span><span class="src-sym">)</span></li>
<li><a name="a2154"></a>    <span class="src-sym">{</span></li>
<li><a name="a2155"></a><span class="src-comm">//        if (isset($this-&gt;errorcode_map[$nativecode])) {</span></li>
<li><a name="a2156"></a><span class="src-comm">//            return $this-&gt;errorcode_map[$nativecode];</span></li>
<li><a name="a2157"></a><span class="src-comm">//        }</span></li>
<li><a name="a2158"></a>        <span class="src-comm">// Fall back to DB_ERROR if there was no mapping.</span></li>
<li><a name="a2159"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR">DB_ERROR</a></span><span class="src-sym">;</span></li>
<li><a name="a2160"></a>    <span class="src-sym">}</span></li>
<li><a name="a2161"></a>&nbsp;</li>
<li><a name="a2162"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2163"></a><span class="src-doc">     * Maps a DB error code to a textual message</span></li>
<li><a name="a2164"></a><span class="src-doc">     *</span></li>
<li><a name="a2165"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$dbcode </span><span class="src-doc"> the DB error code</span></li>
<li><a name="a2166"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the error message corresponding to the error code</span></li>
<li><a name="a2167"></a><span class="src-doc">     *                   submitted.  FALSE if the error code is unknown.</span></li>
<li><a name="a2168"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB::errorMessage()</span></li>
<li><a name="a2169"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::errorMessage</span></li>
<li><a name="a2170"></a><span class="src-doc">     */</span></li>
<li><a name="a2171"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methoderrorMessage">errorMessage</a><span class="src-sym">(</span><span class="src-var">$dbcode</span><span class="src-sym">)</span></li>
<li><a name="a2172"></a>    <span class="src-sym">{</span></li>
<li><a name="a2173"></a><span class="src-comm">//        return DB::errorMessage($this-&gt;errorcode_map[$dbcode]);</span></li>
<li><a name="a2174"></a>    <span class="src-sym">}</span></li>
<li><a name="a2175"></a>&nbsp;</li>
<li><a name="a2176"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2177"></a><span class="src-doc">     * Returns information about a table or a result set</span></li>
<li><a name="a2178"></a><span class="src-doc">     *</span></li>
<li><a name="a2179"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">object</span><span class="src-doc">|</span><span class="src-doc-type">string</span><span class="src-doc"> </span><span class="src-doc-var">$result </span><span class="src-doc"> DB_result object from a query or a</span></li>
<li><a name="a2180"></a><span class="src-doc">     *                                 string containing the name of a table.</span></li>
<li><a name="a2181"></a><span class="src-doc">     *                                 While this also accepts a query result</span></li>
<li><a name="a2182"></a><span class="src-doc">     *                                 resource identifier, this behavior is</span></li>
<li><a name="a2183"></a><span class="src-doc">     *                                 deprecated.</span></li>
<li><a name="a2184"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc"> </span><span class="src-doc-var">$mode </span><span class="src-doc">  either unused or one of the tableInfo modes:</span></li>
<li><a name="a2185"></a><span class="src-doc">     *                      &lt;kbd&gt;DB_TABLEINFO_ORDERTABLE&lt;/kbd&gt;,</span></li>
<li><a name="a2186"></a><span class="src-doc">     *                      &lt;kbd&gt;DB_TABLEINFO_ORDER&lt;/kbd&gt; or</span></li>
<li><a name="a2187"></a><span class="src-doc">     *                      &lt;kbd&gt;DB_TABLEINFO_FULL&lt;/kbd&gt; (which does both).</span></li>
<li><a name="a2188"></a><span class="src-doc">     *                      These are bitwise, so the first two can be</span></li>
<li><a name="a2189"></a><span class="src-doc">     *                      combined using &lt;kbd&gt;|&lt;/kbd&gt;.</span></li>
<li><a name="a2190"></a><span class="src-doc">     *</span></li>
<li><a name="a2191"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> an associative array with the information requested.</span></li>
<li><a name="a2192"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a2193"></a><span class="src-doc">     *</span></li>
<li><a name="a2194"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption()</span></li>
<li><a name="a2195"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::tableInfo</span></li>
<li><a name="a2196"></a><span class="src-doc">     */</span></li>
<li><a name="a2197"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodtableInfo">tableInfo</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2198"></a>    <span class="src-sym">{</span></li>
<li><a name="a2199"></a>        <span class="src-comm">/*</span></li>
<li><a name="a2200"></a><span class="src-comm">         * If the DB_&lt;driver&gt; class has a tableInfo() method, that one</span></li>
<li><a name="a2201"></a><span class="src-comm">         * overrides this one.  But, if the driver doesn't have one,</span></li>
<li><a name="a2202"></a><span class="src-comm">         * this method runs and tells users about that fact.</span></li>
<li><a name="a2203"></a><span class="src-comm">         */</span></li>
<li><a name="a2204"></a>        <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#methodraiseError">raiseError</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_ERROR_NOT_CAPABLE">DB_ERROR_NOT_CAPABLE</a></span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a2205"></a>    <span class="src-sym">}</span></li>
<li><a name="a2206"></a>&nbsp;</li>
<li><a name="a2207"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2208"></a><span class="src-doc">     * Lists internal database information</span></li>
<li><a name="a2209"></a><span class="src-doc">     *</span></li>
<li><a name="a2210"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$type </span><span class="src-doc"> type of information being sought.</span></li>
<li><a name="a2211"></a><span class="src-doc">     *                        Common items being sought are:</span></li>
<li><a name="a2212"></a><span class="src-doc">     *                        tables, databases, users, views, functions</span></li>
<li><a name="a2213"></a><span class="src-doc">     *                        Each DBMS's has its own capabilities.</span></li>
<li><a name="a2214"></a><span class="src-doc">     *</span></li>
<li><a name="a2215"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> an array listing the items sought.</span></li>
<li><a name="a2216"></a><span class="src-doc">     *                  A DB DB_Error object on failure.</span></li>
<li><a name="a2217"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getListOf</span></li>
<li><a name="a2218"></a><span class="src-doc">     */</span></li>
<li><a name="a2219"></a>    <span class="src-key">public </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodgetListOf">getListOf</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">)</span></li>
<li><a name="a2220"></a>    <span class="src-sym">{</span></li>
<li><a name="a2221"></a><span class="src-comm">//        $sql = $this-&gt;getSpecialQuery($type);</span></li>
<li><a name="a2222"></a><span class="src-comm">//        if ($sql === null) {</span></li>
<li><a name="a2223"></a><span class="src-comm">//            $this-&gt;last_query = '';</span></li>
<li><a name="a2224"></a><span class="src-comm">//            return $this-&gt;raiseError(DB_ERROR_UNSUPPORTED);</span></li>
<li><a name="a2225"></a><span class="src-comm">//        } elseif (is_int($sql) || DB::isError($sql)) {</span></li>
<li><a name="a2226"></a><span class="src-comm">//            // Previous error</span></li>
<li><a name="a2227"></a><span class="src-comm">//            return $this-&gt;raiseError($sql);</span></li>
<li><a name="a2228"></a><span class="src-comm">//        } elseif (is_array($sql)) {</span></li>
<li><a name="a2229"></a><span class="src-comm">//            // Already the result</span></li>
<li><a name="a2230"></a><span class="src-comm">//            return $sql;</span></li>
<li><a name="a2231"></a><span class="src-comm">//        }</span></li>
<li><a name="a2232"></a><span class="src-comm">//        // Launch this query</span></li>
<li><a name="a2233"></a><span class="src-comm">//        return $this-&gt;getCol($sql);</span></li>
<li><a name="a2234"></a>    <span class="src-sym">}</span></li>
<li><a name="a2235"></a>&nbsp;</li>
<li><a name="a2236"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2237"></a><span class="src-doc">     * Obtains the query string needed for listing a given type of objects</span></li>
<li><a name="a2238"></a><span class="src-doc">     *</span></li>
<li><a name="a2239"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$type </span><span class="src-doc"> the kind of objects you want to retrieve</span></li>
<li><a name="a2240"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the SQL query string or null if the driver doesn't</span></li>
<li><a name="a2241"></a><span class="src-doc">     *                   support the object type requested</span></li>
<li><a name="a2242"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::getListOf()</span></li>
<li><a name="a2243"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_common::getSpecialQuery</span></li>
<li><a name="a2244"></a><span class="src-doc">     */</span></li>
<li><a name="a2245"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#methodgetSpecialQuery">getSpecialQuery</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">)</span></li>
<li><a name="a2246"></a>    <span class="src-sym">{</span></li>
<li><a name="a2247"></a><span class="src-comm">//        return $this-&gt;raiseError(DB_ERROR_UNSUPPORTED);</span></li>
<li><a name="a2248"></a>    <span class="src-sym">}</span></li>
<li><a name="a2249"></a>&nbsp;</li>
<li><a name="a2250"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2251"></a><span class="src-doc">     * Right-trims all strings in an array</span></li>
<li><a name="a2252"></a><span class="src-doc">     *</span></li>
<li><a name="a2253"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$array </span><span class="src-doc"> the array to be trimmed (passed by reference)</span></li>
<li><a name="a2254"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2255"></a><span class="src-doc">     */</span></li>
<li><a name="a2256"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#method_rtrimArrayValues">_rtrimArrayValues</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$array</span><span class="src-sym">)</span></li>
<li><a name="a2257"></a>    <span class="src-sym">{</span></li>
<li><a name="a2258"></a>        <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$array </span><span class="src-key">as </span><span class="src-var">$key </span>=&gt; <span class="src-var">$value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a2259"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a2260"></a>                <span class="src-var">$array</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">] </span>= <a href="http://www.php.net/rtrim">rtrim</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a2261"></a>            <span class="src-sym">}</span></li>
<li><a name="a2262"></a>        <span class="src-sym">}</span></li>
<li><a name="a2263"></a>    <span class="src-sym">}</span></li>
<li><a name="a2264"></a>&nbsp;</li>
<li><a name="a2265"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2266"></a><span class="src-doc">     * Converts all null values in an array to empty strings</span></li>
<li><a name="a2267"></a><span class="src-doc">     *</span></li>
<li><a name="a2268"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> </span><span class="src-doc-var">$array </span><span class="src-doc"> the array to be de-nullified (passed by reference)</span></li>
<li><a name="a2269"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2270"></a><span class="src-doc">     */</span></li>
<li><a name="a2271"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_common.html#method_convertNullArrayValuesToEmpty">_convertNullArrayValuesToEmpty</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$array</span><span class="src-sym">)</span></li>
<li><a name="a2272"></a>    <span class="src-sym">{</span></li>
<li><a name="a2273"></a>        <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$array </span><span class="src-key">as </span><span class="src-var">$key </span>=&gt; <span class="src-var">$value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a2274"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a2275"></a>                <span class="src-var">$array</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">] </span>= <span class="src-str">''</span><span class="src-sym">;</span></li>
<li><a name="a2276"></a>            <span class="src-sym">}</span></li>
<li><a name="a2277"></a>        <span class="src-sym">}</span></li>
<li><a name="a2278"></a>    <span class="src-sym">}</span></li>
<li><a name="a2279"></a><span class="src-sym">}</span></li>
<li><a name="a2280"></a>&nbsp;</li>
<li><a name="a2281"></a><span class="src-doc">/**</span></li>
<li><a name="a2282"></a><span class="src-doc"> *  Mock DB_Error</span></li>
<li><a name="a2283"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_Error class</span></li>
<li><a name="a2284"></a><span class="src-doc"> */</span></li>
<li><a name="a2285"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB_Error.html">DB_Error</a> <span class="src-key">extends </span><span class="src-id">PEAR_Error</span></li>
<li><a name="a2286"></a><span class="src-sym">{</span></li>
<li><a name="a2287"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2288"></a><span class="src-doc">     * DB_Error constructor</span></li>
<li><a name="a2289"></a><span class="src-doc">     *</span></li>
<li><a name="a2290"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$code </span><span class="src-doc">      DB error code, or string with error message</span></li>
<li><a name="a2291"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">  </span><span class="src-doc-var">$mode </span><span class="src-doc">      what &quot;error mode&quot; to operate in</span></li>
<li><a name="a2292"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">  </span><span class="src-doc-var">$level </span><span class="src-doc">     what error level to use for $mode &amp;</span></li>
<li><a name="a2293"></a><span class="src-doc">     *                            PEAR_ERROR_TRIGGER</span></li>
<li><a name="a2294"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$debuginfo </span><span class="src-doc"> additional debug info, such as the last query</span></li>
<li><a name="a2295"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> PEAR_Error</span></li>
<li><a name="a2296"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement DB_Error::constructor</span></li>
<li><a name="a2297"></a><span class="src-doc">     */</span></li>
<li><a name="a2298"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_Error.html#methodDB_Error">DB_Error</a><span class="src-sym">(</span><span class="src-var">$code </span>= <span class="src-id">DB_ERROR</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">PEAR_ERROR_RETURN</span><span class="src-sym">,</span></li>
<li><a name="a2299"></a>                      <span class="src-var">$level </span>= <span class="src-id">E_USER_NOTICE</span><span class="src-sym">, </span><span class="src-var">$debuginfo </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2300"></a>    <span class="src-sym">{</span></li>
<li><a name="a2301"></a><span class="src-comm">//        if (is_int($code)) {</span></li>
<li><a name="a2302"></a><span class="src-comm">//            $this-&gt;PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,</span></li>
<li><a name="a2303"></a><span class="src-comm">//                              $mode, $level, $debuginfo);</span></li>
<li><a name="a2304"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2305"></a><span class="src-comm">//            $this-&gt;PEAR_Error(&quot;DB Error: $code&quot;, DB_ERROR,</span></li>
<li><a name="a2306"></a><span class="src-comm">//                              $mode, $level, $debuginfo);</span></li>
<li><a name="a2307"></a><span class="src-comm">//        }</span></li>
<li><a name="a2308"></a>    <span class="src-sym">}</span></li>
<li><a name="a2309"></a><span class="src-sym">}</span></li>
<li><a name="a2310"></a>&nbsp;</li>
<li><a name="a2311"></a><span class="src-doc">/**</span></li>
<li><a name="a2312"></a><span class="src-doc"> *  Mock DB_result</span></li>
<li><a name="a2313"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result</span></li>
<li><a name="a2314"></a><span class="src-doc"> */</span></li>
<li><a name="a2315"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB_result.html">DB_result</a></li>
<li><a name="a2316"></a><span class="src-sym">{</span></li>
<li><a name="a2317"></a>&nbsp;</li>
<li><a name="a2318"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2319"></a><span class="src-doc">     * This constructor sets the object's properties</span></li>
<li><a name="a2320"></a><span class="src-doc">     *</span></li>
<li><a name="a2321"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">object </span><span class="src-doc">  </span><span class="src-doc-var">&amp;$dbh </span><span class="src-doc">    the DB object reference</span></li>
<li><a name="a2322"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc">  the result resource id</span></li>
<li><a name="a2323"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc">   </span><span class="src-doc-var">$options </span><span class="src-doc"> an associative array with result options</span></li>
<li><a name="a2324"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2325"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::constructor</span></li>
<li><a name="a2326"></a><span class="src-doc">     */</span></li>
<li><a name="a2327"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodDB_result">DB_result</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$dbh</span><span class="src-sym">, </span><span class="src-var">$result</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a2328"></a>    <span class="src-sym">{</span></li>
<li><a name="a2329"></a>    <span class="src-sym">}</span></li>
<li><a name="a2330"></a>&nbsp;</li>
<li><a name="a2331"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2332"></a><span class="src-doc">     * Set options for the DB_result object</span></li>
<li><a name="a2333"></a><span class="src-doc">     *</span></li>
<li><a name="a2334"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$key </span><span class="src-doc">   the option to set</span></li>
<li><a name="a2335"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$value </span><span class="src-doc"> the value to set the option to</span></li>
<li><a name="a2336"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2337"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::setOption()</span></li>
<li><a name="a2338"></a><span class="src-doc">     */</span></li>
<li><a name="a2339"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodsetOption">setOption</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">, </span><span class="src-var">$value </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2340"></a>    <span class="src-sym">{</span></li>
<li><a name="a2341"></a>        <span class="src-key">switch </span><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a2342"></a>            <span class="src-key">case </span><span class="src-str">'limit_from'</span>:</li>
<li><a name="a2343"></a><span class="src-comm">//                $this-&gt;limit_from = $value;</span></li>
<li><a name="a2344"></a>                <span class="src-key">break</span><span class="src-sym">;</span></li>
<li><a name="a2345"></a>            <span class="src-key">case </span><span class="src-str">'limit_count'</span>:</li>
<li><a name="a2346"></a><span class="src-comm">//                $this-&gt;limit_count = $value;</span></li>
<li><a name="a2347"></a>        <span class="src-sym">}</span></li>
<li><a name="a2348"></a>    <span class="src-sym">}</span></li>
<li><a name="a2349"></a>&nbsp;</li>
<li><a name="a2350"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2351"></a><span class="src-doc">     * Fetch a row of data and return it by reference into an array</span></li>
<li><a name="a2352"></a><span class="src-doc">     *</span></li>
<li><a name="a2353"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$fetchmode </span><span class="src-doc"> the constant indicating how to format the data</span></li>
<li><a name="a2354"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$rownum </span><span class="src-doc">    the row number to fetch (index starts at 0)</span></li>
<li><a name="a2355"></a><span class="src-doc">     *</span></li>
<li><a name="a2356"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> an array or object containing the row's data,</span></li>
<li><a name="a2357"></a><span class="src-doc">     *                  NULL when the end of the result set is reached</span></li>
<li><a name="a2358"></a><span class="src-doc">     *                  or a DB_Error object on failure.</span></li>
<li><a name="a2359"></a><span class="src-doc">     *</span></li>
<li><a name="a2360"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption(), DB_common::setFetchMode()</span></li>
<li><a name="a2361"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::fetchRow()</span></li>
<li><a name="a2362"></a><span class="src-doc">     */</span></li>
<li><a name="a2363"></a>    <span class="src-key">function </span><span class="src-sym">&amp;</span><a href="../PHPonTraxTest/DB_result.html#methodfetchRow">fetchRow</a><span class="src-sym">(</span><span class="src-var">$fetchmode </span>= <span class="src-id">DB_FETCHMODE_DEFAULT</span><span class="src-sym">, </span><span class="src-var">$rownum </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2364"></a>    <span class="src-sym">{</span></li>
<li><a name="a2365"></a><span class="src-comm">//        if ($fetchmode === DB_FETCHMODE_DEFAULT) {</span></li>
<li><a name="a2366"></a><span class="src-comm">//            $fetchmode = $this-&gt;fetchmode;</span></li>
<li><a name="a2367"></a><span class="src-comm">//        }</span></li>
<li><a name="a2368"></a><span class="src-comm">//        if ($fetchmode === DB_FETCHMODE_OBJECT) {</span></li>
<li><a name="a2369"></a><span class="src-comm">//            $fetchmode = DB_FETCHMODE_ASSOC;</span></li>
<li><a name="a2370"></a><span class="src-comm">//            $object_class = $this-&gt;fetchmode_object_class;</span></li>
<li><a name="a2371"></a><span class="src-comm">//        }</span></li>
<li><a name="a2372"></a><span class="src-comm">//        if ($this-&gt;limit_from !== null) {</span></li>
<li><a name="a2373"></a><span class="src-comm">//            if ($this-&gt;row_counter === null) {</span></li>
<li><a name="a2374"></a><span class="src-comm">//                $this-&gt;row_counter = $this-&gt;limit_from;</span></li>
<li><a name="a2375"></a><span class="src-comm">//                // Skip rows</span></li>
<li><a name="a2376"></a><span class="src-comm">//                if ($this-&gt;dbh-&gt;features['limit'] === false) {</span></li>
<li><a name="a2377"></a><span class="src-comm">//                    $i = 0;</span></li>
<li><a name="a2378"></a><span class="src-comm">//                    while ($i++ &lt; $this-&gt;limit_from) {</span></li>
<li><a name="a2379"></a><span class="src-comm">//                        $this-&gt;dbh-&gt;fetchInto($this-&gt;result, $arr, $fetchmode);</span></li>
<li><a name="a2380"></a><span class="src-comm">//                    }</span></li>
<li><a name="a2381"></a><span class="src-comm">//                }</span></li>
<li><a name="a2382"></a><span class="src-comm">//            }</span></li>
<li><a name="a2383"></a><span class="src-comm">//            if ($this-&gt;row_counter &gt;= ($this-&gt;limit_from + $this-&gt;limit_count))</span></li>
<li><a name="a2384"></a><span class="src-comm">//            {</span></li>
<li><a name="a2385"></a><span class="src-comm">//                if ($this-&gt;autofree) {</span></li>
<li><a name="a2386"></a><span class="src-comm">//                    $this-&gt;free();</span></li>
<li><a name="a2387"></a><span class="src-comm">//                }</span></li>
<li><a name="a2388"></a><span class="src-comm">//                $tmp = null;</span></li>
<li><a name="a2389"></a><span class="src-comm">//                return $tmp;</span></li>
<li><a name="a2390"></a><span class="src-comm">//            }</span></li>
<li><a name="a2391"></a><span class="src-comm">//            if ($this-&gt;dbh-&gt;features['limit'] === 'emulate') {</span></li>
<li><a name="a2392"></a><span class="src-comm">//                $rownum = $this-&gt;row_counter;</span></li>
<li><a name="a2393"></a><span class="src-comm">//            }</span></li>
<li><a name="a2394"></a><span class="src-comm">//            $this-&gt;row_counter++;</span></li>
<li><a name="a2395"></a><span class="src-comm">//        }</span></li>
<li><a name="a2396"></a><span class="src-comm">//        $res = $this-&gt;dbh-&gt;fetchInto($this-&gt;result, $arr, $fetchmode, $rownum);</span></li>
<li><a name="a2397"></a><span class="src-comm">//        if ($res === DB_OK) {</span></li>
<li><a name="a2398"></a><span class="src-comm">//            if (isset($object_class)) {</span></li>
<li><a name="a2399"></a><span class="src-comm">//                // The default mode is specified in the</span></li>
<li><a name="a2400"></a><span class="src-comm">//                // DB_common::fetchmode_object_class property</span></li>
<li><a name="a2401"></a><span class="src-comm">//                if ($object_class == 'stdClass') {</span></li>
<li><a name="a2402"></a><span class="src-comm">//                    $arr = (object) $arr;</span></li>
<li><a name="a2403"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a2404"></a><span class="src-comm">//                    $arr = &amp;new $object_class($arr);</span></li>
<li><a name="a2405"></a><span class="src-comm">//                }</span></li>
<li><a name="a2406"></a><span class="src-comm">//            }</span></li>
<li><a name="a2407"></a><span class="src-comm">//            return $arr;</span></li>
<li><a name="a2408"></a><span class="src-comm">//        }</span></li>
<li><a name="a2409"></a><span class="src-comm">//        if ($res == null &amp;&amp; $this-&gt;autofree) {</span></li>
<li><a name="a2410"></a><span class="src-comm">//            $this-&gt;free();</span></li>
<li><a name="a2411"></a><span class="src-comm">//        }</span></li>
<li><a name="a2412"></a><span class="src-comm">//        return $res;</span></li>
<li><a name="a2413"></a>    <span class="src-sym">}</span></li>
<li><a name="a2414"></a>&nbsp;</li>
<li><a name="a2415"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2416"></a><span class="src-doc">     * Fetch a row of data into an array which is passed by reference</span></li>
<li><a name="a2417"></a><span class="src-doc">     *</span></li>
<li><a name="a2418"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">&amp;$arr </span><span class="src-doc">      the variable where the data should be placed</span></li>
<li><a name="a2419"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">  </span><span class="src-doc-var">$fetchmode </span><span class="src-doc"> the constant indicating how to format the data</span></li>
<li><a name="a2420"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">  </span><span class="src-doc-var">$rownum </span><span class="src-doc">    the row number to fetch (index starts at 0)</span></li>
<li><a name="a2421"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> DB_OK if a row is processed, NULL when the end of the</span></li>
<li><a name="a2422"></a><span class="src-doc">     *                  result set is reached or a DB_Error object on failure</span></li>
<li><a name="a2423"></a><span class="src-doc">     *</span></li>
<li><a name="a2424"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption(), DB_common::setFetchMode()</span></li>
<li><a name="a2425"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::fetchInto()</span></li>
<li><a name="a2426"></a><span class="src-doc">     */</span></li>
<li><a name="a2427"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodfetchInto">fetchInto</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$arr</span><span class="src-sym">, </span><span class="src-var">$fetchmode </span>= <span class="src-id">DB_FETCHMODE_DEFAULT</span><span class="src-sym">, </span><span class="src-var">$rownum </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2428"></a>    <span class="src-sym">{</span></li>
<li><a name="a2429"></a><span class="src-comm">//        if ($fetchmode === DB_FETCHMODE_DEFAULT) {</span></li>
<li><a name="a2430"></a><span class="src-comm">//            $fetchmode = $this-&gt;fetchmode;</span></li>
<li><a name="a2431"></a><span class="src-comm">//        }</span></li>
<li><a name="a2432"></a><span class="src-comm">//        if ($fetchmode === DB_FETCHMODE_OBJECT) {</span></li>
<li><a name="a2433"></a><span class="src-comm">//            $fetchmode = DB_FETCHMODE_ASSOC;</span></li>
<li><a name="a2434"></a><span class="src-comm">//            $object_class = $this-&gt;fetchmode_object_class;</span></li>
<li><a name="a2435"></a><span class="src-comm">//        }</span></li>
<li><a name="a2436"></a><span class="src-comm">//        if ($this-&gt;limit_from !== null) {</span></li>
<li><a name="a2437"></a><span class="src-comm">//            if ($this-&gt;row_counter === null) {</span></li>
<li><a name="a2438"></a><span class="src-comm">//                $this-&gt;row_counter = $this-&gt;limit_from;</span></li>
<li><a name="a2439"></a><span class="src-comm">//                // Skip rows</span></li>
<li><a name="a2440"></a><span class="src-comm">//                if ($this-&gt;dbh-&gt;features['limit'] === false) {</span></li>
<li><a name="a2441"></a><span class="src-comm">//                    $i = 0;</span></li>
<li><a name="a2442"></a><span class="src-comm">//                    while ($i++ &lt; $this-&gt;limit_from) {</span></li>
<li><a name="a2443"></a><span class="src-comm">//                        $this-&gt;dbh-&gt;fetchInto($this-&gt;result, $arr, $fetchmode);</span></li>
<li><a name="a2444"></a><span class="src-comm">//                    }</span></li>
<li><a name="a2445"></a><span class="src-comm">//                }</span></li>
<li><a name="a2446"></a><span class="src-comm">//            }</span></li>
<li><a name="a2447"></a><span class="src-comm">//            if ($this-&gt;row_counter &gt;= (</span></li>
<li><a name="a2448"></a><span class="src-comm">//                    $this-&gt;limit_from + $this-&gt;limit_count))</span></li>
<li><a name="a2449"></a><span class="src-comm">//            {</span></li>
<li><a name="a2450"></a><span class="src-comm">//                if ($this-&gt;autofree) {</span></li>
<li><a name="a2451"></a><span class="src-comm">//                    $this-&gt;free();</span></li>
<li><a name="a2452"></a><span class="src-comm">//                }</span></li>
<li><a name="a2453"></a><span class="src-comm">//                return null;</span></li>
<li><a name="a2454"></a><span class="src-comm">//            }</span></li>
<li><a name="a2455"></a><span class="src-comm">//            if ($this-&gt;dbh-&gt;features['limit'] === 'emulate') {</span></li>
<li><a name="a2456"></a><span class="src-comm">//                $rownum = $this-&gt;row_counter;</span></li>
<li><a name="a2457"></a><span class="src-comm">//            }</span></li>
<li><a name="a2458"></a><span class="src-comm">//</span></li>
<li><a name="a2459"></a><span class="src-comm">//            $this-&gt;row_counter++;</span></li>
<li><a name="a2460"></a><span class="src-comm">//        }</span></li>
<li><a name="a2461"></a><span class="src-comm">//        $res = $this-&gt;dbh-&gt;fetchInto($this-&gt;result, $arr, $fetchmode, $rownum);</span></li>
<li><a name="a2462"></a><span class="src-comm">//        if ($res === DB_OK) {</span></li>
<li><a name="a2463"></a><span class="src-comm">//            if (isset($object_class)) {</span></li>
<li><a name="a2464"></a><span class="src-comm">//                // default mode specified in the</span></li>
<li><a name="a2465"></a><span class="src-comm">//                // DB_common::fetchmode_object_class property</span></li>
<li><a name="a2466"></a><span class="src-comm">//                if ($object_class == 'stdClass') {</span></li>
<li><a name="a2467"></a><span class="src-comm">//                    $arr = (object) $arr;</span></li>
<li><a name="a2468"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a2469"></a><span class="src-comm">//                    $arr = new $object_class($arr);</span></li>
<li><a name="a2470"></a><span class="src-comm">//                }</span></li>
<li><a name="a2471"></a><span class="src-comm">//            }</span></li>
<li><a name="a2472"></a><span class="src-comm">//            return DB_OK;</span></li>
<li><a name="a2473"></a><span class="src-comm">//        }</span></li>
<li><a name="a2474"></a><span class="src-comm">//        if ($res == null &amp;&amp; $this-&gt;autofree) {</span></li>
<li><a name="a2475"></a><span class="src-comm">//            $this-&gt;free();</span></li>
<li><a name="a2476"></a><span class="src-comm">//        }</span></li>
<li><a name="a2477"></a><span class="src-comm">//        return $res;</span></li>
<li><a name="a2478"></a>    <span class="src-sym">}</span></li>
<li><a name="a2479"></a>&nbsp;</li>
<li><a name="a2480"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2481"></a><span class="src-doc">     * Get the the number of columns in a result set</span></li>
<li><a name="a2482"></a><span class="src-doc">     *</span></li>
<li><a name="a2483"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of columns.  A DB_Error object on failure.</span></li>
<li><a name="a2484"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::numCols()</span></li>
<li><a name="a2485"></a><span class="src-doc">     */</span></li>
<li><a name="a2486"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodnumCols">numCols</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2487"></a>    <span class="src-sym">{</span></li>
<li><a name="a2488"></a><span class="src-comm">//        return $this-&gt;dbh-&gt;numCols($this-&gt;result);</span></li>
<li><a name="a2489"></a>    <span class="src-sym">}</span></li>
<li><a name="a2490"></a>&nbsp;</li>
<li><a name="a2491"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2492"></a><span class="src-doc">     * Get the number of rows in a result set</span></li>
<li><a name="a2493"></a><span class="src-doc">     *</span></li>
<li><a name="a2494"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of rows.  A DB_Error object on failure.</span></li>
<li><a name="a2495"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::numRows()</span></li>
<li><a name="a2496"></a><span class="src-doc">     */</span></li>
<li><a name="a2497"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodnumRows">numRows</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2498"></a>    <span class="src-sym">{</span></li>
<li><a name="a2499"></a><span class="src-comm">//        if ($this-&gt;dbh-&gt;features['numrows'] === 'emulate'</span></li>
<li><a name="a2500"></a><span class="src-comm">//            &amp;&amp; $this-&gt;dbh-&gt;options['portability'] &amp; DB_PORTABILITY_NUMROWS)</span></li>
<li><a name="a2501"></a><span class="src-comm">//        {</span></li>
<li><a name="a2502"></a><span class="src-comm">//            if ($this-&gt;dbh-&gt;features['prepare']) {</span></li>
<li><a name="a2503"></a><span class="src-comm">//                $res = $this-&gt;dbh-&gt;query($this-&gt;query, $this-&gt;parameters);</span></li>
<li><a name="a2504"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a2505"></a><span class="src-comm">//                $res = $this-&gt;dbh-&gt;query($this-&gt;query);</span></li>
<li><a name="a2506"></a><span class="src-comm">//            }</span></li>
<li><a name="a2507"></a><span class="src-comm">//            if (DB::isError($res)) {</span></li>
<li><a name="a2508"></a><span class="src-comm">//                return $res;</span></li>
<li><a name="a2509"></a><span class="src-comm">//            }</span></li>
<li><a name="a2510"></a><span class="src-comm">//            $i = 0;</span></li>
<li><a name="a2511"></a><span class="src-comm">//            while ($res-&gt;fetchInto($tmp, DB_FETCHMODE_ORDERED)) {</span></li>
<li><a name="a2512"></a><span class="src-comm">//                $i++;</span></li>
<li><a name="a2513"></a><span class="src-comm">//            }</span></li>
<li><a name="a2514"></a><span class="src-comm">//            return $i;</span></li>
<li><a name="a2515"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2516"></a><span class="src-comm">//            return $this-&gt;dbh-&gt;numRows($this-&gt;result);</span></li>
<li><a name="a2517"></a><span class="src-comm">//        }</span></li>
<li><a name="a2518"></a>    <span class="src-sym">}</span></li>
<li><a name="a2519"></a>&nbsp;</li>
<li><a name="a2520"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2521"></a><span class="src-doc">     * Get the next result if a batch of queries was executed</span></li>
<li><a name="a2522"></a><span class="src-doc">     *</span></li>
<li><a name="a2523"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> true if a new result is available or false if not</span></li>
<li><a name="a2524"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::nextResult()</span></li>
<li><a name="a2525"></a><span class="src-doc">     */</span></li>
<li><a name="a2526"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodnextResult">nextResult</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2527"></a>    <span class="src-sym">{</span></li>
<li><a name="a2528"></a><span class="src-comm">//        return $this-&gt;dbh-&gt;nextResult($this-&gt;result);</span></li>
<li><a name="a2529"></a>    <span class="src-sym">}</span></li>
<li><a name="a2530"></a>&nbsp;</li>
<li><a name="a2531"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2532"></a><span class="src-doc">     * Frees the resources allocated for this result set</span></li>
<li><a name="a2533"></a><span class="src-doc">     *</span></li>
<li><a name="a2534"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> true on success.  A DB_Error object on failure.</span></li>
<li><a name="a2535"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::free()</span></li>
<li><a name="a2536"></a><span class="src-doc">     */</span></li>
<li><a name="a2537"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodfree">free</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2538"></a>    <span class="src-sym">{</span></li>
<li><a name="a2539"></a><span class="src-comm">//        $err = $this-&gt;dbh-&gt;freeResult($this-&gt;result);</span></li>
<li><a name="a2540"></a><span class="src-comm">//        if (DB::isError($err)) {</span></li>
<li><a name="a2541"></a><span class="src-comm">//            return $err;</span></li>
<li><a name="a2542"></a><span class="src-comm">//        }</span></li>
<li><a name="a2543"></a><span class="src-comm">//        $this-&gt;result = false;</span></li>
<li><a name="a2544"></a><span class="src-comm">//        $this-&gt;statement = false;</span></li>
<li><a name="a2545"></a><span class="src-comm">//        return true;</span></li>
<li><a name="a2546"></a>    <span class="src-sym">}</span></li>
<li><a name="a2547"></a>&nbsp;</li>
<li><a name="a2548"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2549"></a><span class="src-doc">     * Determine the query string that created this result</span></li>
<li><a name="a2550"></a><span class="src-doc">     *</span></li>
<li><a name="a2551"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the query string</span></li>
<li><a name="a2552"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::getQuery()</span></li>
<li><a name="a2553"></a><span class="src-doc">     */</span></li>
<li><a name="a2554"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodgetQuery">getQuery</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2555"></a>    <span class="src-sym">{</span></li>
<li><a name="a2556"></a><span class="src-comm">//        return $this-&gt;query;</span></li>
<li><a name="a2557"></a>    <span class="src-sym">}</span></li>
<li><a name="a2558"></a>&nbsp;</li>
<li><a name="a2559"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2560"></a><span class="src-doc">     * Tells which row number is currently being processed</span></li>
<li><a name="a2561"></a><span class="src-doc">     *</span></li>
<li><a name="a2562"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">integer </span><span class="src-doc"> the current row being looked at.  Starts at 1.</span></li>
<li><a name="a2563"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_result::getRowCounter()</span></li>
<li><a name="a2564"></a><span class="src-doc">     */</span></li>
<li><a name="a2565"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_result.html#methodgetRowCounter">getRowCounter</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2566"></a>    <span class="src-sym">{</span></li>
<li><a name="a2567"></a><span class="src-comm">//        return $this-&gt;row_counter;</span></li>
<li><a name="a2568"></a>    <span class="src-sym">}</span></li>
<li><a name="a2569"></a><span class="src-sym">}</span></li>
<li><a name="a2570"></a>&nbsp;</li>
<li><a name="a2571"></a><span class="src-doc">/**</span></li>
<li><a name="a2572"></a><span class="src-doc"> *  Mock DB_row</span></li>
<li><a name="a2573"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_row</span></li>
<li><a name="a2574"></a><span class="src-doc"> */</span></li>
<li><a name="a2575"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB_row.html">DB_row</a></li>
<li><a name="a2576"></a><span class="src-sym">{</span></li>
<li><a name="a2577"></a>&nbsp;</li>
<li><a name="a2578"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2579"></a><span class="src-doc">     * The constructor places a row's data into properties of this object</span></li>
<li><a name="a2580"></a><span class="src-doc">     *</span></li>
<li><a name="a2581"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc"> the array containing the row's data</span></li>
<li><a name="a2582"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2583"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_row constructor</span></li>
<li><a name="a2584"></a><span class="src-doc">     */</span></li>
<li><a name="a2585"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_row.html#methodDB_row">DB_row</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$arr</span><span class="src-sym">)</span></li>
<li><a name="a2586"></a>    <span class="src-sym">{</span></li>
<li><a name="a2587"></a><span class="src-comm">//        foreach ($arr as $key =&gt; $value) {</span></li>
<li><a name="a2588"></a><span class="src-comm">//            $this-&gt;$key = &amp;$arr[$key];</span></li>
<li><a name="a2589"></a><span class="src-comm">//      }</span></li>
<li><a name="a2590"></a>    <span class="src-sym">}</span></li>
<li><a name="a2591"></a><span class="src-sym">}</span></li>
<li><a name="a2592"></a>&nbsp;</li>
<li><a name="a2593"></a><span class="src-doc">/**</span></li>
<li><a name="a2594"></a><span class="src-doc"> *  Mock DB_mysql class</span></li>
<li><a name="a2595"></a><span class="src-doc"> */</span></li>
<li><a name="a2596"></a><span class="src-key">class </span><a href="../PHPonTraxTest/DB_mysql.html">DB_mysql</a> <span class="src-key">extends </span><a href="../PHPonTraxTest/DB_common.html#methodDB_common">DB_common</a></li>
<li><a name="a2597"></a><span class="src-sym">{</span></li>
<li><a name="a2598"></a>&nbsp;</li>
<li><a name="a2599"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2600"></a><span class="src-doc">     * This constructor calls &lt;kbd&gt;$this-&gt;DB_common()&lt;/kbd&gt;</span></li>
<li><a name="a2601"></a><span class="src-doc">     *</span></li>
<li><a name="a2602"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">void </span></li>
<li><a name="a2603"></a><span class="src-doc">     */</span></li>
<li><a name="a2604"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodDB_mysql">DB_mysql</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2605"></a>    <span class="src-sym">{</span></li>
<li><a name="a2606"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTraxTest/DB_common.html#methodDB_common">DB_common</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a2607"></a>    <span class="src-sym">}</span></li>
<li><a name="a2608"></a>&nbsp;</li>
<li><a name="a2609"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2610"></a><span class="src-doc">     * Connect to the database server, log in and open the database</span></li>
<li><a name="a2611"></a><span class="src-doc">     *</span></li>
<li><a name="a2612"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$dsn </span><span class="src-doc">        the data source name</span></li>
<li><a name="a2613"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc"> </span><span class="src-doc-var">$persistent </span><span class="src-doc"> should the connection be persistent?</span></li>
<li><a name="a2614"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success. A DB_Error object on failure.</span></li>
<li><a name="a2615"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::connect()</span></li>
<li><a name="a2616"></a><span class="src-doc">     */</span></li>
<li><a name="a2617"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodconnect">connect</a><span class="src-sym">(</span><span class="src-var">$dsn</span><span class="src-sym">, </span><span class="src-var">$persistent </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a2618"></a>    <span class="src-sym">{</span></li>
<li><a name="a2619"></a><span class="src-comm">//        if (!PEAR::loadExtension('mysql')) {</span></li>
<li><a name="a2620"></a><span class="src-comm">//            return $this-&gt;raiseError(DB_ERROR_EXTENSION_NOT_FOUND);</span></li>
<li><a name="a2621"></a><span class="src-comm">//        }</span></li>
<li><a name="a2622"></a><span class="src-comm">//</span></li>
<li><a name="a2623"></a><span class="src-comm">//        $this-&gt;dsn = $dsn;</span></li>
<li><a name="a2624"></a><span class="src-comm">//        if ($dsn['dbsyntax']) {</span></li>
<li><a name="a2625"></a><span class="src-comm">//            $this-&gt;dbsyntax = $dsn['dbsyntax'];</span></li>
<li><a name="a2626"></a><span class="src-comm">//        }</span></li>
<li><a name="a2627"></a><span class="src-comm">//</span></li>
<li><a name="a2628"></a><span class="src-comm">//        $params = array();</span></li>
<li><a name="a2629"></a><span class="src-comm">//        if ($dsn['protocol'] &amp;&amp; $dsn['protocol'] == 'unix') {</span></li>
<li><a name="a2630"></a><span class="src-comm">//            $params[0] = ':' . $dsn['socket'];</span></li>
<li><a name="a2631"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2632"></a><span class="src-comm">//            $params[0] = $dsn['hostspec'] ? $dsn['hostspec']</span></li>
<li><a name="a2633"></a><span class="src-comm">//                         : 'localhost';</span></li>
<li><a name="a2634"></a><span class="src-comm">//            if ($dsn['port']) {</span></li>
<li><a name="a2635"></a><span class="src-comm">//                $params[0] .= ':' . $dsn['port'];</span></li>
<li><a name="a2636"></a><span class="src-comm">//            }</span></li>
<li><a name="a2637"></a><span class="src-comm">//        }</span></li>
<li><a name="a2638"></a><span class="src-comm">//        $params[] = $dsn['username'] ? $dsn['username'] : null;</span></li>
<li><a name="a2639"></a><span class="src-comm">//        $params[] = $dsn['password'] ? $dsn['password'] : null;</span></li>
<li><a name="a2640"></a><span class="src-comm">//</span></li>
<li><a name="a2641"></a><span class="src-comm">//        if (!$persistent) {</span></li>
<li><a name="a2642"></a><span class="src-comm">//            if (isset($dsn['new_link'])</span></li>
<li><a name="a2643"></a><span class="src-comm">//                &amp;&amp; ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))</span></li>
<li><a name="a2644"></a><span class="src-comm">//            {</span></li>
<li><a name="a2645"></a><span class="src-comm">//                $params[] = true;</span></li>
<li><a name="a2646"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a2647"></a><span class="src-comm">//                $params[] = false;</span></li>
<li><a name="a2648"></a><span class="src-comm">//            }</span></li>
<li><a name="a2649"></a><span class="src-comm">//        }</span></li>
<li><a name="a2650"></a><span class="src-comm">//        if (version_compare(phpversion(), '4.3.0', '&gt;=')) {</span></li>
<li><a name="a2651"></a><span class="src-comm">//            $params[] = isset($dsn['client_flags'])</span></li>
<li><a name="a2652"></a><span class="src-comm">//                        ? $dsn['client_flags'] : null;</span></li>
<li><a name="a2653"></a><span class="src-comm">//        }</span></li>
<li><a name="a2654"></a><span class="src-comm">//</span></li>
<li><a name="a2655"></a><span class="src-comm">//        $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';</span></li>
<li><a name="a2656"></a><span class="src-comm">//</span></li>
<li><a name="a2657"></a><span class="src-comm">//        $ini = ini_get('track_errors');</span></li>
<li><a name="a2658"></a><span class="src-comm">//        $php_errormsg = '';</span></li>
<li><a name="a2659"></a><span class="src-comm">//        if ($ini) {</span></li>
<li><a name="a2660"></a><span class="src-comm">//            $this-&gt;connection = @call_user_func_array($connect_function,</span></li>
<li><a name="a2661"></a><span class="src-comm">//                                                      $params);</span></li>
<li><a name="a2662"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2663"></a><span class="src-comm">//            ini_set('track_errors', 1);</span></li>
<li><a name="a2664"></a><span class="src-comm">//            $this-&gt;connection = @call_user_func_array($connect_function,</span></li>
<li><a name="a2665"></a><span class="src-comm">//                                                      $params);</span></li>
<li><a name="a2666"></a><span class="src-comm">//            ini_set('track_errors', $ini);</span></li>
<li><a name="a2667"></a><span class="src-comm">//        }</span></li>
<li><a name="a2668"></a><span class="src-comm">//</span></li>
<li><a name="a2669"></a><span class="src-comm">//        if (!$this-&gt;connection) {</span></li>
<li><a name="a2670"></a><span class="src-comm">//            if (($err = @mysql_error()) != '') {</span></li>
<li><a name="a2671"></a><span class="src-comm">//                return $this-&gt;raiseError(DB_ERROR_CONNECT_FAILED,</span></li>
<li><a name="a2672"></a><span class="src-comm">//                                         null, null, null, </span></li>
<li><a name="a2673"></a><span class="src-comm">//                                         $err);</span></li>
<li><a name="a2674"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a2675"></a><span class="src-comm">//                return $this-&gt;raiseError(DB_ERROR_CONNECT_FAILED,</span></li>
<li><a name="a2676"></a><span class="src-comm">//                                         null, null, null,</span></li>
<li><a name="a2677"></a><span class="src-comm">//                                         $php_errormsg);</span></li>
<li><a name="a2678"></a><span class="src-comm">//            }</span></li>
<li><a name="a2679"></a><span class="src-comm">//        }</span></li>
<li><a name="a2680"></a><span class="src-comm">//</span></li>
<li><a name="a2681"></a><span class="src-comm">//        if ($dsn['database']) {</span></li>
<li><a name="a2682"></a><span class="src-comm">//            if (!@mysql_select_db($dsn['database'], $this-&gt;connection)) {</span></li>
<li><a name="a2683"></a><span class="src-comm">//                return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2684"></a><span class="src-comm">//            }</span></li>
<li><a name="a2685"></a><span class="src-comm">//            $this-&gt;_db = $dsn['database'];</span></li>
<li><a name="a2686"></a><span class="src-comm">//        }</span></li>
<li><a name="a2687"></a><span class="src-comm">//</span></li>
<li><a name="a2688"></a><span class="src-comm">//        return DB_OK;</span></li>
<li><a name="a2689"></a>    <span class="src-sym">}</span></li>
<li><a name="a2690"></a>&nbsp;</li>
<li><a name="a2691"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2692"></a><span class="src-doc">     * Disconnects from the database server</span></li>
<li><a name="a2693"></a><span class="src-doc">     *</span></li>
<li><a name="a2694"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> TRUE on success, FALSE on failure</span></li>
<li><a name="a2695"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::disconnect()</span></li>
<li><a name="a2696"></a><span class="src-doc">     */</span></li>
<li><a name="a2697"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methoddisconnect">disconnect</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2698"></a>    <span class="src-sym">{</span></li>
<li><a name="a2699"></a><span class="src-comm">//        $ret = @mysql_close($this-&gt;connection);</span></li>
<li><a name="a2700"></a><span class="src-comm">//        $this-&gt;connection = null;</span></li>
<li><a name="a2701"></a><span class="src-comm">//        return $ret;</span></li>
<li><a name="a2702"></a>    <span class="src-sym">}</span></li>
<li><a name="a2703"></a>&nbsp;</li>
<li><a name="a2704"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2705"></a><span class="src-doc">     * Sends a query to the database server</span></li>
<li><a name="a2706"></a><span class="src-doc">     *</span></li>
<li><a name="a2707"></a><span class="src-doc">     * Generally uses mysql_query().  If you want to use</span></li>
<li><a name="a2708"></a><span class="src-doc">     * mysql_unbuffered_query() set the &quot;result_buffering&quot; option to 0 using</span></li>
<li><a name="a2709"></a><span class="src-doc">     * setOptions().  This option was added in Release 1.7.0.</span></li>
<li><a name="a2710"></a><span class="src-doc">     *</span></li>
<li><a name="a2711"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc"> the SQL query string</span></li>
<li><a name="a2712"></a><span class="src-doc">     *</span></li>
<li><a name="a2713"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> + a PHP result resrouce for successful SELECT queries</span></li>
<li><a name="a2714"></a><span class="src-doc">     *                 + the DB_OK constant for other successful queries</span></li>
<li><a name="a2715"></a><span class="src-doc">     *                 + a DB_Error object on failure</span></li>
<li><a name="a2716"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::simpleQuery()</span></li>
<li><a name="a2717"></a><span class="src-doc">     */</span></li>
<li><a name="a2718"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodsimpleQuery">simpleQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">)</span></li>
<li><a name="a2719"></a>    <span class="src-sym">{</span></li>
<li><a name="a2720"></a><span class="src-comm">//        $ismanip = DB::isManip($query);</span></li>
<li><a name="a2721"></a><span class="src-comm">//        $this-&gt;last_query = $query;</span></li>
<li><a name="a2722"></a><span class="src-comm">//        $query = $this-&gt;modifyQuery($query);</span></li>
<li><a name="a2723"></a><span class="src-comm">//        if ($this-&gt;_db) {</span></li>
<li><a name="a2724"></a><span class="src-comm">//            if (!@mysql_select_db($this-&gt;_db, $this-&gt;connection)) {</span></li>
<li><a name="a2725"></a><span class="src-comm">//                return $this-&gt;mysqlRaiseError(DB_ERROR_NODBSELECTED);</span></li>
<li><a name="a2726"></a><span class="src-comm">//            }</span></li>
<li><a name="a2727"></a><span class="src-comm">//        }</span></li>
<li><a name="a2728"></a><span class="src-comm">//        if (!$this-&gt;autocommit &amp;&amp; $ismanip) {</span></li>
<li><a name="a2729"></a><span class="src-comm">//            if ($this-&gt;transaction_opcount == 0) {</span></li>
<li><a name="a2730"></a><span class="src-comm">//                $result = @mysql_query('SET AUTOCOMMIT=0', $this-&gt;connection);</span></li>
<li><a name="a2731"></a><span class="src-comm">//                $result = @mysql_query('BEGIN', $this-&gt;connection);</span></li>
<li><a name="a2732"></a><span class="src-comm">//                if (!$result) {</span></li>
<li><a name="a2733"></a><span class="src-comm">//                    return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2734"></a><span class="src-comm">//                }</span></li>
<li><a name="a2735"></a><span class="src-comm">//            }</span></li>
<li><a name="a2736"></a><span class="src-comm">//            $this-&gt;transaction_opcount++;</span></li>
<li><a name="a2737"></a><span class="src-comm">//        }</span></li>
<li><a name="a2738"></a><span class="src-comm">//        if (!$this-&gt;options['result_buffering']) {</span></li>
<li><a name="a2739"></a><span class="src-comm">//            $result = @mysql_unbuffered_query($query, $this-&gt;connection);</span></li>
<li><a name="a2740"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2741"></a><span class="src-comm">//            $result = @mysql_query($query, $this-&gt;connection);</span></li>
<li><a name="a2742"></a><span class="src-comm">//        }</span></li>
<li><a name="a2743"></a><span class="src-comm">//        if (!$result) {</span></li>
<li><a name="a2744"></a><span class="src-comm">//            return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2745"></a><span class="src-comm">//        }</span></li>
<li><a name="a2746"></a><span class="src-comm">//        if (is_resource($result)) {</span></li>
<li><a name="a2747"></a><span class="src-comm">//            return $result;</span></li>
<li><a name="a2748"></a><span class="src-comm">//        }</span></li>
<li><a name="a2749"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a2750"></a>    <span class="src-sym">}</span></li>
<li><a name="a2751"></a>&nbsp;</li>
<li><a name="a2752"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2753"></a><span class="src-doc">     * Move the internal mysql result pointer to the next available result</span></li>
<li><a name="a2754"></a><span class="src-doc">     *</span></li>
<li><a name="a2755"></a><span class="src-doc">     * This method has not been implemented yet.</span></li>
<li><a name="a2756"></a><span class="src-doc">     *</span></li>
<li><a name="a2757"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">a </span><span class="src-doc">valid sql result resource</span></li>
<li><a name="a2758"></a><span class="src-doc">     *</span></li>
<li><a name="a2759"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">false </span></li>
<li><a name="a2760"></a><span class="src-doc">     */</span></li>
<li><a name="a2761"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodnextResult">nextResult</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a2762"></a>    <span class="src-sym">{</span></li>
<li><a name="a2763"></a>        <span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a2764"></a>    <span class="src-sym">}</span></li>
<li><a name="a2765"></a>&nbsp;</li>
<li><a name="a2766"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2767"></a><span class="src-doc">     * Places a row from the result set into the given array</span></li>
<li><a name="a2768"></a><span class="src-doc">     *</span></li>
<li><a name="a2769"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc">   the query result resource</span></li>
<li><a name="a2770"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc">   </span><span class="src-doc-var">$arr </span><span class="src-doc">      the referenced array to put the data in</span></li>
<li><a name="a2771"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">     </span><span class="src-doc-var">$fetchmode </span><span class="src-doc">how the resulting array should be indexed</span></li>
<li><a name="a2772"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">     </span><span class="src-doc-var">$rownum </span><span class="src-doc">   the row number to fetch (0 = first row)</span></li>
<li><a name="a2773"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc"> DB_OK on success, NULL when the end of a result set is</span></li>
<li><a name="a2774"></a><span class="src-doc">     *                  reached or on failure</span></li>
<li><a name="a2775"></a><span class="src-doc">     *</span></li>
<li><a name="a2776"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_result::fetchInto()</span></li>
<li><a name="a2777"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::fetchInto()</span></li>
<li><a name="a2778"></a><span class="src-doc">     */</span></li>
<li><a name="a2779"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodfetchInto">fetchInto</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">, </span><span class="src-sym">&amp;</span><span class="src-var">$arr</span><span class="src-sym">, </span><span class="src-var">$fetchmode</span><span class="src-sym">, </span><span class="src-var">$rownum </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a2780"></a>    <span class="src-sym">{</span></li>
<li><a name="a2781"></a><span class="src-comm">//        if ($rownum !== null) {</span></li>
<li><a name="a2782"></a><span class="src-comm">//            if (!@mysql_data_seek($result, $rownum)) {</span></li>
<li><a name="a2783"></a><span class="src-comm">//                return null;</span></li>
<li><a name="a2784"></a><span class="src-comm">//            }</span></li>
<li><a name="a2785"></a><span class="src-comm">//        }</span></li>
<li><a name="a2786"></a><span class="src-comm">//        if ($fetchmode &amp; DB_FETCHMODE_ASSOC) {</span></li>
<li><a name="a2787"></a><span class="src-comm">//            $arr = @mysql_fetch_array($result, MYSQL_ASSOC);</span></li>
<li><a name="a2788"></a><span class="src-comm">//            if ($this-&gt;options['portability'] &amp; DB_PORTABILITY_LOWERCASE &amp;&amp; $arr) {</span></li>
<li><a name="a2789"></a><span class="src-comm">//                $arr = array_change_key_case($arr, CASE_LOWER);</span></li>
<li><a name="a2790"></a><span class="src-comm">//            }</span></li>
<li><a name="a2791"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2792"></a><span class="src-comm">//            $arr = @mysql_fetch_row($result);</span></li>
<li><a name="a2793"></a><span class="src-comm">//        }</span></li>
<li><a name="a2794"></a><span class="src-comm">//        if (!$arr) {</span></li>
<li><a name="a2795"></a><span class="src-comm">//            return null;</span></li>
<li><a name="a2796"></a><span class="src-comm">//        }</span></li>
<li><a name="a2797"></a><span class="src-comm">//        if ($this-&gt;options['portability'] &amp; DB_PORTABILITY_RTRIM) {</span></li>
<li><a name="a2798"></a><span class="src-comm">//            /*</span></li>
<li><a name="a2799"></a><span class="src-comm">//             * Even though this DBMS already trims output, we do this because</span></li>
<li><a name="a2800"></a><span class="src-comm">//             * a field might have intentional whitespace at the end that</span></li>
<li><a name="a2801"></a><span class="src-comm">//             * gets removed by DB_PORTABILITY_RTRIM under another driver.</span></li>
<li><a name="a2802"></a><span class="src-comm">//             */</span></li>
<li><a name="a2803"></a><span class="src-comm">//            $this-&gt;_rtrimArrayValues($arr);</span></li>
<li><a name="a2804"></a><span class="src-comm">//        }</span></li>
<li><a name="a2805"></a><span class="src-comm">//        if ($this-&gt;options['portability'] &amp; DB_PORTABILITY_NULL_TO_EMPTY) {</span></li>
<li><a name="a2806"></a><span class="src-comm">//            $this-&gt;_convertNullArrayValuesToEmpty($arr);</span></li>
<li><a name="a2807"></a><span class="src-comm">//        }</span></li>
<li><a name="a2808"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a2809"></a>    <span class="src-sym">}</span></li>
<li><a name="a2810"></a>&nbsp;</li>
<li><a name="a2811"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2812"></a><span class="src-doc">     * Deletes the result set and frees the memory occupied by the result set</span></li>
<li><a name="a2813"></a><span class="src-doc">     *</span></li>
<li><a name="a2814"></a><span class="src-doc">     * This method is not meant to be called directly.  Use</span></li>
<li><a name="a2815"></a><span class="src-doc">     * DB_result::free() instead.  It can't be declared &quot;protected&quot;</span></li>
<li><a name="a2816"></a><span class="src-doc">     * because DB_result is a separate object.</span></li>
<li><a name="a2817"></a><span class="src-doc">     *</span></li>
<li><a name="a2818"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc"> PHP's query result resource</span></li>
<li><a name="a2819"></a><span class="src-doc">     *</span></li>
<li><a name="a2820"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> TRUE on success, FALSE if $result is invalid</span></li>
<li><a name="a2821"></a><span class="src-doc">     *</span></li>
<li><a name="a2822"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_result::free()</span></li>
<li><a name="a2823"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::freeResult()</span></li>
<li><a name="a2824"></a><span class="src-doc">     */</span></li>
<li><a name="a2825"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodfreeResult">freeResult</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a2826"></a>    <span class="src-sym">{</span></li>
<li><a name="a2827"></a><span class="src-comm">//        return @mysql_free_result($result);</span></li>
<li><a name="a2828"></a>    <span class="src-sym">}</span></li>
<li><a name="a2829"></a>&nbsp;</li>
<li><a name="a2830"></a>&nbsp;</li>
<li><a name="a2831"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2832"></a><span class="src-doc">     * Gets the number of columns in a result set</span></li>
<li><a name="a2833"></a><span class="src-doc">     *</span></li>
<li><a name="a2834"></a><span class="src-doc">     * This method is not meant to be called directly.  Use</span></li>
<li><a name="a2835"></a><span class="src-doc">     * DB_result::numCols() instead.  It can't be declared &quot;protected&quot;</span></li>
<li><a name="a2836"></a><span class="src-doc">     * because DB_result is a separate object.</span></li>
<li><a name="a2837"></a><span class="src-doc">     *</span></li>
<li><a name="a2838"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc"> PHP's query result resource</span></li>
<li><a name="a2839"></a><span class="src-doc">     *</span></li>
<li><a name="a2840"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of columns.  A DB_Error object on failure.</span></li>
<li><a name="a2841"></a><span class="src-doc">     *</span></li>
<li><a name="a2842"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_result::numCols()</span></li>
<li><a name="a2843"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::numCols()</span></li>
<li><a name="a2844"></a><span class="src-doc">     */</span></li>
<li><a name="a2845"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodnumCols">numCols</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a2846"></a>    <span class="src-sym">{</span></li>
<li><a name="a2847"></a><span class="src-comm">//        $cols = @mysql_num_fields($result);</span></li>
<li><a name="a2848"></a><span class="src-comm">//        if (!$cols) {</span></li>
<li><a name="a2849"></a><span class="src-comm">//            return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2850"></a><span class="src-comm">//        }</span></li>
<li><a name="a2851"></a><span class="src-comm">//        return $cols;</span></li>
<li><a name="a2852"></a>    <span class="src-sym">}</span></li>
<li><a name="a2853"></a>&nbsp;</li>
<li><a name="a2854"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2855"></a><span class="src-doc">     * Gets the number of rows in a result set</span></li>
<li><a name="a2856"></a><span class="src-doc">     *</span></li>
<li><a name="a2857"></a><span class="src-doc">     * This method is not meant to be called directly.  Use</span></li>
<li><a name="a2858"></a><span class="src-doc">     * DB_result::numRows() instead.  It can't be declared &quot;protected&quot;</span></li>
<li><a name="a2859"></a><span class="src-doc">     * because DB_result is a separate object.</span></li>
<li><a name="a2860"></a><span class="src-doc">     *</span></li>
<li><a name="a2861"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">resource </span><span class="src-doc-var">$result </span><span class="src-doc"> PHP's query result resource</span></li>
<li><a name="a2862"></a><span class="src-doc">     *</span></li>
<li><a name="a2863"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of rows.  A DB_Error object on failure.</span></li>
<li><a name="a2864"></a><span class="src-doc">     *</span></li>
<li><a name="a2865"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_result::numRows()</span></li>
<li><a name="a2866"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::numRows()</span></li>
<li><a name="a2867"></a><span class="src-doc">     */</span></li>
<li><a name="a2868"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodnumRows">numRows</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a2869"></a>    <span class="src-sym">{</span></li>
<li><a name="a2870"></a><span class="src-comm">//        $rows = @mysql_num_rows($result);</span></li>
<li><a name="a2871"></a><span class="src-comm">//        if ($rows === null) {</span></li>
<li><a name="a2872"></a><span class="src-comm">//            return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2873"></a><span class="src-comm">//        }</span></li>
<li><a name="a2874"></a><span class="src-comm">//        return $rows;</span></li>
<li><a name="a2875"></a>    <span class="src-sym">}</span></li>
<li><a name="a2876"></a>&nbsp;</li>
<li><a name="a2877"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2878"></a><span class="src-doc">     * Enables or disables automatic commits</span></li>
<li><a name="a2879"></a><span class="src-doc">     *</span></li>
<li><a name="a2880"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc-var">$onoff </span><span class="src-doc"> true turns it on, false turns it off</span></li>
<li><a name="a2881"></a><span class="src-doc">     *</span></li>
<li><a name="a2882"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object if the driver</span></li>
<li><a name="a2883"></a><span class="src-doc">     *                doesn't support auto-committing transactions.</span></li>
<li><a name="a2884"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::autoCommit()</span></li>
<li><a name="a2885"></a><span class="src-doc">     */</span></li>
<li><a name="a2886"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodautoCommit">autoCommit</a><span class="src-sym">(</span><span class="src-var">$onoff </span>= <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a2887"></a>    <span class="src-sym">{</span></li>
<li><a name="a2888"></a><span class="src-comm">//        // XXX if $this-&gt;transaction_opcount &gt; 0, we should probably</span></li>
<li><a name="a2889"></a><span class="src-comm">//        // issue a warning here.</span></li>
<li><a name="a2890"></a><span class="src-comm">//        $this-&gt;autocommit = $onoff ? true : false;</span></li>
<li><a name="a2891"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a2892"></a>    <span class="src-sym">}</span></li>
<li><a name="a2893"></a>&nbsp;</li>
<li><a name="a2894"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2895"></a><span class="src-doc">     * Commits the current transaction</span></li>
<li><a name="a2896"></a><span class="src-doc">     *</span></li>
<li><a name="a2897"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a2898"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::committ()</span></li>
<li><a name="a2899"></a><span class="src-doc">     */</span></li>
<li><a name="a2900"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodcommit">commit</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2901"></a>    <span class="src-sym">{</span></li>
<li><a name="a2902"></a><span class="src-comm">//        if ($this-&gt;transaction_opcount &gt; 0) {</span></li>
<li><a name="a2903"></a><span class="src-comm">//            if ($this-&gt;_db) {</span></li>
<li><a name="a2904"></a><span class="src-comm">//                if (!@mysql_select_db($this-&gt;_db, $this-&gt;connection)) {</span></li>
<li><a name="a2905"></a><span class="src-comm">//                    return $this-&gt;mysqlRaiseError(DB_ERROR_NODBSELECTED);</span></li>
<li><a name="a2906"></a><span class="src-comm">//                }</span></li>
<li><a name="a2907"></a><span class="src-comm">//            }</span></li>
<li><a name="a2908"></a><span class="src-comm">//            $result = @mysql_query('COMMIT', $this-&gt;connection);</span></li>
<li><a name="a2909"></a><span class="src-comm">//            $result = @mysql_query('SET AUTOCOMMIT=1', $this-&gt;connection);</span></li>
<li><a name="a2910"></a><span class="src-comm">//            $this-&gt;transaction_opcount = 0;</span></li>
<li><a name="a2911"></a><span class="src-comm">//            if (!$result) {</span></li>
<li><a name="a2912"></a><span class="src-comm">//                return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2913"></a><span class="src-comm">//            }</span></li>
<li><a name="a2914"></a><span class="src-comm">//        }</span></li>
<li><a name="a2915"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a2916"></a>    <span class="src-sym">}</span></li>
<li><a name="a2917"></a>&nbsp;</li>
<li><a name="a2918"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2919"></a><span class="src-doc">     * Reverts the current transaction</span></li>
<li><a name="a2920"></a><span class="src-doc">     *</span></li>
<li><a name="a2921"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a2922"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::rollback()</span></li>
<li><a name="a2923"></a><span class="src-doc">     */</span></li>
<li><a name="a2924"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodrollback">rollback</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2925"></a>    <span class="src-sym">{</span></li>
<li><a name="a2926"></a><span class="src-comm">//        if ($this-&gt;transaction_opcount &gt; 0) {</span></li>
<li><a name="a2927"></a><span class="src-comm">//            if ($this-&gt;_db) {</span></li>
<li><a name="a2928"></a><span class="src-comm">//                if (!@mysql_select_db($this-&gt;_db, $this-&gt;connection)) {</span></li>
<li><a name="a2929"></a><span class="src-comm">//                    return $this-&gt;mysqlRaiseError(DB_ERROR_NODBSELECTED);</span></li>
<li><a name="a2930"></a><span class="src-comm">//                }</span></li>
<li><a name="a2931"></a><span class="src-comm">//            }</span></li>
<li><a name="a2932"></a><span class="src-comm">//            $result = @mysql_query('ROLLBACK', $this-&gt;connection);</span></li>
<li><a name="a2933"></a><span class="src-comm">//            $result = @mysql_query('SET AUTOCOMMIT=1', $this-&gt;connection);</span></li>
<li><a name="a2934"></a><span class="src-comm">//            $this-&gt;transaction_opcount = 0;</span></li>
<li><a name="a2935"></a><span class="src-comm">//            if (!$result) {</span></li>
<li><a name="a2936"></a><span class="src-comm">//                return $this-&gt;mysqlRaiseError();</span></li>
<li><a name="a2937"></a><span class="src-comm">//            }</span></li>
<li><a name="a2938"></a><span class="src-comm">//        }</span></li>
<li><a name="a2939"></a>        <span class="src-key">return </span><span class="src-id"><a href="../PHPonTraxTest/_test_mockDB_DB_php.html#defineDB_OK">DB_OK</a></span><span class="src-sym">;</span></li>
<li><a name="a2940"></a>    <span class="src-sym">}</span></li>
<li><a name="a2941"></a>&nbsp;</li>
<li><a name="a2942"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2943"></a><span class="src-doc">     * Determines the number of rows affected by a data maniuplation query</span></li>
<li><a name="a2944"></a><span class="src-doc">     *</span></li>
<li><a name="a2945"></a><span class="src-doc">     * 0 is returned for queries that don't manipulate data.</span></li>
<li><a name="a2946"></a><span class="src-doc">     *</span></li>
<li><a name="a2947"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the number of rows.  A DB_Error object on failure.</span></li>
<li><a name="a2948"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::affectedRows()</span></li>
<li><a name="a2949"></a><span class="src-doc">     */</span></li>
<li><a name="a2950"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodaffectedRows">affectedRows</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a2951"></a>    <span class="src-sym">{</span></li>
<li><a name="a2952"></a><span class="src-comm">//        if (DB::isManip($this-&gt;last_query)) {</span></li>
<li><a name="a2953"></a><span class="src-comm">//            return @mysql_affected_rows($this-&gt;connection);</span></li>
<li><a name="a2954"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a2955"></a><span class="src-comm">//            return 0;</span></li>
<li><a name="a2956"></a><span class="src-comm">//        }</span></li>
<li><a name="a2957"></a>     <span class="src-sym">}</span></li>
<li><a name="a2958"></a>&nbsp;</li>
<li><a name="a2959"></a>    <span class="src-doc">/**</span></li>
<li><a name="a2960"></a><span class="src-doc">     * Returns the next free id in a sequence</span></li>
<li><a name="a2961"></a><span class="src-doc">     *</span></li>
<li><a name="a2962"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc"> </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the sequence</span></li>
<li><a name="a2963"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">boolean </span><span class="src-doc-var">$ondemand </span><span class="src-doc"> when true, the seqence is automatically</span></li>
<li><a name="a2964"></a><span class="src-doc">     *                             created if it does not exist</span></li>
<li><a name="a2965"></a><span class="src-doc">     *</span></li>
<li><a name="a2966"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the next id number in the sequence.</span></li>
<li><a name="a2967"></a><span class="src-doc">     *                A DB_Error object on failure.</span></li>
<li><a name="a2968"></a><span class="src-doc">     *</span></li>
<li><a name="a2969"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::nextID(), DB_common::getSequenceName(),</span></li>
<li><a name="a2970"></a><span class="src-doc">     *       DB_mysql::createSequence(), DB_mysql::dropSequence()</span></li>
<li><a name="a2971"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::nextId()</span></li>
<li><a name="a2972"></a><span class="src-doc">     */</span></li>
<li><a name="a2973"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodnextId">nextId</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">, </span><span class="src-var">$ondemand </span>= <span class="src-id">true</span><span class="src-sym">)</span></li>
<li><a name="a2974"></a>    <span class="src-sym">{</span></li>
<li><a name="a2975"></a><span class="src-comm">//        $seqname = $this-&gt;getSequenceName($seq_name);</span></li>
<li><a name="a2976"></a><span class="src-comm">//        do {</span></li>
<li><a name="a2977"></a><span class="src-comm">//            $repeat = 0;</span></li>
<li><a name="a2978"></a><span class="src-comm">//            $this-&gt;pushErrorHandling(PEAR_ERROR_RETURN);</span></li>
<li><a name="a2979"></a><span class="src-comm">//            $result = $this-&gt;query(&quot;UPDATE ${seqname} &quot;.</span></li>
<li><a name="a2980"></a><span class="src-comm">//                                   'SET id=LAST_INSERT_ID(id+1)');</span></li>
<li><a name="a2981"></a><span class="src-comm">//            $this-&gt;popErrorHandling();</span></li>
<li><a name="a2982"></a><span class="src-comm">//            if ($result === DB_OK) {</span></li>
<li><a name="a2983"></a><span class="src-comm">//                // COMMON CASE</span></li>
<li><a name="a2984"></a><span class="src-comm">//                $id = @mysql_insert_id($this-&gt;connection);</span></li>
<li><a name="a2985"></a><span class="src-comm">//                if ($id != 0) {</span></li>
<li><a name="a2986"></a><span class="src-comm">//                    return $id;</span></li>
<li><a name="a2987"></a><span class="src-comm">//                }</span></li>
<li><a name="a2988"></a><span class="src-comm">//                // EMPTY SEQ TABLE</span></li>
<li><a name="a2989"></a><span class="src-comm">//                // Sequence table must be empty for some reason, so fill</span></li>
<li><a name="a2990"></a><span class="src-comm">//                // it and return 1 and obtain a user-level lock</span></li>
<li><a name="a2991"></a><span class="src-comm">//                $result = $this-&gt;getOne(&quot;SELECT GET_LOCK('${seqname}_lock',10)&quot;);</span></li>
<li><a name="a2992"></a><span class="src-comm">//                if (DB::isError($result)) {</span></li>
<li><a name="a2993"></a><span class="src-comm">//                    return $this-&gt;raiseError($result);</span></li>
<li><a name="a2994"></a><span class="src-comm">//                }</span></li>
<li><a name="a2995"></a><span class="src-comm">//                if ($result == 0) {</span></li>
<li><a name="a2996"></a><span class="src-comm">//                    // Failed to get the lock</span></li>
<li><a name="a2997"></a><span class="src-comm">//                    return $this-&gt;mysqlRaiseError(DB_ERROR_NOT_LOCKED);</span></li>
<li><a name="a2998"></a><span class="src-comm">//                }</span></li>
<li><a name="a2999"></a><span class="src-comm">//</span></li>
<li><a name="a3000"></a><span class="src-comm">//                // add the default value</span></li>
<li><a name="a3001"></a><span class="src-comm">//                $result = $this-&gt;query(&quot;REPLACE INTO ${seqname} (id) VALUES (0)&quot;);</span></li>
<li><a name="a3002"></a><span class="src-comm">//                if (DB::isError($result)) {</span></li>
<li><a name="a3003"></a><span class="src-comm">//                    return $this-&gt;raiseError($result);</span></li>
<li><a name="a3004"></a><span class="src-comm">//                }</span></li>
<li><a name="a3005"></a><span class="src-comm">//</span></li>
<li><a name="a3006"></a><span class="src-comm">//                // Release the lock</span></li>
<li><a name="a3007"></a><span class="src-comm">//                $result = $this-&gt;getOne('SELECT RELEASE_LOCK('</span></li>
<li><a name="a3008"></a><span class="src-comm">//                                        . &quot;'${seqname}_lock')&quot;);</span></li>
<li><a name="a3009"></a><span class="src-comm">//                if (DB::isError($result)) {</span></li>
<li><a name="a3010"></a><span class="src-comm">//                    return $this-&gt;raiseError($result);</span></li>
<li><a name="a3011"></a><span class="src-comm">//                }</span></li>
<li><a name="a3012"></a><span class="src-comm">//                // We know what the result will be, so no need to try again</span></li>
<li><a name="a3013"></a><span class="src-comm">//                return 1;</span></li>
<li><a name="a3014"></a><span class="src-comm">//</span></li>
<li><a name="a3015"></a><span class="src-comm">//            } elseif ($ondemand &amp;&amp; DB::isError($result) &amp;&amp;</span></li>
<li><a name="a3016"></a><span class="src-comm">//                $result-&gt;getCode() == DB_ERROR_NOSUCHTABLE)</span></li>
<li><a name="a3017"></a><span class="src-comm">//            {</span></li>
<li><a name="a3018"></a><span class="src-comm">//                // ONDEMAND TABLE CREATION</span></li>
<li><a name="a3019"></a><span class="src-comm">//                $result = $this-&gt;createSequence($seq_name);</span></li>
<li><a name="a3020"></a><span class="src-comm">//                if (DB::isError($result)) {</span></li>
<li><a name="a3021"></a><span class="src-comm">//                    return $this-&gt;raiseError($result);</span></li>
<li><a name="a3022"></a><span class="src-comm">//                } else {</span></li>
<li><a name="a3023"></a><span class="src-comm">//                    $repeat = 1;</span></li>
<li><a name="a3024"></a><span class="src-comm">//                }</span></li>
<li><a name="a3025"></a><span class="src-comm">//</span></li>
<li><a name="a3026"></a><span class="src-comm">//            } elseif (DB::isError($result) &amp;&amp;</span></li>
<li><a name="a3027"></a><span class="src-comm">//                      $result-&gt;getCode() == DB_ERROR_ALREADY_EXISTS)</span></li>
<li><a name="a3028"></a><span class="src-comm">//            {</span></li>
<li><a name="a3029"></a><span class="src-comm">//                // BACKWARDS COMPAT</span></li>
<li><a name="a3030"></a><span class="src-comm">//                // see _BCsequence() comment</span></li>
<li><a name="a3031"></a><span class="src-comm">//                $result = $this-&gt;_BCsequence($seqname);</span></li>
<li><a name="a3032"></a><span class="src-comm">//                if (DB::isError($result)) {</span></li>
<li><a name="a3033"></a><span class="src-comm">//                    return $this-&gt;raiseError($result);</span></li>
<li><a name="a3034"></a><span class="src-comm">//                }</span></li>
<li><a name="a3035"></a><span class="src-comm">//                $repeat = 1;</span></li>
<li><a name="a3036"></a><span class="src-comm">//            }</span></li>
<li><a name="a3037"></a><span class="src-comm">//        } while ($repeat);</span></li>
<li><a name="a3038"></a><span class="src-comm">//</span></li>
<li><a name="a3039"></a><span class="src-comm">//        return $this-&gt;raiseError($result);</span></li>
<li><a name="a3040"></a>    <span class="src-sym">}</span></li>
<li><a name="a3041"></a>&nbsp;</li>
<li><a name="a3042"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3043"></a><span class="src-doc">     * Creates a new sequence</span></li>
<li><a name="a3044"></a><span class="src-doc">     *</span></li>
<li><a name="a3045"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the new sequence</span></li>
<li><a name="a3046"></a><span class="src-doc">     *</span></li>
<li><a name="a3047"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a3048"></a><span class="src-doc">     *</span></li>
<li><a name="a3049"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::createSequence(), DB_common::getSequenceName(),</span></li>
<li><a name="a3050"></a><span class="src-doc">     *       DB_mysql::nextID(), DB_mysql::dropSequence()</span></li>
<li><a name="a3051"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::createSequence()</span></li>
<li><a name="a3052"></a><span class="src-doc">     */</span></li>
<li><a name="a3053"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodcreateSequence">createSequence</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">)</span></li>
<li><a name="a3054"></a>    <span class="src-sym">{</span></li>
<li><a name="a3055"></a><span class="src-comm">//        $seqname = $this-&gt;getSequenceName($seq_name);</span></li>
<li><a name="a3056"></a><span class="src-comm">//        $res = $this-&gt;query('CREATE TABLE ' . $seqname</span></li>
<li><a name="a3057"></a><span class="src-comm">//                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'</span></li>
<li><a name="a3058"></a><span class="src-comm">//                            . ' PRIMARY KEY(id))');</span></li>
<li><a name="a3059"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a3060"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a3061"></a><span class="src-comm">//        }</span></li>
<li><a name="a3062"></a><span class="src-comm">//        // insert yields value 1, nextId call will generate ID 2</span></li>
<li><a name="a3063"></a><span class="src-comm">//        $res = $this-&gt;query(&quot;INSERT INTO ${seqname} (id) VALUES (0)&quot;);</span></li>
<li><a name="a3064"></a><span class="src-comm">//        if (DB::isError($res)) {</span></li>
<li><a name="a3065"></a><span class="src-comm">//            return $res;</span></li>
<li><a name="a3066"></a><span class="src-comm">//        }</span></li>
<li><a name="a3067"></a><span class="src-comm">//        // so reset to zero</span></li>
<li><a name="a3068"></a><span class="src-comm">//        return $this-&gt;query(&quot;UPDATE ${seqname} SET id = 0&quot;);</span></li>
<li><a name="a3069"></a>    <span class="src-sym">}</span></li>
<li><a name="a3070"></a>&nbsp;</li>
<li><a name="a3071"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3072"></a><span class="src-doc">     * Deletes a sequence</span></li>
<li><a name="a3073"></a><span class="src-doc">     *</span></li>
<li><a name="a3074"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$seq_name </span><span class="src-doc"> name of the sequence to be deleted</span></li>
<li><a name="a3075"></a><span class="src-doc">     *</span></li>
<li><a name="a3076"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> DB_OK on success.  A DB_Error object on failure.</span></li>
<li><a name="a3077"></a><span class="src-doc">     *</span></li>
<li><a name="a3078"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::dropSequence(), DB_common::getSequenceName(),</span></li>
<li><a name="a3079"></a><span class="src-doc">     *       DB_mysql::nextID(), DB_mysql::createSequence()</span></li>
<li><a name="a3080"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::dropSequence()</span></li>
<li><a name="a3081"></a><span class="src-doc">     */</span></li>
<li><a name="a3082"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methoddropSequence">dropSequence</a><span class="src-sym">(</span><span class="src-var">$seq_name</span><span class="src-sym">)</span></li>
<li><a name="a3083"></a>    <span class="src-sym">{</span></li>
<li><a name="a3084"></a><span class="src-comm">//        return $this-&gt;query('DROP TABLE ' . $this-&gt;getSequenceName($seq_name));</span></li>
<li><a name="a3085"></a>    <span class="src-sym">}</span></li>
<li><a name="a3086"></a>&nbsp;</li>
<li><a name="a3087"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3088"></a><span class="src-doc">     * Backwards compatibility with old sequence emulation implementation</span></li>
<li><a name="a3089"></a><span class="src-doc">     * (clean up the dupes)</span></li>
<li><a name="a3090"></a><span class="src-doc">     *</span></li>
<li><a name="a3091"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$seqname </span><span class="src-doc"> the sequence name to clean up</span></li>
<li><a name="a3092"></a><span class="src-doc">     *</span></li>
<li><a name="a3093"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span><span class="src-doc"> true on success.  A DB_Error object on failure.</span></li>
<li><a name="a3094"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::_BCsequence()</span></li>
<li><a name="a3095"></a><span class="src-doc">     */</span></li>
<li><a name="a3096"></a>    <span class="src-key">private </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#method_BCsequence">_BCsequence</a><span class="src-sym">(</span><span class="src-var">$seqname</span><span class="src-sym">)</span></li>
<li><a name="a3097"></a>    <span class="src-sym">{</span></li>
<li><a name="a3098"></a><span class="src-comm">//        // Obtain a user-level lock... this will release any previous</span></li>
<li><a name="a3099"></a><span class="src-comm">//        // application locks, but unlike LOCK TABLES, it does not abort</span></li>
<li><a name="a3100"></a><span class="src-comm">//        // the current transaction and is much less frequently used.</span></li>
<li><a name="a3101"></a><span class="src-comm">//        $result = $this-&gt;getOne(&quot;SELECT GET_LOCK('${seqname}_lock',10)&quot;);</span></li>
<li><a name="a3102"></a><span class="src-comm">//        if (DB::isError($result)) {</span></li>
<li><a name="a3103"></a><span class="src-comm">//            return $result;</span></li>
<li><a name="a3104"></a><span class="src-comm">//        }</span></li>
<li><a name="a3105"></a><span class="src-comm">//        if ($result == 0) {</span></li>
<li><a name="a3106"></a><span class="src-comm">//            // Failed to get the lock, can't do the conversion, bail</span></li>
<li><a name="a3107"></a><span class="src-comm">//            // with a DB_ERROR_NOT_LOCKED error</span></li>
<li><a name="a3108"></a><span class="src-comm">//            return $this-&gt;mysqlRaiseError(DB_ERROR_NOT_LOCKED);</span></li>
<li><a name="a3109"></a><span class="src-comm">//        }</span></li>
<li><a name="a3110"></a><span class="src-comm">//</span></li>
<li><a name="a3111"></a><span class="src-comm">//        $highest_id = $this-&gt;getOne(&quot;SELECT MAX(id) FROM ${seqname}&quot;);</span></li>
<li><a name="a3112"></a><span class="src-comm">//        if (DB::isError($highest_id)) {</span></li>
<li><a name="a3113"></a><span class="src-comm">//            return $highest_id;</span></li>
<li><a name="a3114"></a><span class="src-comm">//        }</span></li>
<li><a name="a3115"></a><span class="src-comm">//        // This should kill all rows except the highest</span></li>
<li><a name="a3116"></a><span class="src-comm">//        // We should probably do something if $highest_id isn't</span></li>
<li><a name="a3117"></a><span class="src-comm">//        // numeric, but I'm at a loss as how to handle that...</span></li>
<li><a name="a3118"></a><span class="src-comm">//        $result = $this-&gt;query('DELETE FROM ' . $seqname</span></li>
<li><a name="a3119"></a><span class="src-comm">//                               . &quot; WHERE id &lt;&gt; $highest_id&quot;);</span></li>
<li><a name="a3120"></a><span class="src-comm">//        if (DB::isError($result)) {</span></li>
<li><a name="a3121"></a><span class="src-comm">//            return $result;</span></li>
<li><a name="a3122"></a><span class="src-comm">//        }</span></li>
<li><a name="a3123"></a><span class="src-comm">//</span></li>
<li><a name="a3124"></a><span class="src-comm">//        // If another thread has been waiting for this lock,</span></li>
<li><a name="a3125"></a><span class="src-comm">//        // it will go thru the above procedure, but will have no</span></li>
<li><a name="a3126"></a><span class="src-comm">//        // real effect</span></li>
<li><a name="a3127"></a><span class="src-comm">//        $result = $this-&gt;getOne(&quot;SELECT RELEASE_LOCK('${seqname}_lock')&quot;);</span></li>
<li><a name="a3128"></a><span class="src-comm">//        if (DB::isError($result)) {</span></li>
<li><a name="a3129"></a><span class="src-comm">//            return $result;</span></li>
<li><a name="a3130"></a><span class="src-comm">//        }</span></li>
<li><a name="a3131"></a>        <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a3132"></a>    <span class="src-sym">}</span></li>
<li><a name="a3133"></a>&nbsp;</li>
<li><a name="a3134"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3135"></a><span class="src-doc">     * Quotes a string so it can be safely used as a table or column name</span></li>
<li><a name="a3136"></a><span class="src-doc">     *</span></li>
<li><a name="a3137"></a><span class="src-doc">     * MySQL can't handle the backtick character (&lt;kbd&gt;`&lt;/kbd&gt;) in</span></li>
<li><a name="a3138"></a><span class="src-doc">     * table or column names.</span></li>
<li><a name="a3139"></a><span class="src-doc">     *</span></li>
<li><a name="a3140"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$str </span><span class="src-doc"> identifier name to be quoted</span></li>
<li><a name="a3141"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> quoted identifier string</span></li>
<li><a name="a3142"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::quoteIdentifier()</span></li>
<li><a name="a3143"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a3144"></a><span class="src-doc">     */</span></li>
<li><a name="a3145"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodquoteIdentifier">quoteIdentifier</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">)</span></li>
<li><a name="a3146"></a>    <span class="src-sym">{</span></li>
<li><a name="a3147"></a>        <span class="src-key">return </span><span class="src-str">'`' </span>. <span class="src-var">$str </span>. <span class="src-str">'`'</span><span class="src-sym">;</span></li>
<li><a name="a3148"></a>    <span class="src-sym">}</span></li>
<li><a name="a3149"></a>&nbsp;</li>
<li><a name="a3150"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3151"></a><span class="src-doc">     * Escapes a string according to the current DBMS's standards</span></li>
<li><a name="a3152"></a><span class="src-doc">     *</span></li>
<li><a name="a3153"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$str </span><span class="src-doc"> the string to be escaped</span></li>
<li><a name="a3154"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the escaped string</span></li>
<li><a name="a3155"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::quoteSmart()</span></li>
<li><a name="a3156"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::escapeSimple()</span></li>
<li><a name="a3157"></a><span class="src-doc">     */</span></li>
<li><a name="a3158"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodescapeSimple">escapeSimple</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">)</span></li>
<li><a name="a3159"></a>    <span class="src-sym">{</span></li>
<li><a name="a3160"></a><span class="src-comm">//        if (function_exists('mysql_real_escape_string')) {</span></li>
<li><a name="a3161"></a><span class="src-comm">//            return @mysql_real_escape_string($str, $this-&gt;connection);</span></li>
<li><a name="a3162"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a3163"></a><span class="src-comm">//            return @mysql_escape_string($str);</span></li>
<li><a name="a3164"></a><span class="src-comm">//        }</span></li>
<li><a name="a3165"></a>    <span class="src-sym">}</span></li>
<li><a name="a3166"></a>&nbsp;</li>
<li><a name="a3167"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3168"></a><span class="src-doc">     * Changes a query string for various DBMS specific reasons</span></li>
<li><a name="a3169"></a><span class="src-doc">     *</span></li>
<li><a name="a3170"></a><span class="src-doc">     * This little hack lets you know how many rows were deleted</span></li>
<li><a name="a3171"></a><span class="src-doc">     * when running a &quot;DELETE FROM table&quot; query.  Only implemented</span></li>
<li><a name="a3172"></a><span class="src-doc">     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.</span></li>
<li><a name="a3173"></a><span class="src-doc">     *</span></li>
<li><a name="a3174"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc"> the query string to modify</span></li>
<li><a name="a3175"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the modified query string</span></li>
<li><a name="a3176"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::setOption()</span></li>
<li><a name="a3177"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::modifyQuery()</span></li>
<li><a name="a3178"></a><span class="src-doc">     */</span></li>
<li><a name="a3179"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodmodifyQuery">modifyQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">)</span></li>
<li><a name="a3180"></a>    <span class="src-sym">{</span></li>
<li><a name="a3181"></a><span class="src-comm">//        if ($this-&gt;options['portability'] &amp; DB_PORTABILITY_DELETE_COUNT) {</span></li>
<li><a name="a3182"></a><span class="src-comm">//            // &quot;DELETE FROM table&quot; gives 0 affected rows in MySQL.</span></li>
<li><a name="a3183"></a><span class="src-comm">//            // This little hack lets you know how many rows were deleted.</span></li>
<li><a name="a3184"></a><span class="src-comm">//            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {</span></li>
<li><a name="a3185"></a><span class="src-comm">//                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',</span></li>
<li><a name="a3186"></a><span class="src-comm">//                                      'DELETE FROM \1 WHERE 1=1', $query);</span></li>
<li><a name="a3187"></a><span class="src-comm">//            }</span></li>
<li><a name="a3188"></a><span class="src-comm">//        }</span></li>
<li><a name="a3189"></a><span class="src-comm">//        return $query;</span></li>
<li><a name="a3190"></a>    <span class="src-sym">}</span></li>
<li><a name="a3191"></a>&nbsp;</li>
<li><a name="a3192"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3193"></a><span class="src-doc">     * Adds LIMIT clauses to a query string according to current DBMS standards</span></li>
<li><a name="a3194"></a><span class="src-doc">     *</span></li>
<li><a name="a3195"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$query </span><span class="src-doc">  the query to modify</span></li>
<li><a name="a3196"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$from </span><span class="src-doc">   the row to start to fetching (0 = the first row)</span></li>
<li><a name="a3197"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">   </span><span class="src-doc-var">$count </span><span class="src-doc">  the numbers of rows to fetch</span></li>
<li><a name="a3198"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc"> </span><span class="src-doc-var">$params </span><span class="src-doc"> array, string or numeric data to be used in</span></li>
<li><a name="a3199"></a><span class="src-doc">     *                          execution of the statement.  Quantity of items</span></li>
<li><a name="a3200"></a><span class="src-doc">     *                          passed must match quantity of placeholders in</span></li>
<li><a name="a3201"></a><span class="src-doc">     *                          query:  meaning 1 placeholder for non-array</span></li>
<li><a name="a3202"></a><span class="src-doc">     *                          parameters or 1 placeholder per array element.</span></li>
<li><a name="a3203"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the query string with LIMIT clauses added</span></li>
<li><a name="a3204"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::modifyLimitQuery()</span></li>
<li><a name="a3205"></a><span class="src-doc">     */</span></li>
<li><a name="a3206"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodmodifyLimitQuery">modifyLimitQuery</a><span class="src-sym">(</span><span class="src-var">$query</span><span class="src-sym">, </span><span class="src-var">$from</span><span class="src-sym">, </span><span class="src-var">$count</span><span class="src-sym">, </span><span class="src-var">$params </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a3207"></a>    <span class="src-sym">{</span></li>
<li><a name="a3208"></a><span class="src-comm">//        if (DB::isManip($query)) {</span></li>
<li><a name="a3209"></a><span class="src-comm">//            return $query . &quot; LIMIT $count&quot;;</span></li>
<li><a name="a3210"></a><span class="src-comm">//        } else {</span></li>
<li><a name="a3211"></a><span class="src-comm">//            return $query . &quot; LIMIT $from, $count&quot;;</span></li>
<li><a name="a3212"></a><span class="src-comm">//        }</span></li>
<li><a name="a3213"></a>    <span class="src-sym">}</span></li>
<li><a name="a3214"></a>&nbsp;</li>
<li><a name="a3215"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3216"></a><span class="src-doc">     * Produces a DB_Error object regarding the current problem</span></li>
<li><a name="a3217"></a><span class="src-doc">     *</span></li>
<li><a name="a3218"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$errno </span><span class="src-doc"> if the error is being manually raised pass a</span></li>
<li><a name="a3219"></a><span class="src-doc">     *                      DB_ERROR* constant here.  If this isn't passed</span></li>
<li><a name="a3220"></a><span class="src-doc">     *                      the error information gathered from the DBMS.</span></li>
<li><a name="a3221"></a><span class="src-doc">     *</span></li>
<li><a name="a3222"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">object </span><span class="src-doc"> </span><span class="src-doc-type">the </span><span class="src-doc">DB_Error object</span></li>
<li><a name="a3223"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::raiseError(),</span></li>
<li><a name="a3224"></a><span class="src-doc">     *       DB_mysql::errorNative(), DB_common::errorCode()</span></li>
<li><a name="a3225"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::mysqlRaiseError()</span></li>
<li><a name="a3226"></a><span class="src-doc">     */</span></li>
<li><a name="a3227"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodmysqlRaiseError">mysqlRaiseError</a><span class="src-sym">(</span><span class="src-var">$errno </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a3228"></a>    <span class="src-sym">{</span></li>
<li><a name="a3229"></a><span class="src-comm">//        if ($errno === null) {</span></li>
<li><a name="a3230"></a><span class="src-comm">//            if ($this-&gt;options['portability'] &amp; DB_PORTABILITY_ERRORS) {</span></li>
<li><a name="a3231"></a><span class="src-comm">//                $this-&gt;errorcode_map[1022] = DB_ERROR_CONSTRAINT;</span></li>
<li><a name="a3232"></a><span class="src-comm">//                $this-&gt;errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;</span></li>
<li><a name="a3233"></a><span class="src-comm">//                $this-&gt;errorcode_map[1062] = DB_ERROR_CONSTRAINT;</span></li>
<li><a name="a3234"></a><span class="src-comm">//            } else {</span></li>
<li><a name="a3235"></a><span class="src-comm">//                // Doing this in case mode changes during runtime.</span></li>
<li><a name="a3236"></a><span class="src-comm">//                $this-&gt;errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;</span></li>
<li><a name="a3237"></a><span class="src-comm">//                $this-&gt;errorcode_map[1048] = DB_ERROR_CONSTRAINT;</span></li>
<li><a name="a3238"></a><span class="src-comm">//                $this-&gt;errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;</span></li>
<li><a name="a3239"></a><span class="src-comm">//            }</span></li>
<li><a name="a3240"></a><span class="src-comm">//            $errno = $this-&gt;errorCode(mysql_errno($this-&gt;connection));</span></li>
<li><a name="a3241"></a><span class="src-comm">//        }</span></li>
<li><a name="a3242"></a><span class="src-comm">//        return $this-&gt;raiseError($errno, null, null, null,</span></li>
<li><a name="a3243"></a><span class="src-comm">//                                 @mysql_errno($this-&gt;connection) . ' ** ' .</span></li>
<li><a name="a3244"></a><span class="src-comm">//                                 @mysql_error($this-&gt;connection));</span></li>
<li><a name="a3245"></a>    <span class="src-sym">}</span></li>
<li><a name="a3246"></a>&nbsp;</li>
<li><a name="a3247"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3248"></a><span class="src-doc">     * Gets the DBMS' native error code produced by the last query</span></li>
<li><a name="a3249"></a><span class="src-doc">     *</span></li>
<li><a name="a3250"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">int </span><span class="src-doc"> the DBMS' error code</span></li>
<li><a name="a3251"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::errorNative()</span></li>
<li><a name="a3252"></a><span class="src-doc">     */</span></li>
<li><a name="a3253"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methoderrorNative">errorNative</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a3254"></a>    <span class="src-sym">{</span></li>
<li><a name="a3255"></a><span class="src-comm">//        return @mysql_errno($this-&gt;connection);</span></li>
<li><a name="a3256"></a>    <span class="src-sym">}</span></li>
<li><a name="a3257"></a>&nbsp;</li>
<li><a name="a3258"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3259"></a><span class="src-doc">     * Returns information about a table or a result set</span></li>
<li><a name="a3260"></a><span class="src-doc">     *</span></li>
<li><a name="a3261"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">object</span><span class="src-doc">|</span><span class="src-doc-type">string</span><span class="src-doc"> </span><span class="src-doc-var">$result </span><span class="src-doc"> DB_result object from a query or a</span></li>
<li><a name="a3262"></a><span class="src-doc">     *                                  string containing the name of a table.</span></li>
<li><a name="a3263"></a><span class="src-doc">     *                                  While this also accepts a query result</span></li>
<li><a name="a3264"></a><span class="src-doc">     *                                  resource identifier, this behavior is</span></li>
<li><a name="a3265"></a><span class="src-doc">     *                                  deprecated.</span></li>
<li><a name="a3266"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc">           </span><span class="src-doc-var">$mode </span><span class="src-doc">   a valid tableInfo mode</span></li>
<li><a name="a3267"></a><span class="src-doc">     *</span></li>
<li><a name="a3268"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">array </span><span class="src-doc"> an associative array with the information requested.</span></li>
<li><a name="a3269"></a><span class="src-doc">     *                  A DB_Error object on failure.</span></li>
<li><a name="a3270"></a><span class="src-doc">     *</span></li>
<li><a name="a3271"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::tableInfo()</span></li>
<li><a name="a3272"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Implement mock DB_mysql::tableInfo()</span></li>
<li><a name="a3273"></a><span class="src-doc">     */</span></li>
<li><a name="a3274"></a>    <span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodtableInfo">tableInfo</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">, </span><span class="src-var">$mode </span>= <span class="src-id">null</span><span class="src-sym">)</span></li>
<li><a name="a3275"></a>    <span class="src-sym">{</span></li>
<li><a name="a3276"></a>        <span class="src-comm">// We only support the default mode</span></li>
<li><a name="a3277"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">assertNull</span><span class="src-sym">(</span><span class="src-var">$mode</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a3278"></a>&nbsp;</li>
<li><a name="a3279"></a>        <span class="src-comm">// We only support table name as first argument</span></li>
<li><a name="a3280"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">assertTrue</span><span class="src-sym">(</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a3281"></a>&nbsp;</li>
<li><a name="a3282"></a>        <span class="src-comm">// Look up table name in the mock database</span></li>
<li><a name="a3283"></a>        <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$database </span><span class="src-key">as </span><span class="src-var">$table </span>=&gt; <span class="src-var">$value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a3284"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$result </span>== <span class="src-var">$table</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a3285"></a>                <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">[</span><span class="src-str">'info'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a3286"></a>            <span class="src-sym">}</span></li>
<li><a name="a3287"></a>        <span class="src-sym">}</span></li>
<li><a name="a3288"></a>        <span class="src-id">PHPUnit2_Framework_Assert</span><span class="src-sym">::</span><span class="src-id">fail</span><span class="src-sym">(</span><span class="src-str">&quot;DB_mysql::tableInfo called&quot;</span></li>
<li><a name="a3289"></a>                                        .<span class="src-str">&quot;</span><span class="src-str"> <span class="src-id">with</span> <span class="src-id">unknown</span> <span class="src-id">table</span> <span class="src-var">$result</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a3290"></a>    <span class="src-sym">}</span></li>
<li><a name="a3291"></a>&nbsp;</li>
<li><a name="a3292"></a>    <span class="src-doc">/**</span></li>
<li><a name="a3293"></a><span class="src-doc">     * Obtains the query string needed for listing a given type of objects</span></li>
<li><a name="a3294"></a><span class="src-doc">     *</span></li>
<li><a name="a3295"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$type </span><span class="src-doc"> the kind of objects you want to retrieve</span></li>
<li><a name="a3296"></a><span class="src-doc">     *</span></li>
<li><a name="a3297"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc"> the SQL query string or null if the driver doesn't</span></li>
<li><a name="a3298"></a><span class="src-doc">     *                   support the object type requested</span></li>
<li><a name="a3299"></a><span class="src-doc">     *</span></li>
<li><a name="a3300"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> DB_common::getListOf()</span></li>
<li><a name="a3301"></a><span class="src-doc">     */</span></li>
<li><a name="a3302"></a>    <span class="src-key">protected </span><span class="src-key">function </span><a href="../PHPonTraxTest/DB_mysql.html#methodgetSpecialQuery">getSpecialQuery</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">)</span></li>
<li><a name="a3303"></a>    <span class="src-sym">{</span></li>
<li><a name="a3304"></a>        <span class="src-key">switch </span><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a3305"></a>            <span class="src-key">case </span><span class="src-str">'tables'</span>:</li>
<li><a name="a3306"></a>                <span class="src-key">return </span><span class="src-str">'SHOW TABLES'</span><span class="src-sym">;</span></li>
<li><a name="a3307"></a>            <span class="src-key">case </span><span class="src-str">'users'</span>:</li>
<li><a name="a3308"></a>                <span class="src-key">return </span><span class="src-str">'SELECT DISTINCT User FROM mysql.user'</span><span class="src-sym">;</span></li>
<li><a name="a3309"></a>            <span class="src-key">case </span><span class="src-str">'databases'</span>:</li>
<li><a name="a3310"></a>                <span class="src-key">return </span><span class="src-str">'SHOW DATABASES'</span><span class="src-sym">;</span></li>
<li><a name="a3311"></a>            <span class="src-key">default</span>:</li>
<li><a name="a3312"></a>                <span class="src-key">return </span><span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a3313"></a>        <span class="src-sym">}</span></li>
<li><a name="a3314"></a>    <span class="src-sym">}</span></li>
<li><a name="a3315"></a><span class="src-sym">}</span></li>
<li><a name="a3316"></a>&nbsp;</li>
<li><a name="a3317"></a><span class="src-comm">// -- set Emacs parameters --</span></li>
<li><a name="a3318"></a><span class="src-comm">// Local variables:</span></li>
<li><a name="a3319"></a><span class="src-comm">// tab-width: 4</span></li>
<li><a name="a3320"></a><span class="src-comm">// c-basic-offset: 4</span></li>
<li><a name="a3321"></a><span class="src-comm">// c-hanging-comment-ender-p: nil</span></li>
<li><a name="a3322"></a><span class="src-comm">// indent-tabs-mode: nil</span></li>
<li><a name="a3323"></a><span class="src-comm">// End:</span></li>
<li><a name="a3324"></a><span class="src-php">?&gt;</span></li>
</ol></pre></div>
</div>
        <div class="credit">
		    <hr />
		    Documentation generated on Thu, 04 May 2006 19:47:30 -0600 by <a href="http://www.phpdoc.org">phpDocumentor 1.3.0RC4</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>
Return current item: PHP on Trax