|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/doc/perl-DBI-1.52/ex/ |
Upload File : |
#!/usr/bin/perl -w
use DBI;
$dbh = DBI->connect('dbi:SQLite:dbname=ex_profile.db', '', '', { RaiseError => 1 });
$dbh->do("DROP TABLE IF EXISTS ex_profile");
$dbh->do("CREATE TABLE ex_profile (a int)");
$dbh->do("INSERT INTO ex_profile (a) VALUES ($_)", undef) for 1..100;
#$dbh->do("INSERT INTO ex_profile (a) VALUES (?)", undef, $_) for 1..100;
my $select_sql = "SELECT a FROM ex_profile";
$dbh->selectall_arrayref($select_sql);
$dbh->selectall_hashref($select_sql, 'a');
my $sth = $dbh->prepare($select_sql);
$sth->execute;
while ( @row = $sth->fetchrow_array ) {
}
__DATA__