~ubuntu-branches/ubuntu/edgy/libdbi-perl/edgy

« back to all changes in this revision

Viewing changes to t/80proxy.t

  • Committer: Bazaar Package Importer
  • Author(s): Christian Hammers
  • Date: 2006-01-09 22:09:07 UTC
  • mfrom: (0.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20060109220907-pxxc985dyxgm7qha
Tags: 1.50-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
    or die "Failed to create config file $config_file: $!";
76
76
 
77
77
my($handle, $port);
78
 
my $numTests = 119;
 
78
my $numTests = 125;
79
79
if (@ARGV) {
80
80
    $port = $ARGV[0];
81
81
} else {
107
107
    ($handle, $port) = Net::Daemon::Test->Child($numTests, @child_args);
108
108
}
109
109
 
110
 
my @opts = ('peeraddr' => '127.0.0.1', 'peerport' => $port, 'debug' => 1);
111
 
my $dsn = "DBI:Proxy:hostname=127.0.0.1;port=$port;debug=1;dsn=DBI:ExampleP:";
 
110
my $debug = ($ENV{DBI_TRACE}) ? 1 : 0;
 
111
my $dsn = "DBI:Proxy:hostname=127.0.0.1;port=$port;debug=$debug;dsn=DBI:ExampleP:";
112
112
 
113
113
print "Making a first connection and closing it immediately.\n";
114
 
Test(eval { DBI->connect($dsn, '', '', { 'PrintError' => 0 }) })
 
114
Test(eval { DBI->connect($dsn, '', '', { 'PrintError' => 1 }) })
115
115
    or print "Connect error: " . $DBI::errstr . "\n";
116
116
 
117
117
print "Making a second connection.\n";
136
136
Test($@ eq "BANG!!!\n", "\$@ value lost");
137
137
 
138
138
print "Doing a ping.\n";
139
 
Test($dbh->ping);
 
139
$_ = $dbh->ping;
 
140
Test($_);
 
141
Test($_ eq '2'); # ping was DBD::ExampleP's ping
 
142
 
 
143
print "Ensure CompatMode enabled.\n";
 
144
Test($dbh->{CompatMode});
140
145
 
141
146
print "Trying local quote.\n";
142
147
$dbh->{'proxy_quote'} = 'local';
229
234
Test($row_b->{size} == $row_a[1]);
230
235
Test($row_b->{name} eq $row_a[2]);
231
236
 
 
237
print "Trying fetchrow_hashref with FetchHashKeyName.\n";
 
238
do {
 
239
#local $dbh->{TraceLevel} = 9;
 
240
local $dbh->{FetchHashKeyName} = 'NAME_uc';
 
241
Test($dbh->{FetchHashKeyName} eq 'NAME_uc');
 
242
my $csr_c = $dbh->prepare("select mode,size,name from ?");
 
243
Test($csr_c->execute($dir), $DBI::errstr);
 
244
$row_b = $csr_c->fetchrow_hashref;
 
245
Test($row_b);
 
246
print "row_b: @{[ %$row_b ]}\n";
 
247
Test($row_b->{MODE} eq $row_a[0]);
 
248
};
 
249
 
232
250
print "Trying finish.\n";
233
251
Test($csr_a->finish);
234
252
#Test($csr_b->finish);