Gabriel

Emailed the author of DBD::RAM and got nearly and instantaneous response as below.

Chuck

Hi,

DBD::RAM has been replaced by DBD::AnyData which does everything 
DBD::RAM did and much more (I'm the author of both).  Download and 
install AnyData, SQL::Statement and then DBD::AnyData in that order and 
you should be set to go.  Sorry for the problems with RAM, I'll be 
removing the link to it soon.  You have a choice on SQL::Statement since 
it now exists in two versions, see this page for more info on which 
version you might want and how to get them:

  http://www.vpservices.com/jeff/programs/sql-compare.html

-- 
Jeff




-----Original Message-----
From: Gabriel C Millerd [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 5:53 AM
To: [EMAIL PROTECTED]
Subject: DBD::RAM Woes


i am writing a little function (see hack below) that will allow me to
sort data for my CGI's easily (especially for multiple columns) ... ala
another function that works the CGI.pm aspect of things.

problem is that this function seems to (under mod_perl) duplicate the
rows that i pass to it (although it sorts all of them wonderfully). if i
castrate the function in order to see if the problem is elsewhere to
'sub sortcol {return shift}' it works just fine (although it doesnt sort
anything)

thanks for any help you guys can provide.



package Hacks;
use strict;
use DBI;

sub sortcol {
     my @body=@{$_[0]};
     my @ords=@{$_[1]};
     my $cols = @body;
     my $table="tmptable";
     my @alpha=('a' .. 'zz');
     my @col_names;
     my $dbh = DBI->connect('dbi:RAM:',,,{RaiseError => 0});

     for my $i (0 .. $cols-1) {
         push(@col_names, $alpha[$i]);
     }

     $dbh->func({table_name  => $table,
                 col_names   => join(',',@col_names),
                 data_type   => 'ARRAY',
                 data_source => \@body,
             }, 'import' );

     my $orderby;
     {
         my @tmp;
         for my $ord (@ords) {
             my $ao=abs($ord);
             push(@tmp,
                  join(' ',
                       $alpha[$ao],
                       $ao==$ord ? "ASC" : "DESC"));
         }
         $orderby=join(', ', @tmp);
     }

     # DBD::RAM 'export array' method broken?
     my $sth = $dbh->prepare("SELECT * FROM $table ORDER BY $orderby");
     $sth->execute();
     my @body;
     while( my (@cells) = $sth->fetchrow_array) {
         push(@body, \@cells);
     }
     $sth->finish();
     $dbh->disconnect();
     return(\@body);
}
1;


---
Gabriel C. Millerd |        Oh loneliness and cheeseburgers are a deadly
     Super Plumber |                combination. -Comic Book Guy
                   |

Reply via email to