1Test::Database::Handle(U3s)er Contributed Perl DocumentatTieosnt::Database::Handle(3)
2
3
4
6 Test::Database::Handle - A class for Test::Database handles
7
9 use Test::Database;
10
11 my $handle = Test::Database->handle(@requests);
12 my $dbh = $handle->dbh();
13
15 Test::Database::Handle is a very simple class for encapsulating the
16 information about a test database handle.
17
18 Test::Database::Handle objects are used within a test script to obtain
19 the necessary information about a test database handle. Handles are
20 obtained through the "Test::Database->handles()" or
21 "Test::Database->handle()" methods.
22
24 Test::Database::Handle provides the following methods:
25
26 new
27 Return a new Test::Database::Handle with the given parameters ("dsn",
28 "username", "password").
29
30 The only mandatory argument is "dsn".
31
33 The following accessors are available.
34
35 dsn
36 Return the Data Source Name.
37
38 username
39 Return the connection username. Defaults to "undef".
40
41 password
42 Return the connection password. Defaults to "undef".
43
44 connection_info
45 Return the connection information triplet ("dsn", "username",
46 "password").
47
48 my ( $dsn, $username, $password ) = $handle->connection_info;
49
50 dbh
51 my $dbh = $handle->dbh;
52 my $dbh = $handle->dbh( $attr );
53
54 Return the DBI database handle obtained when connecting with the
55 connection triplet returned by "connection_info()".
56
57 The optional parameter $attr is a reference to a hash of connection
58 attributes, passed directly to DBI's "connect()" method.
59
60 name
61 Return the database name attached to the handle.
62
63 dbd
64 Return the DBI driver name, as computed from the "dsn".
65
66 driver
67 Return the Test::Database::Driver object attached to the handle.
68
70 Philippe Bruhat (BooK), "<book@cpan.org>"
71
73 Copyright 2008-2010 Philippe Bruhat (BooK), all rights reserved.
74
76 This module is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79
80
81perl v5.36.0 2022-07-22 Test::Database::Handle(3)