DBD::PO::Table - table class for DBD::File


DBD-PO documentation Contained in the DBD-PO distribution.

Index


Code Index:

NAME

Top

DBD::PO::Table - table class for DBD::File

$Id: Table.pm 289 2008-11-09 13:10:28Z steffenw $

$HeadURL: https://dbd-po.svn.sourceforge.net/svnroot/dbd-po/trunk/DBD-PO/lib/DBD/PO/Table.pm $

VERSION

Top

2.00

SYNOPSIS

Top

do not use

DESCRIPTION

Top

table class for DBD::File

SUBROUTINES/METHODS

Top

method fetch_row

method push_row

method push_names

DIAGNOSTICS

Top

none

CONFIGURATION AND ENVIRONMENT

Top

none

DEPENDENCIES

Top

parent

Carp

English

DBD::File

INCOMPATIBILITIES

Top

not known

BUGS AND LIMITATIONS

Top

not known

AUTHOR

Top

Steffen Winkler

LICENSE AND COPYRIGHT

Top


DBD-PO documentation Contained in the DBD-PO distribution.

package DBD::PO::Table;

use strict;
use warnings;

our $VERSION = '2.00';

use DBD::File;
use parent qw(-norequire DBD::File::Table);

use Carp qw(croak);
use English qw(-no_match_vars $INPUT_RECORD_SEPARATOR);

sub fetch_row {
    my ($self, $data) = @_;

    my $file_handle = $self->{fh};
    my $file_name   = $self->{file};
    my $fields;
    if (exists $self->{cached_row}) {
        $fields = delete $self->{cached_row};
    }
    else {
        my $po = $self->{po_po};
        local $INPUT_RECORD_SEPARATOR = $po->{eol};
        $fields = $po->read_entry($file_name, $file_handle);
    }

    return $self->{row} = @{$fields} ? $fields : ();
}

sub push_row {
    my ($self, $data, $fields) = @_;

    my $po          = $self->{po_po};
    my $file_handle = $self->{fh};
    my $file_name   = $self->{file};

    #  Remove undef from the right end of the fields, so that at least
    #  in these cases undef is returned from FetchRow
    while (@{$fields} && ! defined $fields->[-1]) {
        pop @{$fields};
    }
    $po->write_entry($file_name, $file_handle, $fields);

    return 1;
}

sub push_names {
    my ($self, $data, $fields) = @_;

    return 1;
}

1;

__END__