DBI

 view release on metacpan or  search on metacpan

lib/DBD/File/Developers.pod  view on Meta::CPAN

	...
	return $drh->{class};
	}

    sub CLONE { ... }

    package DBD::myDriver::dr;

    @ISA = qw( DBD::File::dr );

    sub data_sources { ... }
    ...

    package DBD::myDriver::db;

    @ISA = qw( DBD::File::db );

    sub init_valid_attributes { ... }
    sub init_default_attributes { ... }
    sub set_versions { ... }
    sub validate_STORE_attr { my ($dbh, $attrib, $value) = @_; ... }
    sub validate_FETCH_attr { my ($dbh, $attrib) = @_; ... }
    sub get_myd_versions { ... }

    package DBD::myDriver::st;

    @ISA = qw( DBD::File::st );

    sub FETCH { ... }
    sub STORE { ... }

    package DBD::myDriver::Statement;

    @ISA = qw( DBD::File::Statement );

    package DBD::myDriver::Table;

    @ISA = qw( DBD::File::Table );

    my %reset_on_modify = (
        myd_abc => "myd_foo",
        myd_mno => "myd_bar",
        );
    __PACKAGE__->register_reset_on_modify (\%reset_on_modify);
    my %compat_map = (
        abc => 'foo_abc',
        xyz => 'foo_xyz',
        );
    __PACKAGE__->register_compat_map (\%compat_map);

    sub bootstrap_table_meta { ... }
    sub init_table_meta { ... }
    sub table_meta_attr_changed { ... }
    sub open_data { ... }

    sub fetch_row { ... }
    sub push_row { ... }
    sub push_names { ... }

    # optimize the SQL engine by add one or more of
    sub update_current_row { ... }
    # or
    sub update_specific_row { ... }
    # or
    sub update_one_row { ... }
    # or
    sub insert_new_row { ... }
    # or
    sub delete_current_row { ... }
    # or
    sub delete_one_row { ... }

=head1 DESCRIPTION

This document describes how DBD developers can write DBD::File based DBI
drivers. It supplements L<DBI::DBD> and L<DBI::DBD::SqlEngine::Developers>,
which you should read first.

=head1 CLASSES

Each DBI driver must provide a package global C<driver> method and three
DBI related classes:

=over 4

=item DBD::File::dr

Driver package, contains the methods DBI calls indirectly via DBI
interface:

  DBI->connect ('DBI:DBM:', undef, undef, {})

  # invokes
  package DBD::DBM::dr;
  @DBD::DBM::dr::ISA = qw( DBD::File::dr );

  sub connect ($$;$$$)
  {
      ...
      }

Similar for C<< data_sources >> and C<< disconnect_all >>.

Pure Perl DBI drivers derived from DBD::File do not usually need to
override any of the methods provided through the DBD::XXX::dr package
however if you need additional initialization in the connect method
you may need to.

=item DBD::File::db

Contains the methods which are called through DBI database handles
(C<< $dbh >>). e.g.,

  $sth = $dbh->prepare ("select * from foo");
  # returns the f_encoding setting for table foo
  $dbh->csv_get_meta ("foo", "f_encoding");

DBD::File provides the typical methods required here. Developers who
write DBI drivers based on DBD::File need to override the methods C<<
set_versions >> and C<< init_valid_attributes >>.

=item DBD::File::st

Contains the methods to deal with prepared statement handles. e.g.,



( run in 1.421 second using v1.01-cache-2.11-cpan-39bf76dae61 )