Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution is to ensure that you are using the <strong>mysqlnd</strong> driver for php.</p> <h2>How do you know that you're not using mysqlnd?</h2> <p>When viewing <code>php -i</code>, there will be <em>no</em> mention of "mysqlnd". The <code>pdo_mysql</code> section will have something like this:</p> <pre><code>pdo_mysql PDO Driver for MySQL =&gt; enabled Client API version =&gt; 5.1.72 </code></pre> <h2>How do you install it?</h2> <p>Most installation guides for L/A/M/P suggest <code>apt-get install php5-mysql</code> but the native driver for MySQL is installed by a different package: <code>php5-mysqlnd</code>. I found that this was available with the <strong>ppa:ondrej/php5-oldstable</strong>.</p> <p>To switch to the new driver (on Ubuntu):</p> <ul> <li>Remove the old driver:<br> <code>apt-get remove php5-mysql</code></li> <li>Install the new driver:<br> <code>apt-get install php5-mysqlnd</code></li> <li>Restart apache2:<br> <code>service apache2 restart</code></li> </ul> <h2>How do I check that the driver is being used?</h2> <p>Now <code>php -i</code> will mention "mysqlnd" explicitly in the <code>pdo_mysql</code> section:</p> <pre><code>pdo_mysql PDO Driver for MySQL =&gt; enabled Client API version =&gt; mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $ </code></pre> <h2>PDO settings</h2> <p>Ensure that <code>PDO::ATTR_EMULATE_PREPARES</code> is <code>false</code> (check your defaults or set it):<br> <code>$pdo-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);</code></p> <p>Ensure that <code>PDO::ATTR_STRINGIFY_FETCHES</code> is <code>false</code> (check your defaults or set it):<br> <code>$pdo-&gt;setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);</code></p> <h2>Returned values</h2> <ul> <li>Floating-point types (FLOAT, DOUBLE) are returned as PHP floats.</li> <li>Integer types (INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT †) are returned as PHP integers.</li> <li>Fixed-Point types (DECIMAL, NUMERIC) are returned as strings.</li> </ul> <p>† BIGINTs with a value greater than a 64 bit signed int (9223372036854775807) will return as a string (or 32 bits on a 32 bit system)</p> <pre><code> object(stdClass)[915] public 'integer_col' =&gt; int 1 public 'double_col' =&gt; float 1.55 public 'float_col' =&gt; float 1.5 public 'decimal_col' =&gt; string '1.20' (length=4) public 'bigint_col' =&gt; string '18446744073709551615' (length=20) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload