title: SQL Truncate Error when Inserting UUID
body: <p>I'm building a database driven PHP application that uses UUID's to store each row of data. The application currently generates the UUID's using the following query:</p>
  
  <pre><code>    SELECT UUID()
  </code></pre>
  
  <p>which generates an output similar to <code>84058227-294c-11e3-916a-7a7919b2b2bc</code>.</p>
  
  <p>Many online sources suggest that UUID's be stored in <code>BINARY(16)</code> to improve overall application performance. But when I attempt to insert the UUID into the database, I receive the following error:</p>
  
  <pre><code>    Warning: #1265 Data truncated for column 'x' at row x
  </code></pre>
  
  <p>I realize that this error occurred because the UUID was too large for the column to store, and that this issue can be easily fixed by simply increasing the amount of characters the column may store (ex: <code>BINARY(20)</code>), but I fear that doing so may reduce the application's performance in the future.</p>
  
  <p>Considering that so many online sources suggest using <code>BINARY(16)</code> to store UUID's, I'm assuming that I have made a mistake.</p>
  
  <p>Could someone please point me in the right direction?</p>
  
  <p>For extra information, here is the code I'm using (in PHP) to insert data into the database:</p>
  
  <pre><code>    //PDO Query
      $this-&gt;query(
          INSERT INTO users
              (
                  user_id,        //the UUID is stored in this column
                  taxonomy_id,
                  user_email,
                  user_password,
                  user_salt,
                  user_activation_key,
                  user_is_administrator
              )
              VALUES(?,?,?,?,?,?,?)
              ',
              array(
                  $this-&gt;uuid(),    //method that generates UUID
                  $taxonomy_id,
                  $user_email,
                  $user_password,
                  $user_salt,
                  $user_activation_key,
                  $user_is_administrator
              )
          )
      );
  </code></pre>
  
  <p>and the method that generates each UUID:</p>
  
  <pre><code>    public function uuid()
      {
          $uuid = $this-&gt;query("SELECT UUID() AS uuid");
          return $uuid[0]['uuid'];
      }
  </code></pre>