[ic] Problem with Berkeley DB_File on FreeBSD - continue

Kestutis Lasys kestutis.lasys@delfi.lt
Fri, 02 Mar 2001 15:44:19 +0200


> Hello,
> 
> I have problem when using Berkeley DB_File for interchange databases on
> FreeBSD.
>
> I've installed interchange 4.6.3 on my Linux box and it runs without
> problem.
> But if I try it on FreeBSD box (hosting company) which use Berkeley
> DB_File
> instead of GDBM, I am getting the following error in item_edit:
> 
>  Bad SQL, query was: select DISTINCT category, category FROM products
> ORDER BY category
>
>
> I have found from list archive that somebody had the same problem: 
>
>  
> http://developer.akopia.com/archive/interchange-users/2000/msg10420.html
>
> But I can't find how to fix this problem. Please advise.
> 
> Sorry for my English. 
> 
> Kestutis Lasys

Hello,

After my hosting company installed GDBM for me, I found that this
problem 
doesn't depend on database type. :) 

After day of debugging I found that SQL::Statement.pm (Statement.xs)
doesn't 
behave as documented on FreeBSD system. 

> where
> 
> This method is used to examine the syntax tree of the C<WHERE> clause.
> It returns undef (if no WHERE clause was used) or an instance of
> SQL::Statement::Op. 

If no WHERE clause is used it doesn't return undef but number.

I'm unfamiliar with xs, so here is my fix:

--- /usr/local/interchange/lib/Vend/Scan.pm     Sat Dec  2 19:49:10 2000
+++ lib/Vend/Scan.pm    Fri Mar  2 13:28:23 2001
@@ -663,7 +663,8 @@
        my @where;
        my $numeric;
        @where = $stmt->where();
-       if(defined $where[0]) {
+       #if(defined $where[0]) {
+       if(CORE::ref $where[0]) {
          my $or;
          push_spec('co', 'yes', $ary, $hash);
          do {


Thank you for your patience.

Kestutis Lasys