[freeside-commits] freeside/FS/FS Record.pm,1.144,1.145

Ivan,,, ivan at wavetail.420.am
Wed Oct 3 20:37:11 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv16781

Modified Files:
	Record.pm 
Log Message:
add debugging option to qsearch

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- Record.pm	28 Sep 2007 00:19:50 -0000	1.144
+++ Record.pm	4 Oct 2007 03:37:09 -0000	1.145
@@ -214,6 +214,7 @@
                            'order_by'  => 'ORDER BY something',
                            #'cache_obj' => '', #optional
                            'addl_from' => 'LEFT JOIN othtable USING ( field )',
+                           'debug'     => 1,
                          }
                        );
 
@@ -235,6 +236,7 @@
 
 sub qsearch {
   my($stable, $record, $select, $extra_sql, $order_by, $cache, $addl_from );
+  my $debug = '';
   if ( ref($_[0]) ) { #hashref for now, eventually maybe accept a list too
     my $opt = shift;
     $stable    = $opt->{'table'}     or die "table name is required";
@@ -244,6 +246,7 @@
     $order_by  = $opt->{'order_by'}  || '';
     $cache     = $opt->{'cache_obj'} || '';
     $addl_from = $opt->{'addl_from'} || '';
+    $debug     = $opt->{'debug'}     || '';
   } else {
     ($stable, $record, $select, $extra_sql, $cache, $addl_from ) = @_;
     $select ||= '*';
@@ -282,7 +285,7 @@
   $statement .= " $extra_sql" if defined($extra_sql);
   $statement .= " $order_by"  if defined($order_by);
 
-  warn "[debug]$me $statement\n" if $DEBUG > 1;
+  warn "[debug]$me $statement\n" if $DEBUG > 1 || $debug;
   my $sth = $dbh->prepare($statement)
     or croak "$dbh->errstr doing $statement";
 



More information about the freeside-commits mailing list