diff options
Diffstat (limited to 'user_guide/database/utilities.html')
-rw-r--r-- | user_guide/database/utilities.html | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index e23f1f575..b064c7983 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -193,6 +193,61 @@ if ($result !== FALSE)<br /> +<h2>$this->dbutil->cvs_from_result($db_result)</h2>
+
+<p>Permits you to generate a CVS file from a query result. The first parameter of the function must contain the result object from your query.
+Example:</p>
+
+<code>
+$this->load->dbutil();<br />
+<br />
+$query = $this->db->query("SELECT * FROM mytable");<br />
+<br />
+echo $this->dbutil->cvs_from_result($query);
+</code>
+
+<p>The second and third parameters allows you to
+set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:
+
+<code>
+$delimiter = ",";<br />
+$newline = "\r\n";<br />
+<br />
+echo $this->dbutil->cvs_from_result($query, $delimiter, $newline);
+</code>
+
+<p class="important"><strong>Important:</strong> This function will NOT write the CVS file for you. It simply creates the CVS layout.
+If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
+
+
+
+<h2>$this->dbutil->xml_from_result($db_result)</h2>
+
+<p>Permits you to generate an XML file from a query result. The first parameter expects a query result object, the second
+may contain an optional array of config parameters. Example:</p>
+
+<code>
+$this->load->dbutil();<br />
+<br />
+$query = $this->db->query("SELECT * FROM mytable");<br />
+<br />
+$config = array (<br />
+ 'root' => 'root',<br />
+ 'element' => 'element', <br />
+ 'newline' => "\n", <br />
+ ';tab' => "\t"<br />
+ );<br />
+<br />
+echo $this->dbutil->cvs_from_result($query, $config);
+</code>
+
+<p class="important"><strong>Important:</strong> This function will NOT write the CVS file for you. It simply creates the CVS layout.
+If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
+
+
+
+
+
</div>
<!-- END CONTENT -->
@@ -204,7 +259,7 @@ Previous Topic: <a href="call_function.html">Custom Function Calls</a ·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
-Next Topic: <a href="export.html">Database Export Class</a>
+Next Topic: <a href="caching.html">Database Caching Class</a>
<p>
<p><a href="http://www.codeigniter.com">Code Igniter</a> · Copyright © 2006 · <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
</div>
|