Apache::Status plugin to show all DBI connections and statements

Apache::Status plugin to show all DBI connections and statements

am 21.03.2007 13:59:12 von Tim.Bunce

I needed an Apache::Status plugin to show all DBI connections and statements.
I couldn't see one so I wrote one...

It uses the fact that DBI (>= 1.49) now keeps weak refs to child handles,
so it's possible to drill-down through every DBI handle that exists.

I've appended a sample of the output. (It's copied from the web page so
has lost the bolding and dimming that the real output uses in places.)

Would anyone find this useful?

Does anyone want to turn it into a CPAN distribution and maintain it?

Tim.

------------------------------------------------------------ ----------------------------------------------
DBI 1.55 - Drivers, Connections and Statements

4 drivers loaded: DBM, Sponge, ExampleP, Gofer

------------------------------------------------------------ ----------------------------------------------
DBD::DBM version 0.03, 2 dbh (2 cached, 2 active) DBI::dr=HASH(0x18f3010)

DSN "dbm_type=SDBM_File;lockfile=0" DBI::db=HASH(0x193e374)
Attributes: Active, Executed, RaiseError, ShowErrorStatement, AutoCommit
Attributes: ErrCount=1, TraceLevel=0, FetchHashKeyName='NAME', LongReadLen=80, Username=undef
Statement: SELECT dKey, dVal FROM fruit

DSN "dbm_type=SDBM_File;mldbm=;lockfile=0;f_dir=/Users/timbo/dbi /trunk/test_output" DBI::db=HASH(0x192256c)
Attributes: Active, Executed, RaiseError, ShowErrorStatement, AutoCommit
Attributes: ErrCount=0, TraceLevel=0, FetchHashKeyName='NAME', LongReadLen=80, Username=undef
Statement: DELETE FROM SDBM_File_fruit WHERE dVal='to delete'

------------------------------------------------------------ ----------------------------------------------
DBD::ExampleP version 12.009153, 5 dbh (5 cached, 5 active) DBI::dr=HASH(0x18a6bc4)

DSN "." DBI::db=HASH(0x18f0b18)
Attributes: Active, RaiseError, AutoCommit
Attributes: ErrCount=0, TraceLevel=0, FetchHashKeyName='NAME', LongReadLen=80, Username=undef

DSN "" DBI::db=HASH(0x18ef52c)
Attributes: Active, Executed, RaiseError, AutoCommit
Attributes: ErrCount=3, TraceLevel=0, FetchHashKeyName='NAME', LongReadLen=80, Username=''
Statement: SELECT name FROM t
sth: 1 (1 cached, 0 active)

sth DBI::st=HASH(0x195ec00)
Attributes: Executed, RaiseError
Attributes: ErrCount=0, TraceLevel=0, FetchHashKeyName='NAME', LongReadLen=80
Statement: select name from ?
ParamValues: 1='.'
Attributes: NUM_OF_PARAMS=1, NUM_OF_FIELDS=1, CursorName=undef
Rows: 40

------------------------------------------------------------ ----------------------------------------------

Re: Apache::Status plugin to show all DBI connections and statements

am 22.03.2007 06:10:46 von pgollucci

Tim Bunce wrote:
> I needed an Apache::Status plugin to show all DBI connections and statements.
> I couldn't see one so I wrote one...
IIRC I was the one that ported Apache2::Status/DBI to even have the menu
item in mod_perl2.x so yes, and yes -- not that I need more work :)



--
------------------------------------------------------------ ------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB B89E 1324 9B4F EC88 A0BF

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.