Re: :CSV and multi character separator

Re: :CSV and multi character separator

am 27.04.2007 18:50:20 von jeff

> 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 separat=
or
> i.e. |++|) and supports following,
>

Custom separator coming today.

> 1. Multiple joins in single SELECT statement (Note its not just one LEF=
T or
> RIGHT, there could be multiple joins)

There are two ways you can currently join multiple tables, neither is opt=
imal - a) use non-explicit joins e.g. FROM foo,bar,baz WHERE ... or b) us=
e a temporary table to join foo and bar and then join baz against that, a=
d 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 the=
ir SQL engine.

> Does somebody know any DBD for flat files that will meet above requirem=
ents?
>

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 ww.
> > 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 i=
t
> > 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
> >
>