[Dbix-class] schema -> dsn?

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Thu May 10 15:39:51 GMT 2012


Patrick Meidl wrote:
> On Thu, May 10 2012, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> wrote:
> 
>> Given a resultset or schema object, how do I find the DSN to which it
>> is connected? (or equivalent information about host & database name
>> etc)
> 
> $schema->storage->connect_info->{dsn};
> $rs->result_source->storage->connect_info->{dsn};

Thanks, yes that was enough. In my system connect_info returns an
arrayref rather than a hashref, but it has the dsn as element 0.

I had read the description of connect_info at
http://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/Storage/DBI.pm#connect_info
but from that I got the impression that it was a mutator method rather
than an accessor. It says nothing about a return value. I had decided it
would be dangerous to try calling that.

So thanks very much for the pointer :)

Dave



More information about the DBIx-Class mailing list