PHP Classes

File: readmeFirst.txt

Recommend this page to a friend!
  Classes of Michal Palma  >  CSV to SQL database converter  >  readmeFirst.txt  >  Download  
File: readmeFirst.txt
Role: Documentation
Content type: text/plain
Description: Read me
Class: CSV to SQL database converter
Import data from a CSV file into a database
Author: By
Last change: Little change
Date: 16 years ago
Size: 1,850 bytes


Class file image Download
* Class converts CSV content to DB table
* @package Csv2Db
* @date 2005-08-08

- convert CSV files as table to database
- as flexible as possible
- easily and separately configured idealy by XML file

- PHP 5 needed
- Class DbControl needed - You can find it at in archiv of Author Michal Palma
- Class Xml2Array needed - You can find it at in archiv of Author Michal Palma
- Class Csv needed - You can find it at in archiv of Author Michal Palma

- fulfil dependencies higher
- Check all includes in _preload.php
- configure database connection and other in config.xml in DbControl package for task csv2db. (Actual DbControl/config.xml does contain it, You must only reconfigure connection parameters)
- try "___case_of_use.php"
- if You want to parse big table, you will must specify higher "max_execution_time" for longer script run in Csv2Db/config.xml. This attributes are exclusive for concrete table.

*How to use it?
 First you must create an instance of Csv2Db class with essential parameters.
 - For example: $instance = new Csv2Db("test.csv", $separator = ";", $charset = "utf8", $useconfig = true).
 Then you must only call $instance->dbWrite().
 If there is some problem, library will throw standard PHP5 exception.
 If not, You can call $instance->getRowsCount() for get how much rows did file contents.
 Thanks to DbControl class you can use any from supported Database platforms (in v1.3: MySQL, MSSQL, ODBC). You can choose between them by change attributtes in DbControl/config.xml whithout any change of code.
All converting process is closed into transaction.

*Projected improvements on next versions
- performance optimalization

Some cases of use are defined in ___case_of_use.php.
For more information send a message to info at phpclasses dot org.