NAME

DBIx::Simplish::Result - A result of a DBIx::Simplish query.

VERSION

version 1.000_001

SYNOPSIS

@columns = $result->columns

$result->into($foo, $bar, $baz)
$row = $result->fetch

@row = $result->list      @rows = $result->flat
$row = $result->array     @rows = $result->arrays
$row = $result->hash      @rows = $result->hashes
@row = $result->kv_list   @rows = $result->kv_flat
$row = $result->kv_array  @rows = $result->kv_arrays

%map = $result->map_arrays(...)
%map = $result->map_hashes(...)
%map = $result->map

$rows = $result->rows

$dump = $result->text

$result->finish

DESCRIPTION

Result class for DBIx::Simplish

METHODS

attr(...)

Returns a copy of an sth attribute (property). See "Statement Handle Attributes" in DBI for details.

func(...)

This calls the func method on the sth of DBI. See DBI for details.

rows

Returns the number of rows affected by the last row affecting command, or -1 if the number of rows is not known or not available.

For SELECT statements, it is generally not possible to know how many rows are returned. MySQL does provide this information. See DBI for a detailed explanation.

finish

Finishes the statement. After finishing a statement, it can no longer be used. When the result object is destroyed, its statement handle is automatically finished and destroyed. There should be no reason to call this method explicitly; just let the result object go out of scope.

fetch

Returns a reference to the array that holds the values. This is the same array every time.

Subsequent fetches (using any method) may change the values in the variables passed and the returned reference's array.

columns

Returns a list of column names. Affected by lc_columns.

bind(LIST)

Binds the given LIST of variables to the columns. Unlike with DBI's bind_columns, passing references is not needed.

Bound variables are very efficient. Binding a tied variable doesn't work.

into(LIST)

Combines bind with fetch. Returns what fetch returns.

list

Returns a list of values, or (in scalar context), only the last value.

hash

Returns a reference to a hash, keyed by column name. Affected by lc_columns.

array

Returns a reference to an array.

kv_list

Returns an ordered list of interleaved keys and values. Affected by lc_columns.

kv_array

Returns a reference to an array of interleaved column names and values. Like kv, but returns an array reference even in list context. Affected by lc_columns.

object($class, ...)

Returns an instance of $class. Possibly affected by lc_columns.

flat

Returns a flattened list.

arrays

Returns a list of references to arrays

hashes

Returns a list of references to hashes, keyed by column name. Affected by lc_columns.

kv_flat

Returns an flattened list of interleaved column names and values. Affected by lc_columns.

kv_arrays

Returns a list of references to arrays of interleaved column names and values. Affected by lc_columns.

objects($class, ...)

Returns a list of instances of $class. Possibly affected by lc_columns.

map_arrays($column_number)

Constructs a hash of array references keyed by the values in the chosen column, and returns a list of interleaved keys and values, or (in scalar context), a reference to a hash.

map_hashes($column_name)

Constructs a hash of hash references keyed by the values in the chosen column, and returns a list of interleaved keys and values, or (in scalar context), a reference to a hash. Affected by lc_columns.

map

Constructs a simple hash, using the two columns as key/value pairs. Should only be used with queries that return two columns. Returns a list of interleaved keys and values, or (in scalar context), a reference to a hash.

SEE ALSO

DBIx::Simplish

AUTHOR

Hans Staugaard <staugaard@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Hans Staugaard.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.