NAME

DBIx::Custom::Result - DBIx::Custom Resultset

SYNOPSIS

# Result
my $result = $dbi->select(table => 'books');

# Fetch a row into array
while (my $row = $result->fetch) {
    my $value1 = $row->[0];
    my $valuu2 = $row->[1];
    
    # do something
}

# Fetch only first row into array
my $row = $result->fetch_first;

# Fetch multiple rows into array of array
while (my $rows = $result->fetch_multi(5)) {
    # do something
}

# Fetch all rows into array of array
my $rows = $result->fetch_all;

# Fetch hash into hash
while (my $row = $result->fetch_hash) {
    my $value1 = $row->{title};
    my $value2 = $row->{author};
    
    # do something
}

# Fetch only first row into hash
my $row = $result->fetch_hash_first;

# Fetch multiple rows into array of hash
while (my $rows = $result->fetch_hash_multi) {
    # do something
}

# Fetch all rows into array of hash
my $rows = $result->fetch_hash_all;

ATTRIBUTES

sth

Statement handle.

$result = $result->sth($sth);
$sth    = $reuslt->sth

default_filter

Default filter.

$result         = $result->default_filter('decode_utf8');
$default_filter = $result->default_filter;

filter

Filter

$result = $result->filter({title => 'decode_utf8'});
$filter = $result->filter;

METHODS

This class is Object::Simple subclass. You can use all methods of Object::Simple

fetch

Fetch a row into array

$row = $result->fetch;

Example:

while (my $row = $result->fetch) {
    # do something
    my $value1 = $row->[0];
    my $value2 = $row->[1];
}

fetch_first

Fetch only first row into array and finish statment handle.

$row = $result->fetch_first;

fetch_multi

Fetch multiple rows into array of array.

$rows = $result->fetch_multi($count);

Example:

while(my $rows = $result->fetch_multi(10)) {
    # do someting
}

fetch_all

Fetch all rows into array of array.

$rows = $result->fetch_all;

fetch_hash

Fetch a row into hash

$row = $result->fetch_hash;

Example:

while (my $row = $result->fetch_hash) {
    my $val1 = $row->{title};
    my $val2 = $row->{author};
    
    # do something
}

fetch_hash_first

Fetch only first row into hash and finish statment handle.

$row = $result->fetch_hash_first;

fetch_hash_multi

Fetch multiple rows into array of hash

$rows = $result->fetch_hash_multi($count);

Example:

while(my $rows = $result->fetch_hash_multi(10)) {
    # do someting
}

fetch_hash_all

Fetch all rows into array of hash.

$rows = $result->fetch_hash_all;