Name

dump_results( )

Synopsis

$statement_handle->dump_results(length, row_delimiter,
                                column_delimiter, filehandle})

This displays the results of a statement using the neat_list( ) function on each row for the statement handle given. The first argument is the maximum length of each column’s display. For columns containing more characters than the maximum length, the excess will be omitted and ellipses will be presented in its place. The default length is 35 characters. For the second argument, the delimiter for each row may be given—the default is \n. The delimiter for columns may also be changed from the default of a comma and a space in the third argument. In the last argument of the function, a file handle of where to direct the results of the function may be given. If one is not specified, stdout is used.

...
my $sql_stmnt = "SELECT title, authors
                 FROM books
                 WHERE author= 'Henry James' LIMIT 3";
my $sth = $dbh->prepare($sql_stmnt);
$sth->execute( );
$results = $sth->dump_results(10, "\n", '|');
...

The results of the preceding script would look like this:

'The Boston...'|'Henry James'
'The Muse'|'Henry James'
'Washington...'|'Henry James'
3 rows

Get MySQL in a Nutshell 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.