Commit a2acc4af authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Added functions to help track the number of database queries used.

parent b2fa89ac
...@@ -352,6 +352,8 @@ $DBErrorString = ""; ...@@ -352,6 +352,8 @@ $DBErrorString = "";
@EXPORT = qw($DBQUERY_MAXTRIES $DBQUERY_RECONNECT $DBErrorString @EXPORT = qw($DBQUERY_MAXTRIES $DBQUERY_RECONNECT $DBErrorString
$DBCONN_EXITONERR $DBCONN_MAXTRIES $DBQUERY_DEBUG); $DBCONN_EXITONERR $DBCONN_MAXTRIES $DBQUERY_DEBUG);
my $queryCount = 0;
sub TBDBConnect($$) sub TBDBConnect($$)
{ {
my ($dbnum, $dbname) = @_; my ($dbnum, $dbname) = @_;
...@@ -498,6 +500,9 @@ sub DBQueryN($$) ...@@ -498,6 +500,9 @@ sub DBQueryN($$)
my $maxtries = $DBQUERY_MAXTRIES; my $maxtries = $DBQUERY_MAXTRIES;
my $result; my $result;
# Update query count total for debugging purposes
$queryCount += 1;
# Not really forever :-) # Not really forever :-)
if (!$maxtries) { if (!$maxtries) {
$maxtries = 100000; $maxtries = 100000;
...@@ -788,6 +793,16 @@ END { ...@@ -788,6 +793,16 @@ END {
TBDBDisconnect(); TBDBDisconnect();
} }
sub ClearQueryCount()
{
$queryCount = 0;
}
sub GetQueryCount()
{
return $queryCount;
}
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
1; 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment