---------- Forwarded message ---------- From: Jonathan Scott Duff <[EMAIL PROTECTED]> Date: Nov 22, 2006 2:45 PM Subject: Re: [Pdl-porters] PDL - RDBMS linkage To: [EMAIL PROTECTED] Cc: pdl-porters@jach.hawaii.edu, [EMAIL PROTECTED]
On 11/22/06, Doug Hunt <[EMAIL PROTECTED]> wrote:
Hi Jonathan: I've done a bit of messing around with postgres and PDL. To get a list postgres 1D arrays into a 2D PDL, I do this: my $p = pdl ( map { tr /{}/[]/ && eval } @{$dbh->selectcol_arrayref($sql)} );
I'm kind of looking for a way to get perl out from in between the DBMS and PDL. Sure, I can pull all of the data from the DBMS into perl-space and then create a piddle from that, but it would be nicer if there were a way to do something like this: use PDL; use DBI; use DBI2PDL; # okay, this name sucks, but work with me here :) # ... my $p = $sth->fetchrow_pdl; # or ... my $q = $sth->fetchall_pdl; # or whatever ... Basically I'm thinking that this hypothetical module would add *_pdl routines that would complement the *_array routines of DBI. Of course there will have to be some smarts to deal with non-numeric columns and such, but that's a detail best left for an actual implementation. :-) I don't know enough about PDL's insides to know just how possible this is and I just realized that I probably don't know enough about DBI's insides either. -Scott -- Jonathan Scott Duff [EMAIL PROTECTED] -- Jonathan Scott Duff [EMAIL PROTECTED]