Commit a1fb2340 authored by Leigh Stoller's avatar Leigh Stoller

Add simple debugging hack; Set $libdb::DBQUERY_DEBUG=1 and all the queries

will get printed out before execution.
parent b05a9566
...@@ -246,7 +246,7 @@ require Node; ...@@ -246,7 +246,7 @@ require Node;
require NodeType; require NodeType;
require Mysql; require Mysql;
use vars qw($DBQUERY_MAXTRIES $DBCONN_MAXTRIES use vars qw($DBQUERY_MAXTRIES $DBCONN_MAXTRIES
$DBCONN_EXITONERR $DBQUERY_RECONNECT $DBCONN_EXITONERR $DBQUERY_RECONNECT $DBQUERY_DEBUG
@EXPORT_OK @virtualTables @physicalTables); @EXPORT_OK @virtualTables @physicalTables);
# Configure variables # Configure variables
...@@ -326,8 +326,9 @@ $DBQUERY_MAXTRIES = 1; ...@@ -326,8 +326,9 @@ $DBQUERY_MAXTRIES = 1;
$DBQUERY_RECONNECT = 1; $DBQUERY_RECONNECT = 1;
$DBCONN_MAXTRIES = 5; $DBCONN_MAXTRIES = 5;
$DBCONN_EXITONERR = 1; $DBCONN_EXITONERR = 1;
$DBQUERY_DEBUG = 0;
@EXPORT_OK = qw($DBQUERY_MAXTRIES $DBQUERY_RECONNECT @EXPORT_OK = qw($DBQUERY_MAXTRIES $DBQUERY_RECONNECT
$DBCONN_EXITONERR $DBCONN_MAXTRIES); $DBCONN_EXITONERR $DBCONN_MAXTRIES $DBQUERY_DEBUG);
sub TBDBConnect($) sub TBDBConnect($)
{ {
...@@ -4622,6 +4623,10 @@ sub DBQueryN($$) ...@@ -4622,6 +4623,10 @@ sub DBQueryN($$)
} }
} }
if ($DBQUERY_DEBUG) {
print STDERR "Query: '$query'\n";
}
while ($maxtries) { while ($maxtries) {
# Get this each time through the loop since we try reconnect below. # Get this each time through the loop since we try reconnect below.
my $db = $DB[$dbnum]; my $db = $DB[$dbnum];
......
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