<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;h2&gt;Usage&lt;/h2&gt;
&lt;h2&gt;Constants&lt;/h2&gt;
&lt;h2&gt;Properties&lt;/h2&gt;
&lt;h2&gt;Methods&lt;/h2&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;build&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;build&lt;/b&gt;()&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Builds the final query string&lt;br /&gt;
return {str} &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; query string&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;by&amp;lt;Column_Name&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;by&amp;lt;Column_Name&amp;gt;&lt;/b&gt;($val)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Magic method to add &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; filters for building the final query string. Replace &lt;Column_Name&gt; with the name of the column to filter on. (e.g., byPost_ID for column &amp;#8216;post_id&amp;#8217;). Column type validation is enforced if enabled.&lt;br /&gt;
param {mixed} Simple value, &lt;span class=&quot;caps&quot;&gt;CSV&lt;/span&gt; or array of values to filter on&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;from&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;from&lt;/b&gt;($table)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Sets the table name to build a query for&lt;br /&gt;
param {str} Table name&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;group&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;group&lt;/b&gt;($group_str)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Stores a &lt;span class=&quot;caps&quot;&gt;GROUP&lt;/span&gt; BY clause (minus the &amp;#8216;&lt;span class=&quot;caps&quot;&gt;GROUP&lt;/span&gt; BY&amp;#8217;) for building the final query string.&lt;br /&gt;
param {str} &lt;span class=&quot;caps&quot;&gt;GROUP&lt;/span&gt; BY clause&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;limit&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;limit&lt;/b&gt;($count[, $start = 0])&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Creates and stores a &lt;span class=&quot;caps&quot;&gt;LIMIT&lt;/span&gt; clause for building the final query string.&lt;br /&gt;
param {int} Number of results to limit the result set to (must be greater than 0)&lt;br /&gt;
param {int} Starting result set row (must be greater than or equal to 0, default value is 0)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;order&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;order&lt;/b&gt;($order_str)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Stores an &lt;span class=&quot;caps&quot;&gt;ORDER&lt;/span&gt; BY clause (minus the &amp;#8216;&lt;span class=&quot;caps&quot;&gt;ORDER&lt;/span&gt; BY&amp;#8217; part) for building the final query string&lt;br /&gt;
param {str} &lt;span class=&quot;caps&quot;&gt;ORDER&lt;/span&gt; BY clause&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;querytype&lt;/b&gt;&lt;br/&gt;
&lt;small&gt;public &lt;b&gt;querytype&lt;/b&gt;($type)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Takes in a type of query that is going to be built and verifies that it is on the approved list of query types. Since the query type determines the allowed calls and final query building logic, this should be the first call made.&lt;br /&gt;
param {str} Type of query to run&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;select&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;select&lt;/b&gt;($fields)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Takes in a &lt;span class=&quot;caps&quot;&gt;CSV&lt;/span&gt; string or array of database fields. (e.g., &amp;#8216;field1, field2 AS bar, &lt;acronym title=&quot;*&quot;&gt;&lt;span class=&quot;caps&quot;&gt;COUNT&lt;/span&gt;&lt;/acronym&gt; as mycount&amp;#8217;, or array(&amp;#8216;field1&amp;#8217;, &amp;#8216;field2&amp;#8217;, &amp;#8216;&lt;acronym title=&quot;*&quot;&gt;&lt;span class=&quot;caps&quot;&gt;COUNT&lt;/span&gt;&lt;/acronym&gt; AS mycount&amp;#8217;))&lt;br /&gt;
param {mixed} array or &lt;span class=&quot;caps&quot;&gt;CSV&lt;/span&gt; of database fields&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;set&amp;lt;Column_Name&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;set&amp;lt;Column_Name&amp;gt;&lt;/b&gt;($val)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Magic method to add &lt;span class=&quot;caps&quot;&gt;SET&lt;/span&gt; field values for building the final query string. Replace &lt;Column_Name&gt; with the name of the column to set a value for on. (e.g., setPost_ID for column &amp;#8216;post_id&amp;#8217;). Column type validaiton is enforced if enabled.&lt;br /&gt;
param {mixed} Scalar value&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;method&quot;&gt;
&lt;p&gt;&lt;b&gt;where&lt;/b&gt;&lt;br /&gt;
&lt;small&gt;public &lt;b&gt;where&lt;/b&gt;($where_str)&lt;/small&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left:20px;&quot;&gt;&lt;br /&gt;
Stores a raw &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; clause (minus the &amp;#8216;&lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt;&amp;#8217;) for building the final query string&lt;br /&gt;
param {str} &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; clause&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</body>
  <created-at type="datetime">2008-03-27T22:33:48-07:00</created-at>
  <id type="integer">6333</id>
  <permalink>querybuilder</permalink>
  <repository-id type="integer">1902</repository-id>
  <title>QueryBuilder</title>
  <updated-at type="datetime">2008-04-18T19:49:50-07:00</updated-at>
  <user-id type="integer">1816</user-id>
</wiki>
