Name

Msql::Statement::maxlength

Synopsis

@max_lengths  = $statement_handle->maxlength;

Msql::Statement::maxlength returns a list of the actual maximum length of each field contained in the table. When called in a scalar context, the function returns a reference to an array. Since the mSQL server does not provide this information directly, this function is implemented by reading the entire table and searching for the maximum value of each field. Thus, with mSQL this function can be resource heavy when used with queries that return large amounts of information.

Example

use Msql;
$db = Msql->connect;
$db->selectdb('mydata');
my $output = $db->query('select name, date from myothertable');

print "The longest name is " . $ouput->maxlength->[0] . " characters long.\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.