Apache-BabyConnect
view release on metacpan or search on metacpan
eg/perl/statcc.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
print qq|
<style type="text/css">
<!--
.footer { padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
font-size: 100%;
border-top: #ffffff 1px solid;
border-bottom: #ffffff 1px solid;
background: #e5ecf9;
text-align: center;
font-family: arial,sans-serif;
}
-->
</style>
</head>
<body text="#000000" bgcolor="#ffffff">
<pre>
|;
# load the DBI::BabyConnect with caching and persistence enabled
use DBI::BabyConnect 1,1;
my $bbconn = DBI::BabyConnect->new('BABYDB_001');
$bbconn-> HookError(">>/var/www/htdocs/logs/error.log");
$bbconn-> HookTracing(">>/var/www/htdocs/logs/db.log",1);
# the following will be written to STDERR, /var/www/htdocs/logs/error.log
print STDERR "Now fetching records from TABLE2\n";
my $ah;
{
if ( $ah = $bbconn-> fetchTdaAO('TABLE2', ' ID,LOOKUP,DATASTRING,DATANUM,RECORDDATE_T '," ID=ID ")) { }
else {
# check for dbi error
my $dbierror = $bbconn-> dbierror();
print "Content-type: text/plain\n\n
$dbierror
";
exit;
}
}
for (my $i=0; $i<@$ah; $i++) {
print "$i -- ";
foreach my $k (qw(ID DATASTRING DATANUM RECORDDATE_T)) {
print $$ah[$i]{$k}, " ";
}
print "\n";
}
my $parent_pid = Apache::BabyConnect::parent_pid;
my @cpids = Apache::BabyConnect::cpids;
# get the statistics of the cached connections into $statCC
my $statCC = {};
$bbconn-> getStatCC($statCC);
print "
</pre>
The table below shows the cached connection of this http server process. The columns designation<br>
summary is as follow:
<ul>
<li><b>id</b> -- unique ID of the connection object formed of kernel process ID + database descriptor</li>
<li><b>kprocess</b> -- kernel process ID</li>
( run in 1.544 second using v1.01-cache-2.11-cpan-d8267643d1d )