Kevin Treleaven > Anansi-Database-Oracle-0.02 > Anansi::Database::Oracle

Download:
Anansi-Database-Oracle-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Anansi::Database::Oracle - A manager for Oracle databases.

SYNOPSIS ^

    use Anansi::Database::Oracle;
    if(Anansi::Database::Oracle->validate(
        undef,
        DRIVER => 'Oracle',
    )) {
        my $OBJECT = Anansi::Database::Oracle->new();
        if($OBJECT->connect(
            undef,
            DATABASE => 'someDatabase',
            PASSWORD => 'somePassword',
            USERNAME => 'someUser',
        )) {
            my $records = $OBJECT->statement(
                undef,
                INPUT => [
                    {
                        DEFAULT => '0',
                        NAME => 'yetAnotherField',
                    }
                ],
                SQL => 'SELECT some_field, another_field FROM some_table WHERE yet_another_field = ?;',
                yetAnotherField => 123,
            );
            $OBJECT->disconnect();
            if(defined($records)) {
                if(ref($records) =~ /^ARRAY$/i) {
                    my $record = 0;
                    foreach my $record (@{$records}) {
                        next if(ref($record) !~ /^HASH$/i);
                        print "\n" if(0 < $record);
                        my $field = 0;
                        foreach my $key (keys(%{$record})) {
                            print ', ' if(0 < $field);
                            print '"'.$key.'" = "'.${record}{$key}.'"';
                            $field++;
                        }
                        $record++;
                    }
                    print "\n";
                }
            }
        }
    }

    use Anansi::Database;
    my $OBJECT = Anansi::Database->new();
    my $component = $OBJECT->addComponent(
        undef,
        DRIVER => 'Oracle',
    );
    if(defined($component)) {
        if($OBJECT->channel(
            'CONNECT',
            $component,
            DATABASE => 'someDatabase',
            PASSWORD => 'somePassword',
            USERNAME => 'someUser',
        )) {
            my $records = $OBJECT->channel(
                'STATEMENT',
                $component,
                INPUT => [
                    {
                        DEFAULT => '0',
                        NAME => 'yetAnotherField',
                    }
                ],
                SQL => 'SELECT some_field, another_field FROM some_table WHERE yet_another_field = ?;',
                yetAnotherField => 123,
            );
            if(defined($records)) {
                if(ref($records) =~ /^ARRAY$/i) {
                    my $record = 0;
                    foreach my $record (@{$records}) {
                        next if(ref($record) !~ /^HASH$/i);
                        print "\n" if(0 < $record);
                        my $field = 0;
                        foreach my $key (keys(%{$record})) {
                            print ', ' if(0 < $field);
                            print '"'.$key.'" = "'.${record}{$key}.'"';
                            $field++;
                        }
                        $record++;
                    }
                    print "\n";
                }
            }
        }
    }

DESCRIPTION ^

Manages Oracle databases allowing the opening and closing of Oracle databases.

METHODS ^

Anansi::Class

See Anansi::Class for details. A parent module of Anansi::Component.

DESTROY

See Anansi::Class::DESTROY for details.

finalise

See Anansi::Class::finalise for details. Overridden by Anansi::DatabaseComponent::finalise. A virtual method.

implicate

See Anansi::Class::implicate for details. A virtual method.

import

See Anansi::Class::import for details.

initialise

See Anansi::Class::initialise for details. Overridden by Anansi::DatabaseComponent::initialise. A virtual method.

new

See Anansi::Class::new for details.

old

See Anansi::Class::old for details.

used

See Anansi::Class::used for details.

uses

See Anansi::Class::uses for details.

using

See Anansi::Class::using for details.

Anansi::Component

See Anansi::Component for details. A parent module of Anansi::DatabaseComponent.

Anansi::Class

See Anansi::Class for details. A parent module of Anansi::Component.

addChannel

See Anansi::Component::addChannel for details.

channel

See Anansi::Component::channel for details.

componentManagers

See Anansi::Component::componentManagers for details.

removeChannel

See Anansi::Component::removeChannel for details.

Anansi::DatabaseComponent

See Anansi::DatabaseComponent for details. A parent module of Anansi::Database::Oracle.

Anansi::Component

See Anansi::Component for details. A parent module of Anansi::DatabaseComponent.

autoCommit

See Anansi::DatabaseComponent::autoCommit for details.

bind

