php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #2931 A request to add greater CSV file support
Submitted: 1999-12-07 13:07 UTC Modified: 2002-01-27 01:30 UTC
From: dswhite42 at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 OS: IBM AIX 4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dswhite42 at yahoo dot com
New email:
PHP Version: OS:

 

 [1999-12-07 13:07 UTC] dswhite42 at yahoo dot 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=\r\n;"
   . "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!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 13:54 UTC] jimw@php.net
refiling against 4.0.
 [2001-06-08 07:18 UTC] cynic@php.net
Looks like more of a candidate for a PEAR class. You're welcome to implement it. :)
 [2002-01-27 01:30 UTC] sterling@php.net
This is more of a feature request for PEAR's DB.php...  Your welcome to implement it, still, not a PHP feature request (at least not one to be implemented).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 16:01:38 2024 UTC