in reply to Perl DBI: problems inserting data to a table

Are the rows that are inserted into the table correct and complete (i.e. with all columns)? Did you confirm that the regex splits the data as you expect?

  • Comment on Re: Perl DBI: problems inserting data to a table

Replies are listed 'Best First'.
Re^2: Perl DBI: problems inserting data to a table
by homeveg (Acolyte) on Nov 20, 2013 at 18:43 UTC
    Yes, all rows are complete. To check RegExp, I was printing each new line and after parsing the data to the DB directly was quering for a new entry using unique ID (index). To check each parsed line I use the following code:
    # Display RexExp results print STDERR join("\t",@arguments),"\n"; <here add all data from @argumens to a DB (as described in the origina +l post)> # check if data parsed successfully my $sql2 = 'SELECT * FROM hist_mod_score WHERE Counts=?'; $sth = $dbh->prepare($sql2) or die $dbh->errstr; $sth->execute($index) or die $sth->errstr; # dump fetched query results $sth->dump_results if $sth->{NUM_OF_FIELDS};
    In the output I've got the following:
    0 SM_Th2_1_K27ac SM Th2 1 K27ac Tbx21-1 4.8878613 +2768108e-10 0 rows 1 SM_Th2_1_K27ac SM Th2 1 K27ac Tbx21-2 3.8016699 +2152973e-10 0 rows ... 120 SM_Th2_2_K9me3 SM Th2 2 K9me3 Tbx21-21 4.1899 +3008961981e-10 '120', 'SM_Th2_2_K9me3', 'SM', 'Th2', '2', 'K9me3', 'Tbx21-21', '4.189 +93008961981e-10' 1 rows
Re^2: Perl DBI: problems inserting data to a table
by homeveg (Acolyte) on Nov 21, 2013 at 16:15 UTC
    I have found the problem. I've replaced a Storable DB driver with a SQLite driver and my code is now working.
    my $dbh = DBI->connect('dbi:SQLite:dbname=hist_mod.db');
    I am not sure what was the reason to my problems with Storable DB, but for my task it does not meter which type of DB to use.

    Thanks to everybody for your help and suggestions