Re: :CSV and multi character separator
am 27.04.2007 18:59:47 von jeffHmm, 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 kl=
udge - I do the record chopping in Perl and the CSV parsing in Text::CSV_=
XS.
--
Jeff
> -----Original Message-----
> From: jeff@vpservices.com [mailto:jeff@vpservices.com]
> Sent: Friday, April 27, 2007 04:50 PM
> To: 'Santosh Pathak', 'Garrett, Philip (MAN-Corporate)', dbi-users@perl=
..org
> Subject: Re: :CSV and multi character separator
>
>
> > From: Santosh Pathak [mailto:pathaksantosh@gmail.com]
> >
> > 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 separ=
ator
> > i.e. |++|) and supports following,
> >
>
> Custom separator coming today.
>
> > 1. Multiple joins in single SELECT statement (Note its not just one L=
EFT or
> > RIGHT, there could be multiple joins)
>
> There are two ways you can currently join multiple tables, neither is o=
ptimal - 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 / FRO=
M 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 t=
heir SQL engine.
>
> > Does somebody know any DBD for flat files that will meet above requir=
ements?
> >
>
> No, sorry, but patches and collaborators welcome.
>
> --
> Jeff
>
> > Thanks
> > - Santosh
> >
> > On 4/27/07, Garrett, Philip (MAN-Corporate)
> > wrote:
> > >
> > > Santosh Pathak wrote:
> > > > Hi,
> > > >
> > > > I read on following site that DBD::CSV supports multi-character
> > > > separator. But I am not able to use it. my separator is |++|
> > > >
> > > http://www.annocpan.org/~JZUCKER/DBD-CSV-0.22/lib/DBD/CSV.pm
> > > 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. Th=
e
> > > 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 fil=
es --
> > > and that module does not support multi-char separators. The newer
> > > version (not yet released) allows you to specify your own CSV parse=
r,
> > > bypassing that limitation.
> > >
> > > - Philip
> > >
> >
>
>
>