File: testundef.pl

package info (click to toggle)
libdbd-odbc-perl 1.50-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,392 kB
  • ctags: 496
  • sloc: perl: 8,818; ansic: 6,376; makefile: 33; sql: 8
file content (38 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#perl -w
# $Id$

use DBI;

my $dbh = DBI->connect()
	or die "$DBI::errstr\n";


eval {
   # if it's not already created, the eval will silently ignore this
   $dbh->do("drop table longtest;");
};

$dbh->do("create table hashtest (id integer, value varchar2(200))");

my %foo;

$foo{1} = "bless me";

DBI->trace(9,"c:/trace.txt");
my $sth = $dbh->prepare("insert into hashtest values (?, ?)");
$sth->execute((2, $foo{2}));
$sth->execute((1, $foo{1}));

my $sth2 = $dbh->prepare("select id, value from hashtest order by id");
$sth2->execute;
my @row;
while (@row = $sth2->fetch) {
   print join(', ', @row), "\n";
}





$dbh->disconnect;