Result
NAME
DB::MySQL::Result -- Results from a MySQL query
SYNOPSIS
my $results = $sth.execute(1);
say $results.num-fields; # Number of column fields say $results.keys; # Array of column field keys
say $results.value; # A single scalar value
say $results.array; # A single array with one row
say $results.hash; # A single hash with one row
say $results.arrays; # A sequence of arrays with all rows
say $results.hashes; # A sequence of hashes with all rows
$results.finish; # Only needed if results aren't consumed.
DESCRIPTION
Returned from a DB::MySQL::Statement execution that returns
results. There are two flavors, DB::MySQL::StatementResult
returned from a prepared statement, and
DB::MySQL::NonStatementResult returned from an execute(),
but they act the same.
If the execute was passed the :store flag (normally True by
default), the results are all retrieved from the server at once,
then doled out as requested. If :store is set to False,
each row is retrieved from the server on request. This can tie
up server resources so results should be consumed quickly. Read
the MySQL documentation for more details on the distinction.
METHODS
num-fields()
Returns the number of fields in each row.
keys()
Array of the names of the columns (fields) to be returned.
finish()
Finish the database connection. This is only needed if the complete database returns aren't consumed.
value()
Return a single scalar value from the results.
array()
Return a single row from the results as an array.
hash()
Return a single row from the results as a hash.
arrays()
Return a sequence of all rows as arrays.
hashes()
Return a sequence of all rows as hashes.