title: Extract Drupal encoded data using MySQL from Ubercart table
body: <p>I am writing an integration piece between Drupal/Ubercart and a in-house admin system.</p>
  
  <p>The customer uses Ubercart products with attributes (e.g. a Plaque, which can contain a name, a company, a registration date and month). When an order is placed, the values entered for the attributes are written to <code>uc_order_products</code>, where the <code>data</code> field contains the actual values entered by the user. As far as I can tell, this is the only place where product attributes values, as entered by an end user to place an order, is stored.</p>
  
  <p>The encoded attribute values uses a format seen all over Drupal tables to encode objects:</p>
  
  <pre><code>a:3:{s:10:"attributes";a:4:{s:26:"Name (to appear on plaque)";a:1:{i:0;s:10:"Some  
  Namee";}s:7:"Company";a:1:{i:0;s:28:"Some Company Name Goes here_";}s:19:"Certification 
  Month";a:1:{i:0;s:0:"";}s:18:"Certification Year";a:1:
  {i:0;s:4:"2011";}}s:9:"shippable";s:1:"1";s:6:"module";s:10:"uc_product";}
  </code></pre>
  
  <p>And expanded, it looks like this:</p>
  
  <pre><code>a:3:
  {
      s:10:"attributes";
      a:4:
          {
              s:26:"Name (to appear on plaque)";
              a:1:
                  {
                      i:0;
                      s:10:"Some Namee";
                  }
              s:7:"Company";
              a:1:
                  {
                      i:0;
                      s:28:"Some Company Name Goes Herep";
                  }
              s:19:"Certification Month";
              a:1:
                  {
                      i:0;
                      s:0:"";
                  }
              s:18:"Certification Year";
              a:1:
                  {
                      i:0;
                      s:4:"2011";
                  }
          }
      s:9:"shippable";
      s:1:"1";
      s:6:"module";
      s:10:"uc_product";
  }
  </code></pre>
  
  <p>I there a simple way to get to the individual field values within this text using SQL? I can write a SQL function to go look for specifics, but I'd like to know if someone knows of an existing MySQL approach (perhaps within Drupal) which would do this.</p>
  
  <p>Thanks!</p>