File: rt_63550.t

package info (click to toggle)
libdbd-odbc-perl 1.37-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,272 kB
  • sloc: perl: 7,932; ansic: 5,991; makefile: 33; sql: 8
file content (43 lines) | stat: -rw-r--r-- 776 bytes parent folder | download
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
39
40
41
42
43
#!/usr/bin/perl -w -I./t
# $Id: rt_63550.t 14569 2010-12-14 16:20:49Z mjevans $
#
# rt_53550 - check Statement is accessible in error handler from do method
#
use Test::More;
use strict;

use DBI qw(:sql_types);
use_ok('ODBCTEST');

my $dbh;

BEGIN {
   if (!defined $ENV{DBI_DSN}) {
      plan skip_all => "DBI_DSN is undefined";
   }
}

$dbh = DBI->connect();
unless($dbh) {
   BAIL_OUT("Unable to connect to the database $DBI::errstr\nTests skipped.\n");
   exit 0;
}
$dbh->{RaiseError} = 0;
$dbh->{PrintError} = 0;
$dbh->{ShowErrorStatement} = 0;

sub _err_handler {

    my ($error, $h) = @_;

    ok(defined($h->{Statement}), 'Statement is defined');

    return 0;

}
$dbh->{HandleError} = \&_err_handler;

$dbh->do("select * from PERL_DBD_RT63550");

done_testing();