1Data::Printer::Filter::UDsBe(r3)Contributed Perl DocumenDtaattai:o:nPrinter::Filter::DB(3)
2
3
4

NAME

6       Data::Printer::Filter::DB - pretty-printing database objects (DBI,
7       DBIx::Class, etc)
8

SYNOPSIS

10       In your ".dataprinter" file:
11
12           filters = DB
13
14       You may also customize the look and feel with the following options
15       (defaults shown):
16
17           ### DBH settings:
18
19           # expand database handle objects
20           filter_db.connection_details = 1
21
22
23           ### DBIx::Class settings:
24
25           # signal when a result column is dirty:
26           filter_db.show_updated_label = 1
27
28           # signal when result rows contain extra columns:
29           filter_db.show_extra_label = 1
30
31           # override class.expand for schema dump
32           filter_db.schema.expand = 1
33
34           # expand DBH handle on schema dump (may touch DB)
35           filter_db.schema.show_handle = 0
36
37           # show source details (connected tables) on schema dump
38           # (may be set to 'names', 'details' or 'none')
39           filter_db.schema.loaded_sources = names
40
41           # show source table name ResultSource objects
42           filter_db.show_source_table = 1
43
44           # show source columns ('names', 'details' or 'none'):
45           filter_db.column_info = details
46
47           # this plugin honors theme colors where applicable
48           # and provides the following custom colors for you to use:
49           colors.filter_db_connected    = #a0d332
50           colors.filter_db_disconnected = #b3422d
51
52       That's it!
53

DESCRIPTION

55       This is a filter plugin for Data::Printer that displays (hopefully)
56       more relevant information on database objects than a regular dump.
57
58   Parsed Modules
59       DBI
60
61       If it's a database handle, for example, this filter may show you
62       something like this:
63
64           SQLite Database Handle (connected) {
65               dbname: file.db
66               Auto Commit: 1
67               Statement Handles: 2 (1 active)
68               Last Statement: SELECT * FROM some_table
69           }
70
71       You can show less information by setting this option on your
72       ".dataprinter":
73
74           filter_db.connection_details = 0
75
76       If you have a statement handler like this (for example):
77
78           my $sth = $dbh->prepare('SELECT * FROM foo WHERE bar = ?');
79           $sth->execute(42);
80
81           use DDP; p $sth;
82
83       This is what you'll get:
84
85           SELECT * FROM foo WHERE bar = ?  (42)
86
87       Note that if your driver does not support holding of parameter values,
88       you'll get a "bindings unavailable" message instead of the bound
89       values.
90
91       DBIx::Class
92
93       This filter is able to pretty-print many common DBIx::Class objects for
94       inspection. Unless otherwrise noted, none of those calls will touch the
95       database.
96
97       DBIx::Class::Schema objects are dumped by default like this:
98
99           MyApp::Schema {
100               connection: MySQL Database Handle (connected)
101               replication lag: 4
102               loaded sources: ResultName1, ResultName2, ResultName3
103           }
104
105       If your ".dataprinter" settings have "class.expand" set to 0, it will
106       only show this:
107
108           MyApp::Schema (MySQL - connected)
109
110       You may override this with "filter_db.schema.expand = 1" (or 0).  Other
111       available options for the schema are (default values shown):
112
113           # if set to 1, expands 'connection' into a complete DBH dump
114           # NOTE: this may touch the database as it could try to reconnect
115           # to fetch a healthy DBH:
116           filter_db.schema.show_handle = 0
117
118           # set to 'details' to view source details, or 'none' to skip it:
119           filter_db.schema.loaded_sources = names
120
121       DBIx::Class::ResultSource objects will be expanded to show details of
122       what that source represents on the database (as perceived by
123       DBIx::Class), including column information and whether the table is
124       virtual or not.
125
126           User ResultSource {
127               table: "user"
128               columns:
129                   user_id integer not null auto_increment (primary),
130                   email varchar(100),
131                   bio text
132               non-primary uniques:
133                   (email) as 'user_email'
134           }
135
136       Ever got bit by DBIx::Class?
137
138       Let us know if we can help by creating an issue on Data::Printer's
139       Github.  Patches are welcome!
140

SEE ALSO

142       Data::Printer
143
144
145
146perl v5.36.0                      2022-08-01      Data::Printer::Filter::DB(3)
Impressum