diff options
author | admin <devnull@localhost> | 2006-09-30 01:26:28 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-30 01:26:28 +0200 |
commit | 3ed8c51254a5b26d951fa675802fcf69adf9638e (patch) | |
tree | 8e5f5af90a7e73f4b1a55f78fa3542f5cb156cfa /user_guide/database/utilities.html | |
parent | 051402b4c281cf125c9b369b682128aaefb587cd (diff) |
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>
|