Re: :CSV and multi character separator
- From: jeff@xxxxxxxxxxxxxx
- Date: Fri, 27 Apr 2007 16:59:47 +0000
Hmm, I was only half lazy. I put the version supporting multi-character record-separators here :
http://svn.perl.org/modules/DBD-CSV/trunk/
Please test it and if it works I'll CPAN it.
P.S. Phillip is correct about Text-CSV_XS. I accomplished this with a kludge - I do the record chopping in Perl and the CSV parsing in Text::CSV_XS.
--
Jeff
-----Original Message-----
From: jeff@xxxxxxxxxxxxxx [mailto:jeff@xxxxxxxxxxxxxx]
Sent: Friday, April 27, 2007 04:50 PM
To: 'Santosh Pathak', 'Garrett, Philip (MAN-Corporate)', dbi-users@xxxxxxxxx
Subject: Re: :CSV and multi character separator
From: Santosh Pathak [mailto:pathaksantosh@xxxxxxxxx]
Yes. Author has mentioned about its availability in next version. But I was
wondering how it is not yet released because comment was made in 2005..
I am a bad boy. I added the code for that and didn't CPAN it. I will do so today.
I would like to use a DBI that works on flat files (with custom separator
i.e. |++|) and supports following,
Custom separator coming today.
1. Multiple joins in single SELECT statement (Note its not just one LEFT or
RIGHT, there could be multiple joins)
There are two ways you can currently join multiple tables, neither is optimal - a) use non-explicit joins e.g. FROM foo,bar,baz WHERE ... or b) use a temporary table to join foo and bar and then join baz against that, ad infinitum.
2. Tables having self relationship
Again, temporary tables is the only current solution.
3. Supports Table aliases (Not a hard requirement)
That is already available with or without an AS - FROM foo AS bar / FROM foo bar - both alias the table foo to the table bar.
I tried DBD::AnyData, DBD::CSV, DBD::RAM but none of them meet my
requirements.
Not surprisingly - they all three use SQL::Statement (also by me) for their SQL engine.
Does somebody know any DBD for flat files that will meet above requirements?
No, sorry, but patches and collaborators welcome.
--
Jeff
Thanks
- Santosh
On 4/27/07, Garrett, Philip (MAN-Corporate) <Philip.Garrett@xxxxxxxxxxx>
wrote:
Santosh Pathak wrote:
Hi,http://www.annocpan.org/~JZUCKER/DBD-CSV-0.22/lib/DBD/CSV.pm<http://www.
I read on following site that DBD::CSV supports multi-character
separator. But I am not able to use it. my separator is |++|
annocpan.org/%7EJZUCKER/DBD-CSV-0.22/lib/DBD/CSV.pm>
Even after setting sep_char to |++|, it doesn't work.
Am I missing something?
The current released version of DBD::CSV does not support this. The
author says he's added support to the next version, but I don't see it
on CPAN yet.
The problem is that DBD::CSV uses Text::CSV_XS to parse the CSV files --
and that module does not support multi-char separators. The newer
version (not yet released) allows you to specify your own CSV parser,
bypassing that limitation.
- Philip
.
- Prev by Date: DBI AND DBD-ORACLE
- Next by Date: Re: DBI AND DBD-ORACLE
- Previous by thread: Re: :CSV and multi character separator
- Next by thread: DBI AND DBD-ORACLE
- Index(es):