sajohn52 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl gurus I have a pipe delimited flat file with about 85 fields and and four hundred rows. After writing a small script using DBD:AnyData I noticed that the result data set returned from a simple query returned some colums as NULL values when there was actuall data in the column. The problem is not consistant either becuase if the query is modified by either adding or deleteing column names then the colum that showed NULL will show the data value. I was wonder if anyone else has had a similiar problem with DBD:AnyData or know of a workaround to this problem? Code snipped below.

my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):'); $dbh->func( 'DBTable', 'Pipe', "db.txt", $col_nm, 'ad_catalog' ) ; my $sth = $dbh->prepare( $sql ) ; $sth->execute() ; where $sql = select col1 , col2 , col3 , ... , colN from Depcorr where col1 = '12345' and $col_nm { col_names => 'col1,col2,col3,...colN' } ;

Unfortunately I am unable to display the columns name I actually used because of security reasons. TIA

Replies are listed 'Best First'.
Re: dbd anydata does not return the correct result set
by andyford (Curate) on Aug 23, 2007 at 18:00 UTC

    With that many rows and columns, I'd be afraid of losing count trying to compare the output with the original unless I carefully programmed the output routine. Can you show us the part of your program where you show the selected data? Maybe it's just something simple in the output method.

    non-Perl: Andy Ford

Re: dbd anydata does not return the correct result set
by jZed (Prior) on Aug 24, 2007 at 03:03 UTC
    The docs are confusing on this point, but try specifying the column names in the same format as the data, in this case Pipe separated:
    { col_names => 'col1|col2|col3|...colN' }