This file is indexed.

/usr/share/doc/libdbd-odbc-perl/examples/multiple_active_stmts.pl is in libdbd-odbc-perl 1.56-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/perl
# $Id$
# Various ways of enabling Multiple Active Statements support in
# MS SQL Server - what you use depends on your driver.
#
use strict;
use DBI;
use Data::Dumper;

my $attrs = { RaiseError => 1, PrintError => 0, AutoCommit => 1 };

my %connect_args = (DSN => 'dbi:ODBC:DSN=baugi',
                    USER => 'sa',
                    PASS => undef);

my $dbhmakers = {
  normal => sub {
    DBI->connect (
      (map { $connect_args{"$_"} } (qw/DSN USER PASS/) ),
      $attrs,
    );
  },
  MARs => sub {
    local $connect_args{DSN} = $connect_args{DSN} . ';MARS_Connection=Yes';
    DBI->connect (
      (map { $connect_args{$_} } (qw/DSN USER PASS/) ),
      $attrs,
    );
  },
  server_cursors_hack => sub {
    DBI->connect (
      (map { $connect_args{$_} } (qw/DSN USER PASS/) ),
      { %$attrs, odbc_SQL_ROWSET_SIZE => 2 },
    );
  },
  cursor_type => sub {
    DBI->connect (
      (map { $connect_args{$_} } (qw/DSN USER PASS/) ),
      { %$attrs, odbc_cursortype => 2 },
    );
  },
};

for (sort keys %$dbhmakers) {
  print "\n\nTrying with $_\n";

  my $dbh = $dbhmakers->{$_}->();
  $dbh->{odbc_SQL_ROWSET_SIZE} = 2;
  eval { $dbh->do ('DROP TABLE test_foo') };
  $dbh->do ('CREATE TABLE test_foo ( bar VARCHAR(20) )');

  $dbh->do ("INSERT INTO test_foo (bar) VALUES ( 'baz_$_' )")
    for (1..5);

  eval {
    my @sths;
    push @sths, $dbh->prepare("SELECT * FROM test_foo") for (1..5);
    $_->execute for @sths;

    LOOP:
    while (1) {
      for (0 .. $#sths) {
        my $res = $sths[$_]->fetchrow_arrayref
          or last LOOP;
        print "Result from sth $_: $res->[0]\n";
      }
    }
  };
  warn "Died with $@\n" if $@;

  eval { $dbh->do ('DROP TABLE test_foo') };
}

__END__