Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

dbd anydata does not return the correct result set

by sajohn52 (Initiate)
on Aug 23, 2007 at 17:25 UTC ( [id://634689]=perlquestion: print w/replies, xml ) Need Help??

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' }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://634689]
Approved by Limbic~Region
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found