Provided by: libdata-printer-perl_0.35-1_all bug

NAME

       Data::Printer::Filter::DB - pretty printing database objects

SYNOPSIS

       In your program:

         use Data::Printer filters => {
             -external => [ 'DB' ],
         };

       or, in your ".dataprinter" file:

         {
           filters => {
             -external => [ 'DB' ],
           },
         };

DESCRIPTION

       This is a filter plugin for Data::Printer. It filters through DBI's handlers (dbh) and
       statement (sth) objects displaying relevant information for the user.

       DBI is an extremely powerful and complete database interface. But it does a lot of magic
       under the hood, making their objects somewhat harder to debug. This filter aims to fix
       that :)

       For instance, say you want to debug something like this:

         use DBI;
         my $dbh = DBI->connect('dbi:DBM(RaiseError=1):', undef, undef );

       A regular Data::Dumper output gives you absolutely nothing:

       $VAR1 = bless( {}, 'DBI::db' );

       Data::Printer makes it better, but only to debug the class itself, not helpful at all to
       see its contents and debug your own code:

           DBI::db  {
               Parents       DBI::common
               Linear @ISA   DBI::db, DBI::common
               public methods (48) : begin_work, clone, column_info, commit, connected, data_sources, disconnect, do, foreign_key_info, get_info, last_insert_id, ping, prepare, prepare_cached, preparse, primary_key, primary_key_info, quote, quote_identifier, rollback, rows, selectall_arrayref, selectall_hashref, selectcol_arrayref, selectrow_array, selectrow_arrayref, selectrow_hashref, sqlite_backup_from_file, sqlite_backup_to_file, sqlite_busy_timeout, sqlite_collation_needed, sqlite_commit_hook, sqlite_create_aggregate, sqlite_create_collation, sqlite_create_function, sqlite_enable_load_extension, sqlite_last_insert_rowid, sqlite_progress_handler, sqlite_register_fts3_perl_tokenizer, sqlite_rollback_hook, sqlite_set_authorizer, sqlite_update_hook, statistics_info, table_info, tables, take_imp_data, type_info, type_info_all
               private methods (0)
               internals: {
               }
           }

       Fear no more! If you use this filter, here's what you'll see:

           SQLite Database Handle (connected) {
               dbname: file.db
               Auto Commit: 1
               Statement Handles: 0
               Last Statement: -
           }

       Much better, huh? :)

       Statement handlers are even better. Imagine you continued your code with something like:

         my $sth = $dbh->prepare('SELECT * FROM foo WHERE bar = ?');
         $sth->execute(42);

       With this filter, instead of an empty dump or full method information, you'll get exactly
       what you came for:

        SELECT * FROM foo WHERE bar = ?  (42)

       Note that if your driver does not support holding of parameter values, you'll get a
       "bindings unavailable" message instead of the bound values.

SEE ALSO

       Data::Printer