PHP 4.0 Bug #2931 Updated: A request to add greater CSV file support
| From: | jimw@php.net | Date: | Sat, 10 Feb 2001 18:54:08 +0000 |
| Subject: | PHP 4.0 Bug #2931 Updated: A request to add greater CSV file support | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-46210@lists.php.net to get a copy of this message | ||
ID: 2931
Updated by: jimw
Reported By: dswhite42@yahoo.com
Status: Open
Bug Type: Feature/Change Request
Assigned To:
Comments:
refiling against 4.0.
Previous Comments:
---------------------------------------------------------------------------
[1999-12-07 13:07:32] dswhite42@yahoo.com
One of the many plugins for Perl's DBI module is the DBD::CSV module. This allows users to
treat a CSV file as if it were a real database. Instead of manually reading a file line-by-line and
parsing it to find the fields I want, I can write code like this:
$dbh = DBI->connect("DBI:CSV:f_dir=/foo/bar;"
. "csv_eol=rn;"
. "csv_sep_char=t;");
$sth = $dbh->prepare("SELECT * from foo where fn='Dave'");
$sth->execute();
$dbh->do("DELETE from foo where fn='Dave'");
The advantage of this is primarily:
- easier code to write, and
- easy portability to a real database later (almost as simple as changing all references from
DBD:CSV to DBD:MySQL)
I know PHP4 is moving in the direction of a DBI-like solution, and that's great. In the
meantime, would it be possible to add CSV "database" support to PHP? (csv_connect,
csv_query, csv_fetch_array, etc.) to simulate the operations of a database on a CSV file?
Thanks!
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=2931&edit=2