The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::mysql::Results - Results

SYNOPSIS

  use Mojo::mysql::Results;

  my $results = Mojo::mysql::Results->new(db => $db, sth => $sth);

DESCRIPTION

Mojo::mysql::Results is a container for statement handles used by Mojo::mysql::Database.

ATTRIBUTES

Mojo::mysql::Results implements the following attributes.

sth

  my $sth  = $results->sth;
  $results = $results->sth($sth);

Statement handle results are fetched from.

METHODS

Mojo::mysql::Results inherits all methods from Mojo::Base and implements the following new ones.

array

  my $array = $results->array;

Fetch one row and return it as an array reference.

arrays

  my $collection = $results->arrays;

Fetch all rows and return them as a Mojo::Collection object containing array references.

columns

  my $columns = $results->columns;

Return column names as an array reference.

hash

  my $hash = $results->hash;

Fetch one row and return it as a hash reference.

hashes

  my $collection = $results->hashes;

Fetch all rows and return them as a Mojo::Collection object containing hash references.

rows

  my $num = $results->rows;

Number of rows.

text

  my $text = $results->text;

Fetch all rows and turn them into a table with "tablify" in Mojo::Util.

SEE ALSO

Mojo::mysql, Mojolicious::Guides, http://mojolicio.us.