<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Trex Framework - The PHP5 Web Framework for professional Web Developers</title>
	<link>http://trex.fedecarg.com</link>
	<description>A lightweight and easy-to-use PHP5 framework!</description>
	<pubDate>Wed, 02 Nov 2016 17:58:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>Creole</title>
		<link>http://trex.fedecarg.com/creole/</link>
		<comments>http://trex.fedecarg.com/creole/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 16:10:33 +0000</pubDate>
		<dc:creator>Federico</dc:creator>
		
		<category><![CDATA[Class Reference]]></category>

		<guid isPermaLink="false">http://trex.phpimpact.com/creole/</guid>
		<description><![CDATA[Description
Creole is inspired by Java&#8217;s JDBC API.  If you are familiar with this API, then no doubt much of this will look similar.
Class Methods
Please visit the Creole Webiste for more information.
General Usage
Example: Using Creole API

$conn = self::creole&#40;&#41;;

// prepared statement
$stmt = $conn-&#62;prepareStatement&#40;&#34;SELECT * FROM `news_items` WHERE group_id = ?&#34;&#41;;
$stmt-&#62;setInt&#40;1, $groupId&#41;;
$stmt-&#62;setLimit&#40;10&#41;;
$stmt-&#62;setOffset&#40;5&#41;;

$stmt-&#62;executeQuery&#40;&#41;;

The first parameter to !Model::creole() is [...]]]></description>
			<content:encoded><![CDATA[<h3>Description</h3>
<p>Creole is inspired by Java&#8217;s JDBC API.  If you are familiar with this API, then no doubt much of this will look similar.</p>
<h3>Class Methods</h3>
<p>Please visit the <a href="http://creole.phpdb.org/trac/wiki/Documentation/CreoleGuide" target="_blank">Creole Webiste</a> for more information.</p>
<h3>General Usage</h3>
<p><strong>Example: Using Creole API</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$conn</span> = self::<span style="color: #006600;">creole</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// prepared statement</span>
<span style="color: #0000ff;">$stmt</span> = <span style="color: #0000ff;">$conn</span>-&gt;<span style="color: #006600;">prepareStatement</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SELECT * FROM `news_items` WHERE group_id = ?&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$stmt</span>-&gt;<span style="color: #006600;">setInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">$groupId</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$stmt</span>-&gt;<span style="color: #006600;">setLimit</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$stmt</span>-&gt;<span style="color: #006600;">setOffset</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #0000ff;">$stmt</span>-&gt;<span style="color: #006600;">executeQuery</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p>The first parameter to !Model::creole() is a flags parameter. The following flags are currently supported by Creole:</p>
<table class="wiki">
<tr>
<td width="250"><strong>Flag</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td valign="top">self::PERSISTENT</td>
<td valign="top">Open persistent database connection</td>
</tr>
<tr>
<td valign="top">self::COMPAT_ASSOC_LOWER</td>
<td valign="top">Always lowercase the indexes of assoc arrays (returned by functions like *_fetch_assoc())</td>
</tr>
<tr>
<td valign="top">self::COMPAT_RTRIM_STRING</td>
<td valign="top">Trim whitepace from end of string column types</td>
</tr>
<tr>
<td valign="top">self::COMPAT_ALL</td>
<td valign="top">Enable all compatibility constants</td>
</tr>
</table>
<p>These flags are bits, so you may specify more than one by adding (or using bitwise | operator) them together. Example:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$conn</span> = self::<span style="color: #006600;">creole</span><span style="color: #66cc66;">&#40;</span>self::<span style="color: #006600;">PERSISTENT</span> | self::<span style="color: #006600;">COMPAT_ASSOC_LOWER</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>Getting Column Values</strong></p>
<p>The default method to get column values is to use the appropriate get*() method for the column data type.  E.g. use getString() to return data from a CHAR/VARCHAR/TEXT column.  Creole will perform any unescaping and type conversions. For example:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns PHP string</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns PHP int/long</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns formatted date</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getTimestamp</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;stamp&quot;</span>, <span style="color: #ff0000;">&quot;m/d/y H:i:s&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>You can also use the generic !ResultSet::get() method, if you do not want to perform any type conversions on the data you are returning:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot; (&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;)&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>And finally, you can also use the getRow() to return an associative array of the current row:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$row</span> = <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getRow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #0000ff;">$key</span> . <span style="color: #ff0000;">&quot;: &quot;</span> . <span style="color: #0000ff;">$value</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p><strong>Scrolling ResultSet Methods</strong></p>
<p>Scrolling ResultSet features are supported well in MySQL, PostgreSQL, and SQLite. For Oracle, however, this behaviour has to be emulated. For this reason, reverse scrolling is not currently supported in Oracle.</p>
<div class="ch_code_container" style="height:100%;">
<pre>
<span style="color: #808080; font-style: italic;">// Move to first record</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">first</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Move ahead 3 rows</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">relative</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Scroll backwards</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">previous</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Move to last position</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">last</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>ResultSetIterator</strong></p>
<p>In addition to using the traditional scrolling functions, you can also use an SPL Iterator to iterate over the query results. Some drivers (e.g. SQLite) have optimized iterators that will be as fast or faster than the traditional scrolling methods.</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// $row is an assoc array</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">print_r</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>This method of iterating over a ResultSet exists for convenience, and does not provide any type-conversion methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://trex.fedecarg.com/creole/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Database_Wrapper_Creole</title>
		<link>http://trex.fedecarg.com/database_wrapper_creole/</link>
		<comments>http://trex.fedecarg.com/database_wrapper_creole/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 20:25:08 +0000</pubDate>
		<dc:creator>Federico</dc:creator>
		
		<category><![CDATA[Class Reference]]></category>

		<guid isPermaLink="false">http://trex.phpimpact.com/database_wrapper_creole/</guid>
		<description><![CDATA[Description
The Creole Wrapper class provides methods for interacting with Creole easily and securely.
Class Methods
select ( string statement [, array placeholder] )
mixed
Executes the SQL SELECT statement in a PreparedStatement object and returns the ResultSet generated by the query.
insert ( string table_name, array record [, bool on_duplicate_key_update] )
mixed
Executes the SQL INSERT statement in a PreparedStatement object.
update ( [...]]]></description>
			<content:encoded><![CDATA[<h3>Description</h3>
<p>The Creole Wrapper class provides methods for interacting with Creole easily and securely.</p>
<h3>Class Methods</h3>
<p><strong>select </strong>( string statement [, array placeholder] )</p>
<blockquote><p><em>mixed</em><br />
Executes the SQL SELECT statement in a PreparedStatement object and returns the ResultSet generated by the query.</p></blockquote>
<p><strong>insert </strong>( string table_name, array record [, bool on_duplicate_key_update] )</p>
<blockquote><p><em>mixed</em><br />
Executes the SQL INSERT statement in a PreparedStatement object.</p></blockquote>
<p><strong>update </strong>( string table_name, array record, array where_clause )</p>
<blockquote><p><em>mixed</em><br />
Executes the SQL UPDATE statement in a PreparedStatement object.</p></blockquote>
<p><strong>delete </strong>( string table_name, array where_clause )</p>
<blockquote><p><em>mixed</em><br />
Executes the SQL DELETE statement in a PreparedStatement object.</p></blockquote>
<p><strong>selectAndPaginate </strong>( string statement, int current_page [, int results_per_page] )</p>
<blockquote><p><em>mixed</em><br />
Executes the SQL SELECT statement in a PreparedStatement object, add the LIMIT clause and returns the resultset generated by the query.</p></blockquote>
<p><strong>getTotalRows </strong>()</p>
<blockquote><p><em>int</em><br />
Returns the total number of rows returned by the last executed query.</p></blockquote>
<p><strong>getInsertId </strong>()</p>
<blockquote><p><em>int</em><br />
Returns the last inserted id.</p></blockquote>
<p><strong>getLastQuery </strong>()</p>
<blockquote><p><em>string</em><br />
Returns the last executed query.</p></blockquote>
<h3>General Usage</h3>
<p><strong>Example: SELECT prepared statement</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$statement</span> = <span style="color: #ff0000;">&quot;SELECT * FROM `news_items` WHERE `year` = ? AND `group_id` = ?&quot;</span>;
<span style="color: #0000ff;">$placeholder</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;2007&quot;</span>, <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Returns a resultset on success or false on failure</span>
<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">db</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">select</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$statement</span>, <span style="color: #0000ff;">$placeholder</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p>You should always use the &#8220;?&#8221; place holder to add values to a statement, as this will prevent SQL injection attacks by ensuring that data is converted to the proper type, and when appropriate escaped and quoted.</p>
<p><strong>Example: INSERT</strong><strong> prepared statement</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$fields</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;user_id&quot;</span> =&gt; <span style="color: #cc66cc;">12</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;activation_key&quot;</span> =&gt; <span style="color: #ff0000;">&quot;38su2373js92&quot;</span>
<span style="color: #66cc66;">&#41;</span>;

<span style="color: #0000ff;">$onDuplicateKeyUpdate</span> = <span style="color: #000000; font-weight: bold;">true</span>;

<span style="color: #808080; font-style: italic;">// Returns the affected rows on success or false on failure</span>
<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">db</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;activation_code&quot;</span>, <span style="color: #0000ff;">$field</span>, <span style="color: #0000ff;">$onDuplicateKeyUpdate</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>Example: UPDATE</strong><strong> prepared statement</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$fields</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;password&quot;</span> =&gt; <span style="color: #0000ff;">$userId</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;salt&quot;</span> =&gt; <span style="color: #0000ff;">$activationCode</span>
<span style="color: #66cc66;">&#41;</span>;

<span style="color: #0000ff;">$where</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;statement&quot;</span> =&gt; <span style="color: #ff0000;">&quot;`user_id` = ?&quot;</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;placeholder&quot;</span> =&gt; <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Return the affected rows on success or false on failure</span>
<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">db</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;user&quot;</span>, <span style="color: #0000ff;">$fields</span>, <span style="color: #0000ff;">$where</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>Example: DELETE</strong><strong> prepared statement</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$where</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;statement&quot;</span> =&gt; <span style="color: #ff0000;">&quot;`user_id` = ? AND `user_id` = ?&quot;</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;placeholder&quot;</span> =&gt; <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">13</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Returns the affected rows on success or false on failure</span>
<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">db</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">delete</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;users&quot;</span>, <span style="color: #0000ff;">$where</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>Getting Column Values</strong></p>
<p>The default method to get column values is to use the appropriate get*() method for the column data type.  E.g. use getString() to return data from a CHAR/VARCHAR/TEXT column.  Creole will perform any unescaping and type conversions. For example:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns PHP string</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns PHP int/long</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #808080; font-style: italic;">// returns formatted date</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;n&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getTimestamp</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;stamp&quot;</span>, <span style="color: #ff0000;">&quot;m/d/y H:i:s&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>You can also use the generic !ResultSet::get() method, if you do not want to perform any type conversions on the data you are returning:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot; (&quot;</span> . <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;)&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>And finally, you can also use the getRow() to return an associative array of the current row:</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$row</span> = <span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">getRow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #0000ff;">$key</span> . <span style="color: #ff0000;">&quot;: &quot;</span> . <span style="color: #0000ff;">$value</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p><strong>Scrolling ResultSet Methods</strong></p>
<p>Scrolling ResultSet features are supported well in MySQL, PostgreSQL, and SQLite. For Oracle, however, this behaviour has to be emulated. For this reason, reverse scrolling is not currently supported in Oracle.</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #808080; font-style: italic;">// Move to first record</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">first</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Move ahead 3 rows</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">relative</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Scroll backwards</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">previous</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Move to last position</span>
<span style="color: #0000ff;">$rs</span>-&gt;<span style="color: #006600;">last</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>ResultSetIterator</strong></p>
<p>In addition to using the traditional scrolling functions, you can also use an SPL Iterator to iterate over the query results. Some drivers (e.g. SQLite) have optimized iterators that will be as fast or faster than the traditional scrolling methods.</p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// $row is an assoc array</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">print_r</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>This method of iterating over a ResultSet exists for convenience, and does not provide any type-conversion methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://trex.fedecarg.com/database_wrapper_creole/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend_Mail</title>
		<link>http://trex.fedecarg.com/zend_mail/</link>
		<comments>http://trex.fedecarg.com/zend_mail/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 19:25:53 +0000</pubDate>
		<dc:creator>Federico</dc:creator>
		
		<category><![CDATA[Class Reference]]></category>

		<guid isPermaLink="false">http://trex.phpimpact.com/zend_mail/</guid>
		<description><![CDATA[Description
Zend_Mail, supported by Zend_Mime, creates and sends e-mail messages with the format text or HTML. Zend_Mime is a support set for handling multipart MIME messages. Zend_Mail allows e-mail to be sent in an easy form while preventing mail injection.
General Usage
Example: Simple email with Zend_Mail 

$mail = new Zend_Mail&#40;&#41;;
$mail-&#62;setBodyText&#40;&#34;This is the text of the mail&#34;&#41;;
$mail-&#62;setFrom&#40;&#34;somebody@example.com&#34;, &#34;Some [...]]]></description>
			<content:encoded><![CDATA[<h3>Description</h3>
<p>Zend_Mail, supported by Zend_Mime, creates and sends e-mail messages with the format text or HTML. Zend_Mime is a support set for handling multipart MIME messages. Zend_Mail allows e-mail to be sent in an easy form while preventing mail injection.</p>
<h3>General Usage</h3>
<p><strong>Example: Simple email with Zend_Mail </strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;This is the text of the mail&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Sender&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">addTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody_else@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Recipient&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Test Subject&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p>For security reasons, Zend_Mail filters all header fields to prevent header injection with newline (\n) characters. You also can use most methods of the Zend_Mail object with a convenient fluent interface. A fluent interface means that each method returns a reference to the object on which it was called, so you can immediately call another method.</p>
<p><strong>Example: Zend_Mail fluent interface </strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;This is the text of the mail.&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp; &nbsp; -&gt;<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody@example.com&#8217;, &#8216;Some Sender&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp; &nbsp; -&gt;<span style="color: #006600;">addTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody_else@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Recipient&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp; &nbsp; -&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;TestSubject&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp; &nbsp; -&gt;<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p>Zend_Mail messages can be sent via SMTP, so Zend_Mail_Transport_SMTP needs to be created and registered with Zend_Mail before the send() method is called.</p>
<p><strong>Example: Sending email via SMTP </strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$tr</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail_Transport_Smtp<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mail.example.com&quot;</span><span style="color: #66cc66;">&#41;</span>
Zend_Mail::<span style="color: #006600;">setDefaultTransport</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tr</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;This is the text of the mail.&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Sender&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">addTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody_else@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Recipient&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Test Subject&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><strong>Example: Sending multiple emails per SMTP connection.</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$tr</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail_Transport_Smtp<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mail.example.com&quot;</span><span style="color: #66cc66;">&#41;</span>;
Zend_Mail::<span style="color: #006600;">setDefaultTransport</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tr</span><span style="color: #66cc66;">&#41;</span>;

<span style="color: #0000ff;">$tr</span>-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$i</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$i</span> &lt; <span style="color: #cc66cc;">5</span>; <span style="color: #0000ff;">$i</span>++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;This is the text of the mail.&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Sender&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">addTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody_else@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Recipient&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Test Subject&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0000ff;">$tr</span>-&gt;<span style="color: #006600;">disconnect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p>To send an e-mail in HTML format, set the body using the method setBodyHTML() instead of setBodyText(). The MIME content type will automatically be set to text/html then. If you use both HTML and Text bodies, a multipart/alternative MIME message will automatically be generated:</p>
<p><strong>Example: Sending an HTML email</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;My Nice Test Text&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyHtml</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;My Nice Test Text&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Sender&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">addTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;somebody_else@example.com&quot;</span>, <span style="color: #ff0000;">&quot;Some Recipient&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;TestSubject&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><a href="http://framework.zend.com/manual/en/zend.mail.html" target="_blank">Learn more about Zend_Mail </a></p>
]]></content:encoded>
			<wfw:commentRss>http://trex.fedecarg.com/zend_mail/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cache_File</title>
		<link>http://trex.fedecarg.com/cache/</link>
		<comments>http://trex.fedecarg.com/cache/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 20:03:42 +0000</pubDate>
		<dc:creator>Federico</dc:creator>
		
		<category><![CDATA[Class Reference]]></category>

		<guid isPermaLink="false">http://trex.phpimpact.com/cache/</guid>
		<description><![CDATA[Description
The Cache component is a little cache system. It&#8217;s optimized for high traffic websites so it is really fast and safe, it uses file locking and/or anti-corruption tests.
This component was originally developed by Fabien Marty.
General usage
Every module of Cache follows the same philosophy. Parameters, others than default ones, are set using the setOptions() method. A [...]]]></description>
			<content:encoded><![CDATA[<h3>Description</h3>
<p>The Cache component is a little cache system. It&#8217;s optimized for high traffic websites so it is really fast and safe, it uses file locking and/or anti-corruption tests.</p>
<p>This component was originally developed by Fabien Marty.</p>
<h3>General usage</h3>
<p>Every module of Cache follows the same philosophy. Parameters, others than default ones, are set using the setOptions() method. A cache file is identified by a cache ID (and eventually a group). For obvious flexibility reasons, the logic of ID&#8217;s choice is left to the developer.</p>
<p><strong>Example: The data is built then recovered in an unique variable</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #808080; font-style: italic;">// Set a id for this cache</span>
<span style="color: #0000ff;">$id</span> = <span style="color: #ff0000;">&quot;123&quot;</span>;

<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Data found: &quot;</span> . <span style="color: #0000ff;">$data</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;No valid cache found. Saving data&quot;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p><strong>Example: Setting options</strong></p>
<div class="ch_code_container" style="height:100%;">
<pre><span style="color: #808080; font-style: italic;">// This options are set by default</span>
<span style="color: #0000ff;">$options</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
&nbsp; &nbsp; <span style="color: #ff0000;">&quot;cacheDir&quot;</span> =&gt; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">getCacheDir</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
&nbsp; &nbsp; <span style="color: #ff0000;">&quot;lifeTime&quot;</span> =&gt; <span style="color: #000066;">intval</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">24</span>*<span style="color: #cc66cc;">60</span>*<span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span>,
<span style="color: #66cc66;">&#41;</span>;

<span style="color: #808080; font-style: italic;">// Set options</span>
<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">setOptions</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$options</span><span style="color: #66cc66;">&#41;</span>;</pre>
</div>
<p><span> </span></p>
<h3>Available options</h3>
<p>You can use the setOptions() method to pass an associative array as an argument and set any of the following options:</p>
<p><strong>cacheDir: </strong>/cache<br />
string</p>
<p>Directory where to put the cache file (with a trailing slash at the end).</p>
<p><strong>caching: </strong>TRUE<br />
boolean</p>
<p>Enable / disable caching.</p>
<p><strong>lifeTime: </strong>24*60*60<br />
integer</p>
<p>Cache lifetime in seconds (you can use a null value for an eternal cache lifetime).</p>
<p><strong>fileLocking:</strong> TRUE<br />
boolean</p>
<p>Enable / disable file locking. Can avoid cache corruption under bad circumstances.</p>
<p><strong>writeControl: </strong>TRUE<br />
boolean</p>
<p>Enable / disable write control. Enable write control will lightly slow the cache writing but not the cache reading. Write control can detect some corrupt cache files but maybe it&#8217;s not a perfect control.</p>
<p><strong>readControl: </strong>TRUE<br />
boolean</p>
<p>Enable / disable read control. If enabled, a control key is embeded in cache file and this key is compared with the one calculated after the reading.</p>
<p><strong>readControlType: </strong>crc32<br />
string</p>
<p>Type of read control (only if read control is enabled). Must be &#8216;md5&#8242; (for a md5 hash control (best but slowest)), &#8216;crc32&#8242; (for a crc32 hash control (lightly less safe but faster)) or &#8217;strlen&#8217; (for a length only test (fastest)).</p>
<p><strong>fileNameProtection: </strong>TRUE<br />
boolean</p>
<p>File Name protection (if set to true, you can use any cache id or group name, if set to false, it can be faster but cache ids and group names will be used directly in cache file names so be careful with special characters).</p>
<p><strong>automaticSerialization: </strong>FALSE<br />
boolean</p>
<p>Enable / disable automatic serialization (it can be used to save directly data&#8217;s which aren&#8217;t strings but it&#8217;s slower).</p>
<p><strong>memoryCaching:</strong> FALSE<br />
boolean</p>
<p>Enable / disable &#8220;Memory Caching&#8221; (NB : there is no lifetime for memory caching, only the end of the script).</p>
<p><strong>onlyMemoryCaching:</strong> FALSEboolean</p>
<p>Enable / disable &#8220;Only Memory Caching&#8221; (if enabled, files are not used any more).</p>
<p><strong>memoryCachingLimit</strong>: 1000<br />
integer</p>
<p>Max number of records to store into memory caching.</p>
<p><strong>automaticCleaningFactor</strong>: 0<br />
integer</p>
<p>Disable / Tune the automatic cleaning process. The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written. 0 means &#8220;no automatic cache cleaning&#8221;, 1 means &#8220;systematic cache cleaning&#8221; (slow), x&gt;1 means &#8220;automatic cleaning randomly 1 times on x cache writes&#8221;. A value between 20 and 200 is maybe a good start.</p>
<p><strong>hashedDirectoryLevel</strong>: 0<br />
integer</p>
<p>Set the hashed directory structure level. 0 means &#8220;no hashed directory structure&#8221;, 1 means &#8220;one level of directory&#8221;, 2 means &#8220;two levels&#8221;&#8230; This option can speed up Cache only when you have many thousands of cache file.</p>
]]></content:encoded>
			<wfw:commentRss>http://trex.fedecarg.com/cache/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
