[Dbix-class] How to set debugobj in DBIC
RA Jones
ra.jones at dpw.clara.co.uk
Thu Mar 15 16:30:07 GMT 2007
In 'hand-written' apps I normally dump SQL statements to file, together
with timing data from Time::HiRes. DBIC seems to support several ways of
doing this using the debugobj eg DBIx::Class::Storage::Statistics and
DBIx::Class::QueryLog.
I would like to use the latter, but have no idea how to set the
debugobj. According to the DBIC::QueryLog doc:
my $schema = ... # Get your schema!
my $ql = new DBIx::Class::QueryLog();
$schema->storage->debugobj($ql);
$schema->storage->debug(1);
... # do some stuff!
Trying various places to set debugobj so far has failed with error
messages, usually relating to storage. In reality I've no idea where to
start with this. The intuitive place to set the debugobj is either
MyApp/lib/Schema.pm or MyApp::Model::Schema.pm, but neither seems to
work. Presumably I shouldn't be doing this in the MyApp/lib/Schema DBIC
classes? A simple code example is really all I need to get going.
--
Richard Jones
Leeds, UK
**********************************************************************
Information in this message may contain confidential and privileged
information. If you are not the intended recipient please accept our
apologies; please do not disclose, copy or distribute information in
this e-mail or take any action in reliance on its contents: to do so
is strictly prohibited and may be unlawful. Please inform us that this
message has gone astray before deleting it. Thank you for your
co-operation.
NHSmail is used daily by over 100,000 staff in the NHS. Over a million
messages are sent every day by the system. To find out why more and
more NHS personnel are switching to this NHS Connecting for Health
system please visit www.connectingforhealth.nhs.uk/nhsmail
**********************************************************************
More information about the Dbix-class
mailing list