diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-06-06 16:41:29 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:50 +0000 |
commit | 7c48e67cf07ee41bfde7139a62bb232bd23a4a48 (patch) | |
tree | 6d7686b5075bd5cba253dabf2e6c302acb3a147c /ex/profile.pl | |
download | perl-dbi-tarball-master.tar.gz |
Diffstat (limited to 'ex/profile.pl')
-rw-r--r-- | ex/profile.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ex/profile.pl b/ex/profile.pl new file mode 100644 index 0000000..96df9ae --- /dev/null +++ b/ex/profile.pl @@ -0,0 +1,25 @@ +#!/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__ |