From e1770339a3c89d53b99529ae6a639e5c3dd0fd66 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 27 Sep 2006 00:30:58 +0000 Subject: --- user_guide/database/export.html | 158 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 user_guide/database/export.html (limited to 'user_guide') diff --git a/user_guide/database/export.html b/user_guide/database/export.html new file mode 100644 index 000000000..3672bcba1 --- /dev/null +++ b/user_guide/database/export.html @@ -0,0 +1,158 @@ + + + + +Code Igniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

Code Igniter User Guide Version 1.5.0

+
+ + + + + + + + + +
+ + + +
+ + + +
+ +

Database Export Class

+ +

The Database Utilities Class contains functions that help you export your data.

+ +

Important:  This class must be initialized independently since it is a separate class from the main Database class. +More info below...

+ + +

Initializing the Export Class

+ +

To initialize this class please use the following code:

+ +$this->load->dbexport() + +

You can also autoload this class from within your config/autoload.php file by specifying dbexport in the $autoload['libraries'] array.

+ +

Once initialized you will access the functions using the $this->dbexport object:

+ +$this->dbexport->some_function() + + + +

$this->dbexport->cvs_from_result($db_result)

+ +

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:

+ + +$this->load->dbexport();
+
+$query = $this->db->query("SELECT * FROM mytable");
+
+echo $this->dbexport->cvs_from_result($query); +
+ +

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: + + +$delimiter = ",";
+$newline = "\r\n";
+
+echo $this->dbexport->cvs_from_result($query, $delimiter, $newline); +
+ +

Important:  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 File Helper.

+ + + +

$this->dbexport->xml_from_result($db_result)

+ +

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:

+ + +$this->load->dbexport();
+
+$query = $this->db->query("SELECT * FROM mytable");
+
+$config = array (
+                  'root'    => 'root',
+                  'element' => 'element',
+                  'newline' => "\n",
+                  ';tab'    => "\t"
+                );
+
+echo $this->dbexport->cvs_from_result($query, $config); +
+ +

Important:  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 File Helper.

+ + + + + +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b