Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / doc / libdbi-perl / examples / | server ip : 172.67.156.115 your ip : 141.101.99.29 H O M E |
Filename | /usr/share/doc/libdbi-perl/examples/profile.pl |
Size | 594 |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:10 |
Last modified | 06-Nov-2013 01:12 |
Last accessed | 07-Jul-2025 02:34 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/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__
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__