Thread aus mehreren Arrays in DB schreiben
(6 answers)
Opened by Gast at 2008-06-05 12:14
Klar...
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 use DBI; my @a1 = (...); my @a2 = (...); my @a3 = (...); my @a4 = (...); my $max = größe des größten arrays; my $dbh = DBI->connect(...) or die $DBI::errstr; my $stmt = qq~INSERT INTO tabelle(spalte1,spalte2,spalte3,spalte4) VALUES(?,?,?,?);~; my $sth = $dbh->prepare( $stmt ) or die $dbh->errstr; for my $i ( 0 .. $max ){ $sth->execute( $a1[$i], $a2[$i], $a3[$i], $a4[$i] ) or die $dbh->errstr; } $sth->finish; $dbh->disconnect; OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/) -- Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html Perl-Entwicklung: http://perl-services.de/ |