On Tue, 14 Jun 2005, Vijay Kumar Adhikari wrote:

> Thank you. That helped. I get the data as output from another program.
> Is [there] any way that I need not save it the output in a temp file
> and directly pipe it to DBD:CSV.

Hmm.

It might be possible, but it's probably more trouble than it's worth.
When calling on DBI, you have to select your database driver (in this
case, the previously mentioned DBD::CSV) and, in turn, provide the
driver with a DSN (Data Source Name) with relevant connection
information (typically, things like the database server host, a
username/password pair, and any other parameters the DBD requires).

With DBD::CSV, you have to provide a file name. It may be possible to
fake this, using maybe a named pipe or something, but it seems like it
would probably be more trouble than it's worth. Unless the files are
huge and you don't have the disc space for them, it's probably easier to
just cache the file and then load that into DBI/DBD::CSV.

Alternatively, you could use Text::CSV (or the faster but otherwise
identical Text::CSV_XS) for generic CSV processing. It might be easier
to get this to work with a pipe, but you lose the SQL tricks that would
be available the other way, so you'd have to sort that out manually.


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to