If you are going to dig in and do something with a database handle directly, the recommended way is:
use Data::Dumper;
$schema->storage->dbh_do( sub {
my ( $storage, $dbh ) = @_;
print Dumper $dbh->selectall_arrayref(
'select enum_range(typename);',
{ slice => {} }
);
} );
The dbh_do method (documented in DBIx::Class::Storage::DBI) gives you the benefit of things like automatic reconnection to the database if your connection has timed out or the server has been restarted.
Also, db_Main is from Class::DBI, not DBIx::Class, although there is a CDBICompat component that will make the latter work mostly like the former (though in the long run you will be better off by just learning the DBIx::Class way, rather than using CDBICompat).
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|