See Anansi::DatabaseComponent::bind for details.

binding

See Anansi::DatabaseComponent::binding for details.

commit

See Anansi::DatabaseComponent::commit for details.

connect

See Anansi::DatabaseComponent::connect for details. Overridden by Anansi::Database::Oracle::connect.

disconnect

See Anansi::DatabaseComponent::disconnect for details.

finalise

See Anansi::DatabaseComponent::finalise for details. Overrides Anansi::Class::finalise. A virtual method.

finish

See Anansi::DatabaseComponent::finish for details.

handle

See Anansi::DatabaseComponent::handle for details.

initialise

See Anansi::DatabaseComponent::initialise for details. Overrides Anansi::Class::initialise. A virtual method.

prepare

See Anansi::DatabaseComponent::prepare for details.

rollback

See Anansi::DatabaseComponent::rollback for details.

statement

See Anansi::DatabaseComponent::statement for details.

validate

See Anansi::DatabaseComponent::validate for details. Overridden by Anansi::Database::Oracle::validate.

connect

    if(Anansi::Database::Oracle::connect(
        $OBJECT,
        undef,
        DATABASE => 'someDatabase',
        PASSWORD => 'somePassword',
        USERNAME => 'someUser',
    ));

    if($OBJECT->connect(
        undef,
        DATABASE => 'someDatabase',
        PASSWORD => 'somePassword',
        USERNAME => 'someUser',
    ));
self (Blessed Hash, Required)

An object of this namespace.

channel (String, Required)

The abstract identifier of a subroutine.

parameters (Hash, Optional)

Named parameters.

AutoCommit (String, Optional)

Defines whether the Oracle driver automatically saves any changes made to the DATABASE. A value of 1 (one) means changes will be saved, a value of 0 (zero) means changes will need to be manually saved. Changes are not saved by default.

DATABASE (String, Optional)

The name of the Oracle database. The content of the ORACLE_SID environment variable is used by default.

HOSTNAME (String, Optional)

The IP address of the computer where the Oracle DATABASE is hosted. A value of 127.0.0.1 is used by default.

PASSWORD (String, Optional)

The password of the USERNAME that is accessing the Oracle database. A value of undef is used by default.

PORT (String, Optional)

The IP address port number of the computer where the Oracle DATABASE is hosted. A value of 1521 (one five two one) is used by default.

PrintError (String, Optional)

Defines whether the Oracle driver will use the warn function. A value of 1 (one) means errors will be output using warn, a value of 0 (zero) means errors will not be output in this way. Errors are output by default.

RaiseError (String, Optional)

Defines whether the Oracle driver will use the die function. A value of 1 (one) means errors will be output using die, a value of 0 (zero) means errors will not be output in this way. Errors are output by default.

USERNAME (String, Optional)

The user that is accessing the Oracle database. A value of undef is used by default.

Overrides Anansi::DatabaseComponent::connect.

validate

    if(1 == Anansi::Database::Oracle::validate($OBJECT, undef));

    if(1 == Anansi::Database::Oracle::channel($OBJECT, 'VALIDATE_AS_APPROPRIATE'));

    if(1 == Anansi::Database::Oracle->validate(undef));

    if(1 == Anansi::Database::Oracle->channel('VALIDATE_AS_APPROPRIATE'));

    if(1 == $OBJECT->validate(undef, DRIVER => 'Oracle'));

    if(1 == $OBJECT->channel('VALIDATE_AS_APPROPRIATE', DRIVER => 'Oracle'));

    if(1 == Anansi::Database::Oracle->validate(undef, DRIVER => 'Oracle'));

    if(1 == Anansi::Database::Oracle->channel('VALIDATE_AS_APPROPRIATE', DRIVER => 'Oracle'));
self (Blessed Hash or String, Required)

Either an object or a string of this namespace.

channel (String, Required)

The abstract identifier of a subroutine.

parameters (Hash, Optional)

Named parameters.

DRIVER

When the DRIVER parameter is defined as Oracle then this database driver component will be used otherwise an attempt will be made to use this driver.

Overrides Anansi::DatabaseComponent::validate.

NOTES ^

This module is designed to make it simple, easy and quite fast to code your design in perl. If for any reason you feel that it doesn't achieve these goals then please let me know. I am here to help. All constructive criticisms are also welcomed.

AUTHOR ^

Kevin Treleaven <kevin AT treleaven DOT net>

syntax highlighting: