develooper Front page | perl.dbi.users | Postings from January 2007

RE: Problems using the DBI class to access CSV files.

Thread Previous
From:
Curtis Leach
Date:
January 23, 2007 14:17
Subject:
RE: Problems using the DBI class to access CSV files.
Message ID:
3AEDC2B93FD5EE4899DBBAEC287E502E01ECECE1@ENTCMAIL1A.harrahs.org
 Never mind, after writing up the email I noticed the csv_eol tag &
tried setting it to "\n" for grins, and it solved my problem.


			Curtis Leach


-----Original Message-----
From: Curtis Leach [mailto:cleach@harrahs.com] 
Sent: Tuesday, January 23, 2007 4:06 PM
To: dbi-users@perl.org
Subject: Problems using the DBI class to access CSV files.

I've been using the DBI class for a while now & I'm trying to port some
code from a Windows environment where it is working perfectly to a Unix
environment where it's not really working.  I've also reviewed the Perl
DBI book again & see nothing about this type of problem.  It seems that
it's just the CSV type of database that is having issues.

I'm trying to parse pipe separated log files to search for data so that
actions can be taken based on what I find in the log files.

A sample log file:

TIME|Status|Description|
17:15:51|OK|No Problems|
17:31:12|Warning|Skipped file abc|
18:45:03|ERROR|Can't read file xyz|

Afraid that it might be a bug in my code, I began using "dbish" to test
out my queries.  But I get the same problems as in my code.  I find all
3 rows in Windows, but I always find Zero rows on the Unix platforms.

On Windows:
M:\...\logs>dbish
DBI::Shell 11.91 using DBI 1.49

WARNING: The DBI::Shell interface and functionality are =======  very
likely to change in subsequent versions!

Available DBI drivers:
 1: dbi:CSV
 2: dbi:DBM
 3: dbi:ExampleP
 4: dbi:File
 5: dbi:ODBC
 6: dbi:Proxy
 7: dbi:Sponge
Enter driver name or number, or full 'dbi:...:...' DSN:
DBI:CSV:csv_sep_char=|

Connecting to 'DBI:CSV:csv_sep_char=|' as ''...
@> select * from RMSComprate.060707.log.txt @> ;
TIME,Status,Description, '17:15:51','OK','No Problems'.''
'17:31:12','Warning','Skipped file abc',''
'18:45:03','ERROR','Can't read file xyz',''

[3 rows of 4 fields returned]
@>

But if I attempt to do the same thing against AIX Unix, I get
heisys@het-web1:/.../logs> dbish DBI::Shell 11.93 using DBI 1.52

WARNING: The DBI::Shell interface and functionality are =======  very
likely to change in subsequent versions!

Available DBI drivers:
 1: dbi:CSV
 2: dbi:DBM
 3: dbi:ExampleP
 4: dbi:File
 5: dbi:Multiplex
 6: dbi:Oracle
 7: dbi:Proxy
 8: dbi:Sponge
Enter driver name or number, or full 'dbi:...:...' DSN:
DBI:CSV:csv_sep_char=|

Connecting to 'DBI:CSV:csv_sep_char=|' as ''...
@> select * from test.log
@> ;
TIME,Status,Description,

[0 rows of 4 fields returned]

Can anyone offer suggestions?

Curtis Leach
Programmer Analyst
Harrah's Entertainment, Inc. - RMS  I&AS
Phone: (901) 537-3453
Cell: (901) 573-7973




Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About