Re: Is it ever legal (should be supported) to issue a non select in selectall_arrayref?
David Nicol <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jun 11, 2011 at 12:51 PM, Tim Bunce <[email protected]> wrote: > Patch welcome. > > Tim. here's a revised new paragraph, to go right before the =head3 C<prepare>. BEGIN THING TO INSERT =head3 On use of non-C<SELECT> SQL in C<select*_*> methods While some drivers support statements other than C<SELECT> in the above-listed convenience functions, others do not: driver support for this facility is not defined by the DBI interface standard, and the C<do> method is provided for non-C<SELECT> statements. When you really don't know if the statement you have in a variable is going to be a C<SELECT> or not, unrolling the process into C<prepare>,C<execute>, and a C<fetch*> called within an C<eval> block will work. END THING TO INSERT the alternate of calling the select_*_ in the eval, then falling back to the do, is not suggested, as it might cause the SQL to get done twice. I think explicitly warning against my $ar; eval { $ar = $dbh-> selectall_arrayref($SQL); 1} or $dbh->do{$SQL); would be going too far.