Sherzod Ruzmetov > Class-PObject > Class::PObject::Driver::DBI

Download:
Class-PObject-2.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 2.02   Source  

NAME ^

Class::PObject::Driver::DBI - Base class for all DBI-related drivers

SYNOPSIS ^

    package Class::PObject::YourDriver;
    use Class::PObject::Driver::DBI;
    @ISA = ('Class::PObject::Driver::DBI');

    sub save {
        my ($self, $pobject_name, \%properties, \%columns) = @_;
        ...
    }

    sub dbh {
        my ($self, $pobject_name, \%properties) = @_;
        ...
    }

ABSTRACT ^

    Class::PObject::Driver::DBI is a subclass of Class::PObject::Driver.
    Provides all the necessary base methods/utilities for writing
    DBI-related pobject drivers.

STOP! ^

If you just want to be able to use Class::PObject this manual is not for you. This is for those willing to write pobject drivers to support other database systems and storage devices.

If you just want to be able to use Class::PObject, you should refer to its manual instead.

DESCRIPTION ^

Class::PObject::Driver::DBI is a direct subclass of Class::PObject::Driver and overrides the methods provided in Class::PObject::Driver with those more relevant to RDBMS engines.

It uses ANSI-SQL syntax, so most of the base methods should perform as expected for most RDBMS that support ANSI-SQL syntax.

For those that don't, you can override necessary methods from within your driver class. This manual will not discuss the list of base methods, for they all are documented in Class::PObject::Driver. Please refer to the manual for gory details.

REQUIRED METHODS ^

Once your driver inherits from Class::PObject::Driver::DBI, most of the base methods, such as load(), remove(), remove_all(), count() will already be defined for you, so you may not even have to defined those methods.

The only methods required to be defined are save() and dbh(). For details on save() method, refer to Class::PObject::Driver.

OTHER METHODS ^

The list of all other standard driver methods can be found in Class::PObject::Driver.

Class::PObject::Driver::DBI also provides following private/utility methods that are called by other driver methods to create SQL statements and/or clauses.

You may override these methods to affect the creation of SQL statements for your specific database instead of having to re-define the standard driver methods.

All the methods prefixed with _prepare_ string return an array of two elements. First is the $sql, which holds the relevant ANSI-SQL statement with possible placeholders, and second is \@bind_params, which holds the list of all the values for the place holders in the $sql.

SEE ALSO ^

Class::PObject::Driver

COPYRIGHT AND LICENSE ^

For author and copyright information refer to Class::PObject's online manual.

syntax highlighting: