Subversion Repositories php_library

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 20
Line 68... Line 68...
68
          </td>
68
          </td>
69
          <td>
69
          <td>
70
             An SQL select statement with with optional parameters 
70
             An SQL select statement with with optional parameters 
71
          </td>
71
          </td>
72
          <td>
72
          <td>
73
             Parameters are of the form &lt;<em>parameter_name</em>&gt;, where the &lt; and &gt; are delimiters. parameter_name must be alphanumeric 
73
             Parameters are of the form &lt;<em>parameter_name</em>&gt;, where the &lt; and &gt; are delimiters. parameter_name must be alphanumeric. See note below for a special, runtime parameter to limit the same report based upon programmatic input.
74
          </td>
74
          </td>
75
        </tr>
75
        </tr>
76
        <tr>
76
        <tr>
77
          <td>
77
          <td>
78
             parameters 
78
             parameters 
Line 87... Line 87...
87
             parameters is a single line for each parameter in the column query. The line contains 4 values, delimited by the special sequence <em>++</em>, but delimiter may be redefined using the parametersDelimiter setter/getter in the QueryParameters class. See below for more information on this column 
87
             parameters is a single line for each parameter in the column query. The line contains 4 values, delimited by the special sequence <em>++</em>, but delimiter may be redefined using the parametersDelimiter setter/getter in the QueryParameters class. See below for more information on this column 
88
          </td>
88
          </td>
89
        </tr>
89
        </tr>
90
      </tbody>
90
      </tbody>
91
    </table>
91
    </table>
-
 
92
    <p><strong>Special Parameters</strong>: the special parameter &lt;additionalLimitations&gt;, is provided to allow a program to filter more limited information based upon the user running the report. For example, if a user should only see a subset of the total report, and a second user see a different subset, this parameter will allow runtime modification of this. To use this parameter, you must do the two following things:</p>
-
 
93
   <ul>
-
 
94
      <li>In your query, surround all of your where clause (exclusive of the keyword <em>where</em>) in parentheses. At the outside of this block, place the special token &lt;additionalLimitations&gt;</li>
-
 
95
      <li>In your call to Report->run, include the first parameter (empty, if need be), then pass the additional values to be use to limit in the second parameter.</li>
-
 
96
   </ul>
-
 
97
    <p>Examples below assume &lt;additionalLimitations&gt; is set to <em>(owner_id=5)</em></p>
-
 
98
   <table width="100%" border="1">
-
 
99
  <caption>&lt;additionalLimitations&gt; Parameter Example</caption>
-
 
100
  <thead bgcolor="lightGray">
-
 
101
    <tr>
-
 
102
      <th>Query</th>
-
 
103
      <th>Result</th>
-
 
104
    </tr>
-
 
105
  </thead>
-
 
106
  <tbody>
-
 
107
    <tr>
-
 
108
      <td>select * from table1 where ( table1.col1  = 'joe' ) &lt;additionalLimitations&gt;</td>
-
 
109
      <td>select * from table1 where ( table1.col1  = 'joe' )  and (owner_id=5)</td>
-
 
110
    </tr>
-
 
111
    <tr>
-
 
112
      <td>select lastname,firstname from address where (zip_code in ('75214','75206'))&lt;additionalLimitations&gt;</td>
-
 
113
      <td>select lastname,firstname from address where (zip_code in ('75214','75206')) and (owner_id=5)</td>
-
 
114
    </tr>
-
 
115
    <tr>
-
 
116
      <td>select username, permissions from login where (login like '%rodo%)select lastname,firstname from address where (zip_code in ('75214','75206'))&lt;additionalLimitations&gt;</td>
-
 
117
      <td>select username, permissions from login where (login like '%rodo%)select lastname,firstname from address where (zip_code in ('75214','75206')) and (owner_id=5)</td>
-
 
118
    </tr>
-
 
119
  </tbody>
-
 
120
</table>
-
 
121
<p><em>Note that if no parameter is passed in, &lt;additionalLimitations&gt; is set to the empty string so the above queries are still valid.</em></p>
92
    <h3>
122
    <h3>
93
       parameters column 
123
       parameters column 
94
    </h3>
124
    </h3>
95
    <p>
125
    <p>
96
       The parameters column is actually a series of one or more lines, with each line corresponding to one parameter in the query column. Each line (parameter entry) consists of four values, delimited by the special string <em>++</em> (this may be redefined by QueryParameters->parametersDelimiter). The four values are defined in the following table 
126
       The parameters column is actually a series of one or more lines, with each line corresponding to one parameter in the query column. Each line (parameter entry) consists of four values, delimited by the special string <em>++</em> (this may be redefined by QueryParameters->parametersDelimiter). The four values are defined in the following table