App-MonM

 view release on metacpan or  search on metacpan

lib/App/MonM/Checkit/DBI.pm  view on Meta::CPAN

package App::MonM::Checkit::DBI; # $Id: DBI.pm 116 2022-08-27 08:57:12Z abalama $
use strict;
use utf8;

=encoding utf-8

=head1 NAME

App::MonM::Checkit::DBI - Checkit DBI subclass

=head1 VIRSION

Version 1.01

=head1 SYNOPSIS

    <Checkit "foo">

        Enable  yes
        Type    dbi
        DSN     DBI:mysql:database=DBNAME;host=127.0.0.1
        SQL     "SELECT 'OK' AS OK FROM DUAL"
        User    USER
        Password PASSWORD
        Timeout 15s
        Set RaiseError  0
        Set PrintError     0
        Set mysql_enable_utf8   0

        # . . .

    </Checkit>

=head1 DESCRIPTION

Checkit DBI subclass

=head2 check

Checkit method.
This is backend method of L<App::MonM::Checkit/check>

Returns:

=over 4

=item B<code>

The DBH error code ($dbh->err)

=item B<content>

The merged response content

=item B<message>

OK or ERROR value, see "status"

=item B<source>

DSN of DBI connection

=item B<status>

0 if error occured; 1 if no errors found

=back

=head1 CONFIGURATION DIRECTIVES

The basic Checkit configuration options (directives) detailed describes in L<App::MonM::Checkit/CONFIGURATION DIRECTIVES>

=over 4

=item B<Content>, B<SQL>

    SQL "SELECT 'OK' AS OK FROM DUAL"

Specifies the SQL query string (as content)

Default: "SELECT 'OK' AS OK FROM DUAL"

=item B<DSN>

    DSN     DBI:mysql:database=DATABASE;host=HOSTNAME

Sets Database DSN string

Default: dbi:Sponge:

=item B<Set>

    Set RaiseError     0
    Set PrintError     0

Defines DBI Attributes. This directive allows you set case sensitive DBI Attributes.
There can be several such directives.

Examples:

    Set sqlite_unicode      1
    Set mysql_enable_utf8   0

Default: no specified

=item B<Timeout>

    Timeout    1m

Defines the timeout of DBI requests

Default: off

=item B<Username>, B<Password>

    User        USER
    Password    PASSWORD

Defines database credential: username and password

Default: no specified

=back

=head1 HISTORY

See C<Changes> file

=head1 TO DO

See C<TODO> file

=head1 BUGS

* none noted

=head1 SEE ALSO

L<App::MonM>

=head1 AUTHOR

Serż Minus (Sergey Lepenkov) L<https://www.serzik.com> E<lt>abalama@cpan.orgE<gt>

=head1 COPYRIGHT

Copyright (C) 1998-2022 D&D Corporation. All Rights Reserved

=head1 LICENSE

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See C<LICENSE> file and L<https://dev.perl.org/licenses/>

=cut

use vars qw/$VERSION/;
$VERSION = '1.01';

use CTK::DBI;
use CTK::ConfGenUtil;



( run in 2.460 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )