Alzabo

 view release on metacpan or  search on metacpan

lib/Alzabo/Driver.pm  view on Meta::CPAN


 1:  sub new
 2:  {
 3:      my $proto = shift;
 4:      my $class = ref $proto || $proto;
 5:      my %p = @_;
 6:
 7:      my $self = bless {}, $class;
 8:
 9:      return $self;
 10:  }

The hash %p contains any values passed to the
C<Alzabo::Driver-E<gt>new> method by its caller.

Lines 1-7 should probably be copied verbatim into your own C<new>
method.  Line 5 can be deleted if you don't need to look at the
parameters.

Look at the included C<Alzabo::Driver> subclasses for examples.  Feel
free to contact me for further help if you get stuck.  Please tell me
what database you're attempting to implement, what its DBD::* driver
is, and include the code you've written so far.

=head2 Virtual Methods

The following methods are not implemented in C<Alzabo::Driver> itself
and must be implemented in a subclass.

=head3 Parameters for connect(), create_database(), and drop_database()

=over 4

=item * user => $db_username

=item * password => $db_pw

=item * host => $hostname

=item * port => $port

=back

All of these default to undef.  See the appropriate DBD driver
documentation for more details.

After the driver is created, it will have access to its associated
schema object in C<< $self->{schema} >>.

=head2 connect

Some drivers may accept or require more arguments than specified
above.

Note that C<Alzabo::Driver> subclasses are not expected to cache
connections.  If you want to do this please use C<Apache::DBI> under
mod_perl or don't call C<connect()> more than once per process.

=head2 create_database

Attempts to create a new database for the schema attached to the
driver.  Some drivers may accept or require more arguments than
specified above.

=head2 drop_database

Attempts to drop the database for the schema attached to the driver.

=head2 schemas

Returns a list of schemas in the specified RDBMS.  This method may
accept some or all of the parameters which can be given to
C<connect()>.

=head2 supports_referential_integrity

Should return a boolean value indicating whether or not the RDBMS
supports referential integrity constraints.

=head2 next_sequence_number (C<Alzabo::Column> object)

This method is expected to return the value of the next sequence
number based on a column object.  For some databases (MySQL, for
example), the appropriate value is C<undef>.  This is accounted for in
the Alzabo code that calls this method.

=head2 begin_work

Notify Alzabo that you wish to start a transaction.

=head2 rollback

Rolls back the current transaction.

=head2 commit

Notify Alzabo that you wish to finish a transaction.  This is
basically the equivalent of calling commit.

=head2 get_last_id

Returns the last primary key id created via a sequenced column.

=head2 rdbms_version

Returns the version of the server to which the driver is connected.

=head2 driver_id

Returns the driver's name.  This should be something that can be
passed to C<< Alzabo::Driver->new() >> as a "name" parameter.

=head1 AUTHOR

Dave Rolsky, <dave@urth.org>

=cut



( run in 0.532 second using v1.01-cache-2.11-cpan-e1769b4cff6 )