File: testconnspeed.pl

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 (27 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (11)
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
#!perl -w

use strict;
use DBI;
use Benchmark qw(timethese cmpthese timeit countit timestr);

my %conns = (
	     DBD_ORACLE => sub { doconnect("dbi:Oracle:URLWINLT"); },
	     DBD_ODBC_ORACLE => sub { doconnect("dbi:ODBC:PERL_TEST_ORACLE"); },
	     DBD_ODBC_MSORACLE => sub { doconnect("dbi:ODBC:PERL_TEST_MSORACLE"); },
	     DBD_ODBC_SQLSERVER => sub { doconnect("dbi:ODBC:PERL_TEST_SQLSERVER"); },
	     DBD_ODBC_DB2 => sub { doconnect("dbi:ODBC:PERL_TEST_DB2"); },
	     DBD_ODBC_ACCESS => sub { doconnect("dbi:ODBC:PERL_TEST_ACCESS"); },
	    );

sub doconnect ($) {
   my $connstr = shift;
   my $dbh = DBI->connect($connstr,
                          $ENV{DBI_USER},
                          $ENV{DBI_PASS},
                          { RaiseError => 1, PrintError => 1 }
   ) || die "Can't connect with $connstr: $DBI::errstr";
}

timethese 100, \%conns;

cmpthese 100, \%conns;