in reply to Re^2: Using perl to parse a file and update values into a database
in thread Using perl to parse a file and update values into a database
Looks OK. Would help if you can post your test data file. (UPDATE: I see the file. But It looks like each section is a record, not a table.)
You should always use placeholders in your calls to DBI.
my $sql; foreach my $table (sort keys %$config) { my $sql = qq{ insert into $table ( id, balance ) values ( ?, ? ) }; my $sth = $dbh->prepare( $sql ); while (my ($col, $val) = each %{$config->{$table}}) { $sth->execute( $col, $val ); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using perl to parse a file and update values into a database
by bhushanQA (Sexton) on Jul 08, 2015 at 11:13 UTC | |
|
Re^4: Using perl to parse a file and update values into a database
by bhushanQA (Sexton) on Jul 08, 2015 at 11:25 UTC | |
|
Re^4: Using perl to parse a file and update values into a database
by bhushanQA (Sexton) on Jul 08, 2015 at 11:56 UTC | |
by 1nickt (Canon) on Jul 08, 2015 at 12:18 UTC |