Lines 486-492
sub load_sql {
Link Here
|
486 |
my $table_name = ( keys %$table )[0]; # table name |
486 |
my $table_name = ( keys %$table )[0]; # table name |
487 |
my @rows = @{ $table->{$table_name}->{rows} }; # |
487 |
my @rows = @{ $table->{$table_name}->{rows} }; # |
488 |
my @columns = ( sort keys %{$rows[0]} ); # column names |
488 |
my @columns = ( sort keys %{$rows[0]} ); # column names |
489 |
my $fields = join ",", @columns; # idem, joined |
489 |
my $fields = join ",", map{sprintf("`%s`", $_)} @columns; # idem, joined |
490 |
my $placeholders = join ",", map { "?" } @columns; # '?,..,?' string |
490 |
my $placeholders = join ",", map { "?" } @columns; # '?,..,?' string |
491 |
my $query = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )"; |
491 |
my $query = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )"; |
492 |
my $sth = $dbh->prepare($query); |
492 |
my $sth = $dbh->prepare($query); |
493 |
- |
|
|