Name

Msql::Statement::numfields

Synopsis

$number_of_fields = $statement_handle->numfields;

Msql::Statement::numfields returns the number of fields contained in a single row of the output stored in the statement handle. All output has at least one field, so this function will return a positive integer for any defined statement handle.

Example

use Msql;
my $db = Msql->connect;
$db->selectdb('mydata');
my $output = $db->query("select * from mytable");

my $numfields = $output->numfields;
my $numrows = $output->numrows;
print "There are $numfields field in each row of 'mytable'\n";
print "And there are $numrows rows of data. Thus, 'mytable'\n";
print "contains " . ($numfields*$numrows) . " cells of data.\n";

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.