[ic] More Information : Category select box not working in 4.6.5

Jason Kohles interchange-users@lists.akopia.com
Thu Jun 7 12:02:34 2001


On Wed, Jun 06, 2001 at 07:26:11PM -0400, Chris Rapier wrote:
> 
> The error I receieved from the demo store was:
> 128.2.85.12 T7aYyIJD:128.2.85.12 - [06/June/2001:19:22:30 -0400]
> construct /cgi-bin/construct.cgi/admin/item_edit Bad SQL, query was:
> select DISTINCT category, category FROM products ORDER BY category
> 
Well, I have managed to track down the cause of this, although I can't
fully explain it, I can offer a workaround.  The problem is that code
in Scan.pm is using $INC{'SQL/Statement.pm'} to determine if the
SQL::Statement module was successfully loaded, this is a common practice,
and should work fine.  In this case however, %INC is blank, and I haven't
yet been able to figure out why, what this does is make Interchange think
that the SQL::Statement module is not available, which then hits another
bug, the error message being returned is never displayed, so you don't
actually know what went wrong.  I've checked a fix in to the 4.7 cvs tree,
and the patches are attached below which fix the error suppression, and use
a different technique to see if SQL::Statement is available, you should be
able to apply them easily to 4.6.


--- lib/Vend/Scan.pm     2001/04/20 18:13:21     1.7.2.6
+++ lib/Vend/Scan.pm     2001/06/07 15:57:18
@@ -575,7 +575,7 @@
        }
 
        die "SQL is not enabled for Interchange. Get the SQL::Statement module.\n"
-               unless $INC{'SQL/Statement.pm'};
+               unless defined &SQL::Statement::new;
 
        my $parser = SQL::Parser->new('Ansi');

--- lib/Vend/Table/Common.pm     2001/05/16 16:07:32     1.16.4.11
+++ lib/Vend/Table/Common.pm     2001/06/07 15:57:43
@@ -645,7 +645,11 @@
                        ($spec, $stmt) = Vend::Scan::sql_statement($query, $ref);
                };
                if(! CORE::ref $spec) {
-                       ::logError("Bad SQL, query was: $query");
+                       if($@) {
+                               ::logError("Bad SQL, error was: $@, query was: $query");
+                       } else {
+                               ::logError("Bad SQL, query was: $query");
+                       }
                        return ($opt->{failure} || undef);
                }
                my @additions = grep length($_) == 2, keys %$opt;

-- 
Red Hat E-Business Solutions                    Jason Kohles
11480 Sunset Hills Road                         Senior System Architect
Reston, VA 20190                                jkohles@redhat.com