Hello, DBI users,

   I'm brand new to this list, almost as new to DBI
(~2 months), and not quite as new as that to Perl (~1
year). I've started my DBI experimentation using the
DBD::CSV driver, with the thought that it's easier as
a human to development with text data files, where one
can view and manipulate the data directly with an
editor when necessary. I'll probably move the app I'm
writing to mySQL for production use.

   However, I'm experiencing some limitations and odd
behavior with DBD::CSV, which I don't see addressed in
the perldoc. The problem I'm currently struggling with
concerns the comparison operators used on text fields.
For example, I have a data file called "Shows" which
lists a theatre show title, beginning date, and ending
date, among others. I'm storing dates as text of
format YYYY-MM-DD, on the theory that this format is
both readable by humans and also should sort correctly
by the DB engine. However, DBD::CSV does not seem to
be processing it correctly. I run the following
queries with the following results:

C>perl test.pl "SELECT Title, EndDate FROM Shows"

Statement to execute: "SELECT Title, EndDate FROM
Shows"

Results:
----
Steel Magnolias,2002-04-17
----
The Sound of Music,2002-08-04
----
Two One-Acts,2002-10-05

C>perl test.pl "SELECT Title, EndDate FROM Shows WHERE
EndDate >= '2002-07-01'

Statement to execute: "SELECT Title, EndDate FROM
Shows WHERE EndDate >= '2002-07-01'"

Results:
----
Steel Magnolias,2002-04-17
----
The Sound of Music,2002-08-04
----
Two One-Acts,2002-10-05

C>perl test.pl "SELECT Title, EndDate FROM Shows WHERE
EndDate > '2002-07-01'

Statement to execute: "SELECT Title, EndDate FROM
Shows WHERE EndDate > '2002-07-01'"

Results:


As you see, the ">=" operator doesn't filter out the
first one as it should, and the ">" is improperly
filtering out all of them. I also have a similar
problem with these operators on my "People" table,
when I select on any normal text field, such as last
name. So I don't think it is restricted to my
pseudo-date fields.

I can provide the source to test.pl as well as the
contents of the data file, if desired. Has anyone else
ever had similar problems?

- John Brooking


=====
"Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do." - They Might Be Giants, http://www.tmbg.com

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

Reply via email to