DBI

 view release on metacpan or  search on metacpan

lib/DBI/DBD/SqlEngine/Developers.pod  view on Meta::CPAN

    @ISA = qw(DBI::DBD::SqlEngine::dr);

    sub data_sources { ... }
    ...

    package DBD::myDriver::db;

    @ISA = qw(DBI::DBD::SqlEngine::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 { ... }
    sub get_avail_tables { ... }

    package DBD::myDriver::st;

    @ISA = qw(DBI::DBD::SqlEngine::st);

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

    package DBD::myDriver::Statement;

    @ISA = qw(DBI::DBD::SqlEngine::Statement);

    sub open_table { ... }

    package DBD::myDriver::Table;

    @ISA = qw(DBI::DBD::SqlEngine::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 new { ... }

    sub fetch_row { ... }
    sub push_row { ... }
    sub push_names { ... }
    sub seek { ... }
    sub truncate { ... }
    sub drop { ... }

    # 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 the interface of DBI::DBD::SqlEngine for DBD
developers who write DBI::DBD::SqlEngine based DBI drivers. It supplements
L<DBI::DBD> and L<DBI::DBD::SqlEngine::HowTo>, 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 DBI::DBD::SqlEngine::dr

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

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

  # invokes
  package DBD::DBM::dr;
  our @ISA = qw(DBI::DBD::SqlEngine::dr);

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

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

Pure Perl DBI drivers derived from DBI::DBD::SqlEngine usually don't need to
override any of the methods provided through the DBD::XXX::dr package.
However if you need additional initialization not fitting in
C<init_valid_attributes()> and C<init_default_attributes()> of you're ::db
class, the connect method might be the final place to be modified.

=item DBI::DBD::SqlEngine::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");

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

=item DBI::DBD::SqlEngine::TieMeta;

Provides the tie-magic for C<< $dbh->{$drv_pfx . "_meta"} >>. Routes



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