title: Parse MySQL queries, including JOINs
body: <p>Is there an already built tool in PHP or Javascript that parses MySQL queries, <strong>including JOINs</strong>.</p>
  
  <p>What I need as a result is simply two arrays:</p>
  
  <p>The first is an array of the Query Result fields. (result[]) 
  The second is an array of the Query Parameters. (params[])</p>
  
  <p>Example: </p>
  
  <pre><code>    Select PersonID,firstName,lastName,countryName
      FROM Person 
      LEFT JOIN Country ON Person.countryID=Country.countryID
  
      Where firstName="Jonathan" and countryName="Canada"
  </code></pre>
  
  <p>Would result in the following:</p>
  
  <pre><code>result=['PersonID','firstName','lastName','countryName'];
  
  params=['firstName','countryName'];
  </code></pre>